- #1
brydustin
- 205
- 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!
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!