Re: Step Info from NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg33648] Re: Step Info from NDSolve
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Thu, 4 Apr 2002 19:40:14 -0500 (EST)
- References: <a8g34f$b2p$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Brian Higgins" <bghiggins at ucdavis.edu> wrote in message news:a8g34f$b2p$1 at smc.vnet.net... > Hi Mathgroup, > Is there anyway to get step information (number of steps, step size) > from NDSolve during the actual integration Brian, The following trick is generally applicable: If a print out of progress is sufficient, h[(x_)?NumberQ, fx_, rhs_] := (Print[{x, fx}]; rhs) NDSolve[{f'[x] == h[x, f[x], 2*f[x]], f[0] == 1}, f, {x,0, 1}] If you want data to work on then g[(x_)?NumberQ, fx_, rhs_] := (points = Append[points, {x, fx}]; rhs) points = {}; NDSolve[{f'[x] == g[x, f[x], 2*f[x]], f[0] == 1}, f, {x, 0, 1}] -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565