Re: 'Changing' parameters in an expression

• To: mathgroup at smc.vnet.net
• Subject: [mg60550] Re: [mg60528] 'Changing' parameters in an expression
• From: <bsyehuda at gmail.com>
• Date: Tue, 20 Sep 2005 05:19:04 -0400 (EDT)
• References: <200509190845.EAA23546@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,
First, the expression eqn[[2]]/.a->1/2 equals to (-1/2+x[t])x[t]
x[t] is still unknown (you didn't solve the differential equation yet), so
what are you trying to plot? Plot returns an answer that it cannot get a
number for each value of t in the range required for the plot.
You didn't define initial conditions as well.
For the specific case of your differential equation you can use Solve
Solve[eqn,x[t],t]
and get (in Inputform format)
Out[10]=
{{x[t] -> (a*E^(a*C[1]))/(-E^(a*t) + E^(a*C[1]))}}
where C[1] need to be determined by a specific initial condition.
When you determine this initial condition wou will be able to plot the
results
yehuda

On 9/19/05, Matt <anonmous69 at netscape.net> wrote:
>
> 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
>
>

```

• Prev by Date: Re: Differences between recursions and limit
• Next by Date: Re: Decimal comma on input
• Previous by thread: 'Changing' parameters in an expression
• Next by thread: Re: 'Changing' parameters in an expression