I mean to plot a function of one variable, which uses a paramter that is not included as an argument to the function.
Now I want to plot2d
the function, so I mean to assign a temporary value to the parameter for plotting. I.e.:
What I did is
f(u):=a*u;
a=1;plot2d(f(u),[u,0.2,1]);
but I get the error
plot2d: expression evaluates to non-numeric value everywhere in plotting range.
plot2d: nothing to plot.
How would I proceed?
PS: I actually mean to work with functions using many parameters, so if excluding them as arguments is workable, I'd rather do it for convenience. Up to now, I have been integrate
ing, diff
erentiating, factor
ing, etc., with no problems.
Self-answering: It was probably a silly question (I am a newbie), but just in case it helps others...
f(u):=a*u;
a:1;
plot2d(f(u),[u,0.2,1]);
kill(a);
To avoid assigning and clearing:
params : [a=1];
fnew : subst(params,f(u));
plot2d(fnew,[u,0.2,1]);
Other options are posted in the comment by Robert Dodier.