| Author |
Comment/Response |
Deanne Taylor
|
12/03/00 3:16pm
Hi! I'm having a problem in Mathematica, once which is very vexing and I'm not sure what I need to do to fix it.
Basically, I am calculating several variables that themselves depend on one symbolic variable, like so:
x(y,t)=const1*y(var1)*Cos[t*const2]
where const1 and 2 are just constants, and y is a function of ''var1'', another variable.
In Mathematica, after declaring
y=const1 * var1
x=const2*y*Cos[const3*t]
I want to graph x in Plot3D, such as,
Plot3D[x,{var1,0,ymax},{t,0,tmax}] where ymax and tmax are already defined.
So, basically, y is parameterized, I guess, for var1.
Unfortunately, I get error messages thus:
'' Plot3D::''plnc'': x is neither a machine-size real number at{y, t}={0.1694915254237288, 0.`} nor a list of a real number and a valid color directive.''
My function IS evaluating correctly; when I substitute y and t for numbers, I get expressions that are purely numeric.
The interesting thing is this: When I re-define x in terms of var1 explicitly by substituting y's function for y, of course Plot3D works! So something like
x=(const1 * var1)*const2 * Cos[const3*t]
will work with Plot3D as I've typed it above.
Basically, I see this as a persistence problem...the Plot3D does not understand that y's variable var1 must be ''brought through'' with the x(y,t) so that x is really x(var1,t) in order to plot it. I need it to remain thusly because of the complexity of the previous notebook expressions. Can anyone help me figure out how to make x a function of y's 'var1' explicitly without typing in all of y every time? The problem is that y changes depending on what it is a function of, and I want to be able to graph x no matter what single variable I am deciding to vary in y.
URL: , |
|