Jump to content

Numerical integration of 3 variables

Featured Replies

I have 3 variables: v, b and h.
I know how to calculate v’, b’ and h’.
Starting the simulation from an initial condition, I need to calculate v, b and h after a given time using a numerical integrator (say RK4).

If I use the simple Euler method, I write;
v= v + dt * v’
b= b + dt * b’
h= h + dt * h’

but when I switch to RK4, I don’t know what to write.

The simulation is explained here:
https://mintoc.de/index.php?title=Gravity_Turn_Maneuver

For example, h’= v * cos(b) doesn’t seem a differential equation; does it mean that h= h + dt * h’ is correct and that there is no reason to use RK4?

Also, the second RK4 step is:
k2 = f(x + dx / 2, y + k1 / 2)
and we have that m’ = constant, v’= f(v, m).
When I write the above k2 f(x, y) function, I suppose that I need to consider also m at time x + dx / 2, not only v, in other words f(x, y) is:
m = m_initial – m’ * x
v’ = f(m, v)
and not only v’ = f(v).

 To do a "Runge- Kutta" solver with more than function, do simultaneous R-K solvers on each function, at each step using all the function values that you have determined at h/2 and h.

  • Author

Ah! Ok. The same that I do for the n-body simulation. Now it's clear.

Thank you very much.

  • Author
On 26/8/2017 at 2:27 PM, HallsofIvy said:

 To do a "Runge- Kutta" solver with more than function, do simultaneous R-K solvers on each function, at each step using all the function values that you have determined at h/2 and h.

I still have a little doubt.

We have:

v0 = v

v' = f(t, v), v= RK(v')

b' = f(v, b)

When I wrote RK for b', should I first calculate the new v and use this new v as the input for b' or should I use v0, the v before the update v= RK(v')?

  • 2 weeks later...

 Depending on the functions, one way might converge faster than the other but, assuming they converge, they will converge to the same result.

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.