I have a function (Piecewise) that returns a list, e.g.:
F[x_] := Piecewise[{{{x^2, x}, x < 0}, {{x, x^2}, x > 0}}, {0, 0}];
I would like to add another list (e.g. {2,3}) to the output of that function, i.e., I would like to obtain:
If I simply do:
{2, 3} + F[x]
I obtain:
{2 + F[x], 3 + F[x]}
,i.e.:
which is not what I want. Naturally, I could include the list I want to add ({2,3}) in every branch of the definition of the Piecewise function, e.g.:
Piecewise[{{{2, 3} + {x^2, x}, x < 0}, {{2, 3} + {x, x^2}, x > 0}, {2,3}}]
But this is unsatisfactory, because my actual problem is much more convoluted that this MWE, with many different cases in the piecewise function, and I also want to use the result of the function as a vector in matrix multiplications and so on.
I have tried things like:
MapThread[Plus,{{2, 3}, F[x]}]
Add[x_List, y_List] := x + y;
Add[{2, 3}, F[x]]
Assuming[VectorQ[F[_]], {2, 3} + F[x]]
without any success. Is there any simple way of doing this? Thanks a lot