Hey guys,(adsbygoogle = window.adsbygoogle || []).push({});

Attempting to write an adaptive step size function into a 4th order runge kutta integrator for basic orbits.

The problems (so far) are as follows:

1.) The step size does not seem to change as one would expect if the recursive definition of the StepSize function was working properly

2.) When compared with the mathematica solution, it would seem the orbit doesn't extend as far as it should in time, ie the arc length is shorter. It would seem this is due to the coordinates remaining constant after a certain point.

Code can be found here:

http://members.iinet.net.au/~housewrk/programtest.cpp [Broken]

Apologies in advance for stupid errors and crappy coding :)

Cheers

-G

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Adaptive step size algorithm in c++ for runge kutta

**Physics Forums | Science Articles, Homework Help, Discussion**