Solving ODE Convergence Problem with Secant Approximation

  • Thread starter Thread starter brydustin
  • Start date Start date
  • Tags Tags
    Convergence Ode
AI Thread Summary
The discussion centers on the challenge of evaluating a time-dependent function S(t) efficiently, particularly in determining when the derivative dS/dt approaches zero. The current method involves a secant approximation for the derivative, but this approach is proving inefficient and sometimes erroneous, as the condition can be satisfied too early or late in the time frame. The theoretical solution only exists as time approaches infinity, complicating finite evaluations. A suggestion is made to normalize the time units to a smaller scale than seconds, which may help address issues related to machine precision and improve the accuracy of the computations. Additionally, the use of built-in Python functions for numerical differentiation is recommended to enhance efficiency.
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).
 

Similar threads

Back
Top