Hi, everyone!
I am dealing with a problem that requires the use of conditionals applied to choose one function rather than the other, depending on the value assumed by a third function. For example, there are two functions F1[x,y] and F2[x,y], and also the third function G[y]. If G[y] is higher than a constant value (for instance 2000), F1[x,y] must be chosen; otherwise, F2[x,y] is used for computation. I wrote a code to do that, but unfortunately it didn’t work out.
G[y_]:=10*y
F1[x_,y_]:=(x-x^2)*(1-2*x)+0.1*y^2*(1-2*x)/(x-x^2)^2 if G[y]>=2000
F2[x_,y_]:=(x-x^2)*(1-2*x)+5*y*(1-2*x)/(x-x^2)^2 if G[y]<2000
The aim is to choose F1[x,y] for computation if G[y]>=2000 or F2[x,y] if G[y]<2000.
In fact, a generic function F[x,y] will become F1[x,y] or F2[x,y] depending on G[y].
Thus, F[x,y] is used for computation.
How can F[x,y] be written then?
I defined the function F[x,y] using the command Piecewise as a typical mathematical expression.
F[x,y] = F1[x,y] for G[y]>=2000 and F2[x,y]=F2[x,y] for G[y]<2000
Is this really the most appropriate command to do that?
How is another way of doing this in Mathematica?
Thank you in advance for your response.