I am working with two multi-variable functions A
and B
. They depend on some counting factors n
and n primed
(integers, larger than, or equal to zero) and additional real variables x, y, z
. My functions are actually complicated, but for simplicity assume, for example,
A[nn_, np_, x_, y_, z_] := (1/nn + 1/np) (2 x + 2 y + 2 z);
B[nn_, np_, x_, y_,z_] := (1/Factorial[nn] + 1/Factorial[np]) (3 x + 3 y + 3 z);
I would like to use an If
statement to assign either A
or B
to become the definition of a third function V
. In the example above this is needed to prevent division by zero. I tried different variations of
V[nn_, np_, x_, y_, z_] :=
If[nn > 0 || np > 0, A[nn, np, x, y, z], B[nn, np, x, y, z]];
but I cannot figure out what the correct syntax is. What I would like to accomplish is to use a statement that assigns the expression given by function A
to function V
when n
or n prime
are NOT zero and assigns function B
to function V
when either n
or n primed
are zero.
Or (||)
toAnd (&&)
in the first argument ofIf
? $\endgroup$