Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Plot and DSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113852] Re: Plot and DSolve
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 15 Nov 2010 05:53:01 -0500 (EST)

It's a scoping issue. Make the parameters explicit and there will be a single definition for each variable.

Clear[z, x, t]

z[c_, L_, u_, t_] = 
  Simplify[x[t] /. 
    DSolve[{x'[t] == -L x[t] + u, x[0] == c}, x[t], t][[1]]];

Manipulate[
 Plot[z[c, L, u, t], {t, 0, 10},
  PlotRange -> {0, 5 u/L}],
 {c, 10, 20},
 {u, 10, 15},
 {L, 2, 4}]


Bob Hanlon

---- Bruce Colletti <bwcolletti at verizon.net> wrote: 

=============
Re 7.0.1 under WinXP.

The code below works as expected:

z = DSolve[{x'[t] == -L x[t] + u, x@0 == c}, x, t]

Manipulate[
 Plot[Evaluate[x@t /. %], {t, 0, 10}, PlotRange -> {0, 5 u/L}],
 {c, 10, 20},
 {u, 10, 15},
 {L, 2, 4}]



However, when z (DSolve output) replaces % (in Plot), there's no plot.  What
causes this?

Thanks.

Bruce 



  • Prev by Date: Re: Mathematica 8
  • Next by Date: Simplification question in Mathematica 7
  • Previous by thread: Plot and DSolve
  • Next by thread: Re: Plot and DSolve