[Date Index]
[Thread Index]
[Author Index]
Re: Ploting a changing constant
*To*: mathgroup at smc.vnet.net
*Subject*: [mg64775] Re: [mg64740] Ploting a changing constant
*From*: "David Park" <djmp at earthlink.net>
*Date*: Thu, 2 Mar 2006 19:27:47 -0500 (EST)
*Sender*: owner-wri-mathgroup at wolfram.com
Mary Beth,
Plot allows a list of functions to plot. This can be generated by Table but
you must Evaluate the Table statement.
y[x_, a_] := a x
Plot[Table[y[x, a], {a, 10, 50, 10}] // Evaluate, {x, 0, 33}];
I would like to call 'a' a parameter and I would tend to define such a
(different) function in the following manner.
Clear[y]
y[a_][x_] := x^a
Then you can easily write the derivative of the function as...
y[2]'[x]
2 x
If you wanted to plot a series of curves with different values of a, but not
necessarily evenly spaced, then you could use MapThread. Here is an example.
Plot[MapThread[y[#][x] &, {{0, 0.2, 0.5, 1, 2, 5}}] // Evaluate, {x, 0, 1},
Frame -> True];
If you wanted to plot the derivatives then you could use...
Plot[MapThread[y[#]'[x] &, {{0, 0.2, 0.5, 1, 2, 5}}] // Evaluate, {x, 0, 1},
PlotRange -> {0, 4},
Frame -> True];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Mary Beth Mulcahy [mailto:Mary.Mulcahy at colorado.edu]
To: mathgroup at smc.vnet.net
OK, so this has to be an easy one. I am trying to plot a function several
times
for a variety of values of a constant. For example:
y[x_, a_]:=a*x
I want to plot a=10, a=20 overlaying one another. Currently I simply
rewrite
the equation however many times I need to change the variable. For example:
DisplayTogether[Plot[y[x, 10], {x, 0, 33}],Plot[y[x,20], {x, 0,
33}],Plot[y[x,30], {x, 0, 33}],Plot[y[x,40], {x, 0, 33}],Plot[y[50], {x, 0,
33}]]
I'm plotting this equation 15 times with a increasing in steps of ten.
Seems to
me there should be a single command to do this rather than cut and paste 10
times (and then go back in to change the variable by hand). Something like
in
Sum[] where you can state the beginingvalue, end value and step size.
Thanks for the help.
mary beth
--
Department of Chemistry and Biochemistry
University of Colorado
Chemistry 76
Boulder, CO 80309-0215
(303) 492-0579
Prev by Date:
**Re: No mesh with Graphics3D**
Next by Date:
**Re: Ploting a changing constant**
Previous by thread:
** Re: Ploting a changing constant**
Next by thread:
**Re: Ploting a changing constant**
| |