LimpyNuts All American 16859 Posts user info edit post |
So I have an expression (expr) to which I find the roots. I want to plot the roots as a function of the parameters in the expression. Here's what I do:
l:=solve(expr,x); f[1]:=(d,e,f)->subs([a=d,b=e,c=f],l[1]); f[2]:=(d,e,f)->subs([a=d,b=e,c=f],l[2]); with(plots): plot3d(f[1](1,x,y),x=0..2,y=0..2);
This is total crap as it takes like 2 minutes and about 200 MB of RAM to generate the plot. How can I create a function from the output of solve() without using subs()? I need to perform this for a variety of 'expr' expressions, whose roots are very complicated. I do not want to retype the output from solve() into the function definitions each time I change 'expr'.
P.S. No, "f[1]:=(a,b,c)->l[1];" does not work. It appears the type of l[1] does not agree with what the function assignment expects as input, or it's using a reference to the l[1] object instead of its value. 9/13/2007 5:32:37 PM |