Runge Kutta 4th Order Method - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Software Libraries ( /forum-10.html)+--- Forum: HP Prime Software Library ( /forum-15.html)+--- Thread: Runge Kutta 4th Order Method ( /thread-4026.html) |

Runge Kutta 4th Order Method - Eddie W. Shore - 05-30-2015 06:03 PM
The Runge Kutta 4th Order is a method for solving differential equations involving the form: dy/dx = f(x,y), where: x_n+1 = x_n + h y_n+1 = y_n + (k1 + 2*k2 + 2*k3 + k4)/6 Where: k1 = h * f(x_n, y_n) k2 = h * f(x_n + h/2, y_n + k1/2) k3 = h * f(x_n + h/2, y_n + k2/2) k4 = h * f(x_n + h, y_n + k3) Variables used: A = x_n B = y_n C = x_n+1 D = y_n+1 H = step K = k1 L = k2 M = k3 N = k4 Results are stored in lists L1 and L2. L1 represents the x coordinates, L2 represents the y coordinates. Both DIFFTBL and RK4 return the same output. The difference is that DIFFTBL uses an Input box and no-pass through arguments and RK4 uses five pass-through arguments. This way, RK4 could be used as a subroutine. Both return the results in a matrix, M1. DIFFTBL: Code: `EXPORT DIFFTBL()` RK4: Code: `EXPORT RK4(f,A,B,H,S)` RE: Runge Kutta 4th Order Method - Euler - 10-10-2015 12:32 AM
How do you use the RK4 program..not using it as a subroutine..so it gives the same output as DIFFTBL..what do you use for f? when running from the program menu for example...if you use 'X' (where dy/dx = X = f) it really doesn't return the correct values to the M1..humm..maybe it is written only for a subroutine..? thanks E RE: Runge Kutta 4th Order Method - Euler - 10-10-2015 02:41 PM
Ok, if you add a definition of f (the function you want) say f='X' in the RK4 code then I can run the RK4 to get the same and correct response as DFFTBL. E RE: Runge Kutta 4th Order Method - Grayhek - 09-17-2020 09:11 PM
This is awesome |