I have 2 functions declared in wxmaxima: f1(x, y)
and f2(x, y)
. Both contain if-then-else statements and basic arithmetic operations: addition, subtraction, multiplication and division.
For example (just an example, real functions look much more complicated):
f1(x, y) := block([],
if x * y < 123 then x + y
else if x / y > 7 then x - y
);
In both functions x
and y
change from 0.1 to 500000.
I need a 3D plot (graph) of the following points:
(x, y, z), where f1(x, y) == f2(z, x)
Note that it's impossible to extract z
out from the equation above (and get a new shiny function f3(x, y)
), since f1
and f2
are too complex.
Is this something possible to achieve using any computational software?
Thanks in advance!
EDIT: What I need is the plot for
F(x, y, z) = 0
where
F(x, y, z) = f1(x, y) - f2(z, x)
For Maxima, try implicit_plot(f1(x, y) = f2(x, y), [x, <x0>, <x1>], [y, <y0>, <y1>])
where <x0>, <x1>, <y0>, <y1>
are some floating point numbers which are the range of the plot. Note that load(implicit_plot)
is needed since implicit_plot
is not loaded by default.
As an aside, I see that your function f1
has the form if <condition1> then ... else if <condition2> then ...
and that's all. That means if both <condition1>
and <condition2>
are false, then the function will return false, not a number. Either you must ensure that the conditions are exhaustive, or put else ...
at the end of the if
so that it will return a number no matter what the input.