MathGroup Archive 1999

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

Search the Archive

Re: question

  • To: mathgroup at
  • Subject: [mg15660] Re: question
  • From: "Allan Hayes" <hay at>
  • Date: Sat, 30 Jan 1999 04:28:53 -0500 (EST)
  • References: <78pa6k$>
  • Sender: owner-wri-mathgroup at

Alice M. Dean wrote in message <78pa6k$cn1 at>...
>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


I'll begin with how it can be done; then offer some explanation.


First extract the formula  5.3 E ^(0.031t

fmla= P[t] /.{{P[t] -> 5.3 E ^(0.031t)}}[[1]]


You could use this directly to get the values



But it is usually better to define a function using the formula

P[t_] = fmla; (* the semicolon stops output being displayed when this is
not wanted*)

Now we have



Which can be done more conveniently  by mapping the function P over the
list {10,100,1000}



The FullForm of P/@{10,100,1000} is Map[P, {10,100,1000}] (*please look
up Map*)


Why a list of lists?
Because, in general, equations can have several solutions for several

For simplicity, I'll use an ordinary algebraic problem.

sol=Solve[{y ^2== x^2, y==t},{x,y}]

    {{x -> -t, y -> t}, {x -> t, y -> t}}

Why rules instead of  simply {{-t, -t},{t,t}}?                (**)

Because (1)  the rules make clear which formula goes with which
variable; and (2) they allow subsititutions of the solutions in any



We can get the separate solutions


    {x -> -t, y -> t}


    {x -> t, y -> t}

And make functions corresponding to them






Allan Hayes
Mathematica Training and Consulting
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

  • Prev by Date: Re: How to construct all possible orderings
  • Next by Date: Re: How to construct all possible orderings
  • Previous by thread: Re: question
  • Next by thread: RE: Re: question