Re: Mathematica question : Stepsize control
- To: mathgroup at smc.vnet.net
- Subject: [mg83409] Re: Mathematica question : Stepsize control
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 20 Nov 2007 03:41:38 -0500 (EST)
- Organization: Uni Leipzig
- References: <fhp1uf$1h9$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, switch to a solver (Method) that works for stiff systems, this solver will take care about fast and slow components and reduce the local error because the step size control will only estimate the local error but you look for the global error and the simplets way would be to request a higher precision. Regards Jens Yannick Bartocci wrote: > Hy, > I would like to ask a question on your forum bout some Mathematica code I > cannot solve. > > Here is a Riccati type equation I want to solve numerically : > > tend = 0.5*10^4; > ktest = 10^(-8); > h[t_, k_] = k + 10^(-6)*Cos[[Pi]/(2*tend)*t]; > equ = {f'[t]+(f[t])^2+h[t,ktest] == 0, f[1] == 0.1}; > {ndsol, steps} = Reap[NDSolve[equ, f, {t, 1, tend}, MaxSteps -> \[Infinity], > StepMonitor :> Sow[{t, f[t]}]]] > > this code gives diverging solution for f[t], but note that if > tend = 10^2 > the solution is not diverging, which is what I want to reproduce for tend = > 0.5*10^4 or larger. > > Actually the system I want to solve uses a more complicated h[t,ktest] as > Interpolating function input which is slowly varying in the beginning but > rapidly oscillating in the end. Initially it behaves like the system > described above and gives NDSolve message ::ndsz. > > This clearly is a problem of stepsize control but which has to be adapted on > the fast or slow behavior of the input function h[t,ktest]. > > Can anybody help me to find out how to control stepsize for this problem? > The mathod in NDSolve is by default Automatic. > > Thank you very much, > > Yan > >