| Author |
Comment/Response |
Fred
|
11/27/08 11:53am
Hello,
Let's consider the following example:
**************************************
NumValues={
a->2,
L->50
};
y[x_]:=a*Sin[x/L*Pi];
Plot[y[x]/.NumValues,{x,0,L}]
**************************************
It won't work, because L in {x,xmin,xmax} is not evaluated. The only solution I've found is:
**************************************
Plot[y[x]/.NumValues,{x,0,L/.NumValues}]
**************************************
...but it's not very practical when /.NumValues has to be redundant.
Better would be something like :
**************************************
Plot[y[x],{x,0,L}]/.NumValues
**************************************
...but it doesn't work!
Another problem with the same function y:
**************************************
Manipulate[y[x],{a,0,5}]
**************************************
It doesn't work : y[x] is displayed as defined, but a isn't evaluated as I move the slider. And again I don't want to define y as a function of x AND a AND L, because in reality I have many "constants" (a, L, ...), the effect of which I want to see only sometimes.
Are there any solutions to these problems?
Thank you!
URL: , |
|