Re: Ploting a changing constant

*To*: mathgroup at smc.vnet.net*Subject*: [mg64796] Re: Ploting a changing constant*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Thu, 2 Mar 2006 21:46:51 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

On 3/2/06 at 6:47 AM, Mary.Mulcahy at colorado.edu (Mary Beth Mulcahy) wrote: >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. The following will do what you want Show[ Block[{$DisplayFunction=Identity}, Plot[y[y[x, #], {x, 0, 33}]&/@Range[10, 150, 15]]] and using MapThread you could say color each of the plots differently using Show[ Block[{$DisplayFunction=Identity}, MapThread[ Plot[y[y[x,#1], {x, 0, 33}, PlotStyle->#2]&, {Range[10, 40, 15], {Red,Blue,Black}]]] Using this second scheme you can add individual labels for each of the plots and so on -- To reply via email subtract one hundred and four