Numerical calculation of variable coefficient second-order linear homogeneous differential equation by Euler method

Introduction

\frac{d^2v}{dt^2}+\frac{P}{EI(t)}v=0

$ P and E $ are appropriate variables, and $ I (t) $ is a step function in which $ I (t) $ increases by 1.0 as $ t $ increases by 1.0.

The exact solution is

Since this is a second-order linear homogeneous differential equation of variable coefficients, there is no general solution. Therefore, substitute $ v = t ^ m $ or $ v = e ^ {mt} $ as a special solution into the equation. Check if the constant m is determined so that it becomes a solution. Try it with Mathematica

You will get the basic solution to enter.

Euler approximation

public static void main(String[] args) {
		double v0=3.0,z0=4.0,h=0.1;//initial value
		int n=10;
		double v,z,z1;//variable
		double p= 2.0;//variable
		double e= 3.0;//variable
		double ix= 1.0;//Step function I(x)Initial value of
		System.out.println(v0);//Initial value output of v
		v = v0 +z0*h;//v1 calculation
		z = z0 - (p/e*ix)*v*h;//z1 calculation
		System.out.println(v);//v1 output
		for(int i=0;i<n;i++){
			v = v + z*h;//Calculate from v2 to v12
				z1 = z - ((p/e)*ix)*v*h;
				z = z1;
				ix++;
			System.out.println(v);//v output
		}
	}

Will result in the following: vpei_01.png

References

[1] Mitsuida Atsuro, Suda Space: Numerical Calculation Method [Second Edition], Morikita Publishing Co., Ltd., 2017 [2] Takeshi Inaoka: Differential Equations from the Basics, Morikita Publishing Co., Ltd., 2018

Recommended Posts

Numerical calculation of variable coefficient second-order linear homogeneous differential equation by Euler method
Accuracy of pi calculation by Monte Carlo method