MathGroup Archive 2009

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

Search the Archive

Re: Using manipulate in two cells in one note book crashes my

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98169] Re: Using manipulate in two cells in one note book crashes my
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 1 Apr 2009 05:56:26 -0500 (EST)
  • References: <gqsn3u$3oq$1@smc.vnet.net>

Hi Sean,

Since both plots and manipulates use the same global variables they
will interact continuously if they are visible in the same notebook.
Use DynamicModule to localize the variables and shield them from each
other.

Like this:

DynamicModule[{k1, k2, b0, bp0, dsol, b},
 Manipulate[
  dsol = DSolve[{k1 k2 b[t] == k1 b'[t] + b''[t], b[0] == b0,
     b'[0] == bp0}, b[t], t];
  Plot[Evaluate[b[t] /. dsol], {t, 0, 10}, PlotRange -> All], {k1,
   0.1, 10}, {k2, 0.1, 10}, {b0, 0.1, 10}, {bp0, 0.1, 10}]]


Cheers -- Sjoerd

On Mar 31, 11:17 am, sean_inc... at yahoo.com wrote:
> Hello Group.
>
> I'm having an awful time with this.  I have 2 essentially same codes
> using manipulate. Only differences are the ODEs.
>
> When I have both of the cells open, the Mathematica goes crazy, with
> the cell brackets flashing as if it's evaluating both cells at the
> same time.  Eventually it will crash or I have to stop it using "Alt
> +."
>
> Is anyone else having the same problem?
>
> Here're the cells causing problems.
>
> cell 1
>
> Manipulate[dsol=DSolve[{b''[t]==-k1 k2 b[t]-k1 b'[t], b[0]==b0,=
 b'[0]
> ==bp0}, b[t], t];
> Plot[Evaluate[b[t]/.dsol],{t, 0, 10},PlotRange-> All], {k1, 0.1, 10},
> {k2, 0.1, 10}, {b0, 0.1, 10}, {bp0, 0.1, 10}]
>
> cell 2
>
> Manipulate[dsol=DSolve[{k1 k2 b[t]==k1 b'[t]+b''[t], b[0]==b0, =
b'[0]
> ==bp0}, b[t], t];
> Plot[Evaluate[b[t]/.dsol],{t, 0, 10},PlotRange-> All], {k1, 0.1, 10},
> {k2, 0.1, 10}, {b0, 0.1, 10}, {bp0, 0.1, 10}]
>
> In two separate notebooks, these two cells cause no problems. In the
> same notebook, if one of the cells are closed (by double clicking on
> the cell bracket), they don't cause problems. It's only when the cells
> are both open, the mathematica goes crazy and crashes.
>
> Thanks for any info.
>
> Sean



  • Prev by Date: Questions about Locators
  • Next by Date: Re: Integrating package documentation with the documentation center
  • Previous by thread: Re: Using manipulate in two cells in one note book crashes my
  • Next by thread: Re: Using manipulate in two cells in one note book crashes my computer.