MathGroup Archive 2010

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

Search the Archive

Re: Plot and DSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113851] Re: Plot and DSolve
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Mon, 15 Nov 2010 05:52:49 -0500 (EST)

That is because of the HoldAll attribute of Manipulate. You can see the same thing happen if you replace Manipulate by With (which also has the HoldAll attribute), e.g.

With[{c == 10, u == 10, L == 2},
 Plot[Evaluate[x@t /. z], {t, 0, 10}, PlotRange -> {0, 5 u/L}]]

will produce no plot, but if you replace z by its value {{{x -> Function[{s}, (c*L + u*E^(L*s) - u)/(E^(L*s)*L)]}} you will get one. The reason is that With (or Manipulate) does not initially "see" that z involves c,u and L so it does not substitute numerical values for these variables into the expression for z. Thus, what  Plot ends up trying to do:

Plot[{(E^(-L t) (c L-u+E^(L t) u))/L},{t,0,10},PlotRange->{0,(5 10)/2}]

which, of course, produces no graph.

Andrzej Kozlowski


On 14 Nov 2010, at 12:09, Bruce Colletti 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: Plotting functions and lines on the same figure?
  • Next by Date: SetAttributes[CenterDot, Flat]
  • Previous by thread: Re: Plot and DSolve
  • Next by thread: Reduce with system of equations involving D