MathGroup Archive 2006

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

Search the Archive

Re: Ploting a changing constant

  • To: mathgroup at
  • Subject: [mg64782] Re: Ploting a changing constant
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at>
  • Date: Thu, 2 Mar 2006 19:27:57 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <> <> <du6mb6$5am$>
  • Sender: owner-wri-mathgroup at

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.
Hi Mary Beth,

You could use the *Table* built-in function to generate a list of plots 
as in

f[n_Integer][x_] := n*x
DisplayTogether[Table[Plot[f[n][x], {x, 0, 33}],
     {n, 10, 150, 10}]];

Best regards,

  • Prev by Date: Plot[] of smooth function results in wildly fluctuating graph?
  • Next by Date: Re: Ploting a changing constant
  • Previous by thread: Re: Ploting a changing constant
  • Next by thread: Re: Ploting a changing constant