Re: How to change time stepsize for Integration

• To: mathgroup at smc.vnet.net
• Subject: [mg33982] Re: How to change time stepsize for Integration
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Thu, 25 Apr 2002 03:00:00 -0400 (EDT)
• References: <aa5gkf\$c09\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Winston,
NDSolve has the option MaxStepSize
Plot has the option PlotPoints, which determines the initial sample points
Table has the syntax  Table[expr, {x,a, b, stepsize}] (*but to reach b,
stepsize must be (b-a)/n*)
--
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

"Winston Garira" <uceswga at ucl.ac.uk> wrote in message
news:aa5gkf\$c09\$1 at smc.vnet.net...
> Hi!
>
> Can anyone help me on this one:
>
>
> Pends[init_, time_, {c_, w_, p_}] :=
>     Module[{},
>       pend = NDSolve[{x''[t] + c x'[t] + (1 + p Cos[w t])Sin[x[t]] == 0,
>             x[0] == init[[1]], x'[0] == init[[2]]}, {x}, {t, 0, time},
>           MaxSteps -> 200000];
>       xd[t_] := x[t] /. pend[[1]];
>       xdd[t_] := x'[t] /. pend[[1]];];
> c = 0.1; w = 0.30; p = 1.1;
>
> Pends[{1.37, 0}, 5000, {c, w, p}];
> plt = Plot[{t, xd[t], xdd[t]}, {t, 0, 500}];
>
> I want to reduce the time stepsize
> in my numerical integration with mathematica. Each time
> I try to get coordinates generated from the command
> Plot[ ......, {t, tmin, tmax}]; or
> Table[......, {t, tmin, tmax}];
>
> I always notice that in all these case time stepsize = 1.
> Is there anyway I can reduce the the timestep to say,
> time stepsize =0.001 in the above numerical integration using
> NDsolve.
>
>