RK4 Solver Issue: Shoot the Moon with C Program

  • Thread starter Thread starter Illuminati
  • Start date Start date
  • Tags Tags
    Rk4
AI Thread Summary
A user is developing a 4th order Runge-Kutta program in C to simulate a spacecraft's trajectory to the moon but is encountering issues with the RK4 implementation. The user has shared the code file, specifically recommending the "shoot_the_moon3.c" version, which includes a .plt file for generating output data in .png format. The spacecraft is intended to follow a circular orbit but is instead exhibiting behavior akin to a massed spring. The user suspects that the problem may be related to an initial value issue and is seeking assistance from those more experienced in C programming to identify the errors in the code.
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:
Technology 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
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
22
Views
4K
Replies
8
Views
4K
Replies
8
Views
2K
Replies
4
Views
2K
Replies
13
Views
4K
Replies
17
Views
2K
Back
Top