Challenge

Week 5.2 - Literature review: ODE Stability

ODE STABILITY

Objective

Literature review of ODE stability

Theory

Numerical solution schemes are often referred to as being explicit or implicit. When a direct computation of the dependent variables can be made in terms of known quantities, the computation is said to be explicit. When the dependent variables are defined by coupled sets of equations, and either a matrix or iterative technique is needed to obtain the solution, the numerical method is said to be implicit.

In computational fluid dynamics, the governing equations are nonlinear, and the number of unknown variables is typically very large. Under these conditions implicitly formulated equations are almost always solved using iterative techniques.

Iterations are used to advance a solution through a sequence of steps from a starting state to a final, converged state. This is true whether the solution sought is either one step in a transient problem or a final steady-state result. In either case, the iteration steps resemble a time-like process. Of course, the iteration steps usually do not correspond to a realistic time-dependent behavior. In fact, it is this aspect of an implicit method that makes it attractive for steady-state computations, because the number of iterations required for a solution is often much smaller than the number of time steps needed for an accurate transient that asymptotically approaches steady conditions.

Stability, in mathematics, condition in which a slight disturbance in a system does not produce too disrupting an effect on that system. In terms of the solution of a differential equation, a function f(x) is said to be stable if any other solution of the equation that starts out sufficiently close to it when x = 0 remains close to it for succeeding values of x. If the difference between the solutions approaches zero as x increases, the solution is called asymptotically stable. If a solution does not have either of these properties, it is called unstable.

Stability of solutions is important in physical problems because if slight deviations from the mathematical model caused by unavoidable errors in measurement do not have a correspondingly slight effect on the solution, the mathematical equations describing the problem will not accurately predict the future outcome.

The principal reason for using implicit solution methods, which are more complex to program and require more computational effort in each solution step, is to allow for large time-step sizes.

generally

In the explicit solution, parameters are calculated based on previous levels *(e.g.time level):
x(n+1) = x(n)+ z(n)
In the implicit scheme, parameters are dependent on each other at the same time level:
x(n+1) = x(n)+z(n+1)
Implicit methods are more complicated to use but usually much more stable. And so larger time steps can be implemented.
1.when does an ODE become unstable
for explicit euler scheme stability condition is
`|1+h.lambda|le1`
where `lambda =`coefficient in function
and h= time step size
there fore stability condition seems to be if h satisfy the condition
h`le-2/(lambda)`
now considering the problem statement
`f(t)=dy/dt=-1000*y-exp(-t)` when y(0)=0
in explicit scheme
`(y(New)-y(Old))/dt=-1000*y-e^(-t)`
`y(New)=(-1000*y-e^(-t))*dt+y(old)`
in implicit
`(y(New)-y(old))/dt=-1000y-e^(-t)`
`y(New)=(y(Old)-e^(-t)*dt)/(1+1000*dt`
Analytical
soln y(t)=`e^(-1000*t)*(1-e^(999*t))/999`
putting this all in python
import numpy as np
import matplotlib.pyplot as plt

def explicit_euler(total_t,dt):
    t=np.arange(0,total_t,dt)
    y=np.zeros(len(t))
    
    for i in range(1,len(t)):
        y[i]=y[i-1]+dt*(-1000*y[i-1]-np.exp(-t[i-1]))
    
    return [t,y]

def implicit_euler(total_t,dt):
    t=np.arange(0,total_t,dt)
    y=np.zeros(len(t))
    
    for i in range(1,len(t)):
        y[i]=(y[i-1]-np.exp(-t[i-1])*dt)/(1+1000*dt)
    
    return [t,y]
def analytical_euler(total_t,dt):
    t=np.arange(0,total_t,dt)
    y=np.zeros(len(t))
    
    for i in range(1,len(t)):
        y[i]=np.exp(-1000*t[i])*(1-np.exp(999*t[i]))/999
    return y
        
    

total_t=0.1
dt=1e-4
t,y_explicit=explicit_euler(total_t, dt)
t,y_implicit=implicit_euler(total_t, dt)
y_analytical=analytical_euler(total_t, dt)
plt.plot(t,y_explicit,color='blue')
plt.plot(t,y_implicit,color='red')
plt.plot(t,y_analytical,color='yellow')
plt.legend(['Explicit','Implicit','Analytical'])
plt.show()
results
when dt=total time/ constant is< value the solution becomes unstable
dt=1.2e-2
explicit diverged
for dt=1.1e-3
explicit trying to converge
for dt=1.9e-3
after 0.008 solution of explicit start to converge
for dt=1e-4
explicit converged
"numerical stability has to do with the behaviour ofof solution as time step dt is increased.Problem arrive if we increase the time step explicit blows up.since error is proportional to dt larger time steps causes larger error in explicit scheme.
Stabilty in engineering applications
depends upon schemes,mesh size ,relaxation facture,time step etc...depending on the field and application although through these engineering simulation we will be having errors but minimizing the errors is the biggest aim.If solution aren't bounded it diverges as will not be able to produce results.It is only through a stable output that we are able to obtain a solution for ODE.If the solution is unstable we can't do anything with the output.
Can stability condition be derived for all types of problems
Stability can only be derived for linear ODE systems.But for non linear and linear ODE's we can predict the stability this is done by jacobian matrix and computing all its eigen values.This comes handy for non-linear ODEs
If eigen values are negative the solution is stable
If any one element is positive the solution becomes unstable
Reference:
https://www.wolframalpha.com/input/?i=solve+dy%2Fdt%3D-1000y-exp%28-t%29+when+y%280%29%3D0
https://www.intechopen.com/books/dynamical-systems-analytical-and-computational-techniques/solution-of-differential-equations-with-applications-to-engineering-problems
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.