RK4 Solver Issue: Shoot the Moon with C Program

  • Thread starter Thread starter Illuminati
  • Start date Start date
  • Tags Tags
    Rk4
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
Illuminati
Messages
5
Reaction score
0
Hey Folks,

So I've been making an 4th order Runge-Kutta program for finding a way to shoot the moon with a spacecraft . However for some reason the RK4 part of the program does not work and I cannot figure it out.

I've written it in C and attached the file. If someone who is more well versed in C could take a look at it and let me know what I'm screwing up I would be greatly appreciative.

Thanks!

Edit: I've attached a couple different methods to this post. If viewing try using shoot_the_moon3.c, it should have a working .plt file to output a .png of the data
 

Attachments

Last edited:
Physics news on Phys.org
I suppose I should add that the spacecraft is supposed to have some kind of circular orbit, instead it acts more like a massed spring

it might be an initial value problem