Re: Help getting values from NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg6849] Re: Help getting values from NDSolve
- From: jost at no-junk-mail.fr (Christian Jost)
- Date: Thu, 24 Apr 1997 02:44:30 -0400 (EDT)
- Organization: Universite Paris-Sud XI
- Sender: owner-wri-mathgroup at wolfram.com
In article <5j75mr$5ok at smc.vnet.net>, "Christopher Moss" <mosser at earthlink.net> wrote: > I'm relatively new to Mathematica and need some help with the NDSolve > function. I have used it to solve an ordinary differential equation and got > the expected interpolating function which I then plotted. The plot is great > but I would like a list of coordinates so that I can analyze them further > and possibly import into a "prettier" graphing package. > After simulation In[6]:= solution = NDSolve[{x'[t]== 1.7 x[t],x[0]==1.0},x,{t,0,10}]; solution is now like a list of rules, use Apply or its shortcut /. to extract values In[7]:= {5,x[5]} /. solution Out[7]= {{5,4914.83}} In[9]:= Table[{t,x[t]} /. solution,{t,0,10}] Out[9]= \!\({{{0, 1.`}}, {{1, 5.47398247034581775`}}, {{2, 29.9643350630800888`}}, {{ 3, 164.023441789861523`}}, {{4, 897.857167517260457`}}, {{5, 4914.8291275592113`}}, {{6, 26903.5623625458697`}}, {{7, 147268.905784071213`}}, {{8, 806143.319096327637`}}, {{9, 4.41279377748526435`*^6}}, {{10, 2.41554318832612802`*^7}}}\) hth, Christian. ps: there are good examples in the mathematica book, you will find solutions to all kind of syntax problems faster than on usenet ;-) -- ********************************************************************* Christian Jost, Université Paris-Sud XI, Orsay, France Please don't send any junk mail or advertisements. For personal mail please send to: Christian.Jost at epc.u-psud.fr