Solving ODE Convergence Problem with Secant Approximation

  • Thread starter Thread starter brydustin
  • Start date Start date
  • Tags Tags
    Convergence Ode
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
brydustin
Messages
201
Reaction score
0
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!
 
Physics news on Phys.org
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).