MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Ploting a changing constant

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

On 3/2/06 at 6:47 AM, Mary.Mulcahy at (Mary Beth Mulcahy)

>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

    Plot[y[y[x, #], {x, 0, 33}]&/@Range[10, 150, 15]]]
and using MapThread you could say color each of the plots differently using

      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

  • Prev by Date: Re: Possible Bug in ArcTan ?
  • Next by Date: 3D voronoi problem in mathematica
  • Previous by thread: Re: Ploting a changing constant
  • Next by thread: Re: Ploting a changing constant