So I am trying to use runge kutta 4, to more acurately calculate forces. I am using code from github and I used their example of rabits and wolves populations. In IntegratorLSODE.cs, in lotkaVolterra(), that is where the customization happens, like the birth and death rate of each animal.
What I am confused about is the equations to calculate dR and dW.
I feel like I am doing this wrong, because I just set the force through another variable, and this ends up (I think) doing the same thing as in Euler's Method! I believe the problem is that I need to create an equation involving x and/or y. I have no idea how to do this.
Here's my code: (I changed it from the guy on github's)
Note: To compare code, got to the other guy's code on github.
Q: What can I do to accurately predict forces (runge kutta) without just using euler's method?
forceis an unchanging constant. // If you add a third state component, then it is always associated with the index 2. // All Runge-Heun-Kutta methods are expansions on the idea of the Euler method, there is no surprise that they have structural similarities. – Lutz Lehmann Aug 07 '22 at 06:21force.xetc. are just the fields/members/component of thevector3dobjectforce. I think this parameter was intended to be used as control or auxiliary input, it is never changed in the visible code. // The time loop is wrong or extremely inefficient, this is unchanged from the github code. – Lutz Lehmann Aug 07 '22 at 17:09