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
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...

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