       Re: question [using result of DSolve]

• To: mathgroup at smc.vnet.net
• Subject: [mg15672] Re: question [using result of DSolve]
• From: Murray Eisenberg <murray at math.umass.edu>
• Date: Sat, 30 Jan 1999 04:29:04 -0500 (EST)
• Organization: Mathematics & Statistics, Univ. of Mass./Amherst
• References: <78pa6k\$cn1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```One way is as follows (note that I'm showing output in a linearlized
form and not in Mathematica Standard form):

In:= soln = First @ DSolve[{P'[t]==0.031P[t], P==5.3}, P[t],t]

Out= {P[t] ->
5.3000000000000 2.718281828459045^0.0310000000000000 t}

In:= P[t_] := Evaluate[P[t] /. soln]

In:= P

Out= 117.64914179164

At this point you can do pretty much anything with the solution
function, e.g.:

In:= Plot[P[t], {t, 0, 100}]

Instead of the original DSolve expression, one might want to get an
exact solution by entering exact numbers as coefficients of the ODE:

In:= Clear[P]  (* needed only if P already defined *)

In:= soln = First @ DSolve[{P'[t]==(31/1000) P[t], P==(53/10)},
P[t],t]

Out= {P[t] -> (53/10) E^((31 t)/1000)}

In:= P[t_] := Evaluate[P[t] /. soln]

In:= P

Out= ((53 E^(31/10))/10

In:= P[100.]               (* or N[ P ] *)

Out= 117.649

Alice M. Dean wrote:
>
> Hi, I was given this address by a colleague, who said you could quickly
> answer what I think is a very simple question.  After I evaluate the
> following in mathematica,
>
> DSolve[{P'[t]==0.031P[t], P==5.3}, P[t],t]
>
> I get a result which is essentially: {{P[t] -> 5.3 E ^(0.031t)}}
>
> inside two sets of curly brackets.
>
> I would now like to compute P, P, etc.  Is there a reasonable
> way to do this?  Thanks, Alice Dean
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~
> Alice Dean
> Mathematics & Computer Science Department Skidmore College
> Saratoga Springs, NY 12866
>
> Phone: (518) 580-5286
> Fax: (518) 580-5936
> Skidmore College Information: (518) 580-5000   E-mail: