Mathematica question : Stepsize control
- To: mathgroup at smc.vnet.net
- Subject: [mg83357] Mathematica question : Stepsize control
- From: "Yannick Bartocci" <yannick.bartocci at gmail.com>
- Date: Sun, 18 Nov 2007 04:48:07 -0500 (EST)
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