# Convergence of an ODE

1. May 17, 2012

### brydustin

I have a pesky problem, I have this function of time, S(t) and i'm trying to find how far to evaluate S (its an expensive process and must be done for finite t=time). Essentially, I want to measure S until dS/dt ≈ 0. But my current criteria is making the computation itself inefficient not to mention it is erroneous -- at times it is satisfied at very early t and at other times as t approaches infinity. Now, in theory the solution "really" only exists as t approaches infinity (i.e. dS/dt = 0, thence we take ≈0)
So currently, my approach has been a secant approximation of the derivative
(i.e. [ S(t_{n}) - S(t_{n-1}) ] / [t_{n} - t_{n-1}] < tolerance )

Where t_{n} - t_{n-1} is roughly 10^-15 (its a small scale because all the dynamics of this ODE happen on short time scales.) The code was constructed in python so if there are already built in functions that can help in my situation that would be nice as well.

All help appreciated!

2. May 17, 2012

### ryan.j

With a scale that small, it is likely that you are unable to resolve due to the machine precision of your platform.

Try normalizing your units of time to something much smaller than seconds (assuming that's the unit you're using now).