Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Numerical values whith Plot and Manipulate' topicStudent Support Forum > General > "Numerical values whith Plot and Manipulate"

Next Comment >Help | Reply To Topic
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: ,

Subject (listing for 'Numerical values whith Plot and Manipulate')
Author Date Posted
Numerical values whith Plot and Manipulate Fred 11/27/08 11:53am
Re: Numerical values whith Plot and Manipulate Xavier 11/27/08 8:38pm
Re: Re: Numerical values whith Plot and Manipul... Fred 11/28/08 09:36am
Re: Numerical values whith Plot and Manipulate Xavier 11/29/08 1:31pm
Next Comment >Help | Reply To Topic