MathGroup Archive 1999

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

Search the Archive

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[1]:= soln = First @ DSolve[{P'[t]==0.031P[t], P[0]==5.3}, P[t],t]

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

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

In[3]:= P[100]

Out[3]= 117.64914179164

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

In[4]:= 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[5]:= Clear[P]  (* needed only if P already defined *)

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

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

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

In[8]:= P[100]

Out[8]= ((53 E^(31/10))/10

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

Out[9]= 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[0]==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[10], P[100], 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:
> adean at skidmore.edu
> WWW: http://www.skidmore.edu/~adean
> ~~~~~~~~~~~~~~~~~~~~~~~~~

-- 
Murray Eisenberg                     murray at math.umass.edu Mathematics &
Statistics Dept.       phone 413 549-1020 (H) Univ. of Massachusetts   
413 545-2859 (W) Amherst, MA 01003-4515


  • Prev by Date: Re: speed
  • Next by Date: Re: How to construct all possible orderings
  • Previous by thread: Evaluation Group Redux
  • Next by thread: 4th order DE, NDSolve no solution, why?