How can I apply 4th order Runge Kutta to a function that requires multiple inputs (instead of $\dot x = f(x, t)$, something like $\dot x = f(a, b, c, d, t)$). For $\dot x = f(x, t)$, the Runge Kutta system is as follows:
$x_{n+1} = x_n + \frac{h}{6}(f_1 + 2f_2 + 2f_3 + f4)$
where:
- $f_1 = f(x_n, t_n)$
- $f_2 = f(x_n + \frac{h}{2}f_2, t_n, \frac{h}{2}$
- $f_3 = f(x_n + \frac{h}{2}f_2, t_n + \frac{h}{2}$
- $f_4 = f(x_n + hf_3, t_n + h)$
This only works if the function only accepts two inputs, the state and timestep. Sorry if this is a simple question, but if you could direct me to any sources or answers, it would be greatly appreciated.
For context: I'm trying to simulate a double pendulum. The equations of motion for the double pendulum describe acceleration in terms of some constants, angles, and angular velocities (the four inputs for the state are the first angle, the second angle, the first angular velocity, the second angular velocity).