Challenge

Week 5.2 - Literature review: ODE Stability

The term “Ordinary Differential Equations” also known as ODE is an equation that contains only one independent variable and one or more of its derivatives with respect to the variable. In other words, the ODE is represented as the relation having one independent variable x, the real dependent variable y, with some of its derivatives.

it can be written as-

`f(y)= dy/dt = -1000y - 1000*e^(-t)`

The above ODE can be solved by using the analytical method, explicit and implicit methods.

  • When does an ODE become unstable?

For testing the stability of the given ODE, it is solved using various methods available and compared with the analytical value.

The explicit solution can be written as: `Y^(n+1)=Y^n+f(t(n),Y(n))**Deltat`

The implicit solution can be written as: `Y^(n+1)=Y^n+f(t(n),Y(n+1))**Deltat`

Applying both of the schemes written above in the python code along with solving the equation analytically as below:

import matplotlib.pyplot as plt
import numpy as np

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(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 = 1.1e-4

t,y_explicit = explicit_euler(total_t,dt)
t,y_implicit= implicit_euler(total_t,dt)
y_analytical = analytical(total_t,dt)
plt.plot(t,y_explicit)
plt.plot(t,y_implicit)
plt.plot(t,y_analytical)
plt.legend(['Explicit','Implicit','Analytical'])
plt.show()

The variation of the results by varying the dt value can be seen as below:

1. For dt = 1.1e-4,

for dt=1e-3

for dt = 1.1e-3

for dt = 1e-2

From the above analysis it can be observed that up to 1e-3 both the methods explicit and implicit are giving a near accurate result but as the value is increased further the explicit answer seems to be blown out. Also it should be noted that in all cases implicit result is working good and it should be folowed.

  • How does stability affect engineering simulations?

For calculating a converged result or getting a stable result after solving for a large number of iterations it is expected to get a similar answer if the calculation is proceeded further but due to unstable method and values this target is not achieved. such unstable solutions are not helpful for the engineering simulations.If the solution reaches equilibrium state after certain oscillations that can be accepted to say that solution is acceptable.

  • Can stability condition be derived for all types of problems?

Preferably stability can be derived for linear ODE systems as there is more control of time step in linear system. For calculating stability of Non-linear ODE jacobian matrix act as a basic criterion for calculating the stability of these system. Eigen values of Jacobian matrix points out to the stability of Non linear ODE if it is positive and unstable if converse is true.

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.