0

I am trying to solve 2nd order differential equation for a harmonic oscillator, $$ y''+2 \beta y'+ \omega^2 y =0, $$ using RK4 method in Fortran for different values of beta n omega, program is running but results are not correct. Someone please help. code:

!Runge-Kutta method to solve y''+2*beta*y'+omega**2*y=0, for different beta and omega
  • After correcting the typo and the duplication of attaching the step size factor, is there any problem left? In https://math.stackexchange.com/questions/4176684/how-to-implement-a-runge-kutta-method-rk4-for-a-second-order I have collected some links to various approaches for implementing RK4 for second-order equations. – Lutz Lehmann Apr 03 '22 at 13:57
  • @Lutz Lehmann After correcting the typo and step size issue, my code is working well and producing required results. Thanks – Danial Apr 09 '22 at 10:36

0 Answers0