MathGroup Archive 2005

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

Search the Archive

Re: 'Changing' parameters in an expression

  • To: mathgroup at
  • Subject: [mg60540] Re: 'Changing' parameters in an expression
  • From: Peter Pein <petsie at>
  • Date: Tue, 20 Sep 2005 05:18:54 -0400 (EDT)
  • References: <dgm0sp$o21$>
  • Sender: owner-wri-mathgroup at

Matt schrieb:
> Hello,
>   What follows (at the end) worked for me, however, I'm wondering if
> it's the 'right' approach or not.  What I mean by 'right' is this:  my
> eventual approach worked, but there may be another approach that is
> more efficient and demonstrates a more wide ranging principal in using
> Mathematica, and hence would be applicable in many situations.
> I started off with this:
> eqn = x'[t] == x[t](x[t] - a);
> (I am using eqn as the first argument to DSolve, which is why it
> appears as it does.)
> I wanted to plot the rhs of eqn with 'a' having a value of 1/2, so
> first I tried this:
> Plot[eqn[[2]] /. a->1/2, {t, 0, 6}];
> That didn't work as I got these types of errors:
> Plot::plnr : eqn[[2]] /. a -> 1/2 is not a machine-size real number at
> t = ....
> over and over again.
> I tried a few other rules with essentially the same results and then I
> tried this:
> Plot[eqn[[2]] /. {a->1/2, x[t]->x}, {x, 0, 6}];
> Which worked for me.  I'm sure it has something to do with what I'm
> asking Plot to work with.  It just seems strange to me that DSolve will
> work with eqn, but Plot does not.
> Thanks for any help,
> Matt

Hi Matt,

you mixed variables and functions.

In eqn, x is a function. If you want to plot x*(x-1/2) over a real
range, x is a scalar. Using the identity-function for x in eqn should work:
Plot[eqn/.{a->1/2,x->Identity},{t,0,6}], or (shorter)

does what you want.

Peter Pein, Berlin
GnuPG Key ID: 0xA34C5A82

  • Prev by Date: Re: 'Changing' parameters in an expression
  • Next by Date: Re: 'Changing' parameters in an expression
  • Previous by thread: Re: 'Changing' parameters in an expression
  • Next by thread: Re: 'Changing' parameters in an expression