$ 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.
Since this is a second-order linear homogeneous differential equation of variable coefficients, there is no general solution. Therefore, substitute
You will get the basic solution to enter.
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:
[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