Where Should I Include Particle Mass in My Hamiltonian CR3BP Code?

  • MATLAB
  • Thread starter Deadstar
  • Start date
  • Tags
    Body Matlab
In summary: Kutta... or any other symplectic integrator?In summary, the author is trying to code the Hamiltonian form of the circular restricted three body problem, but is having trouble getting it to work. He has managed to code the non-Hamiltonian form and has run into trouble here. He is using the synodic coordinate system and has found the Hamiltonian form to be H = \frac{1}{2}(p_x^2 + p_y^2) - xp_y + yp_x - \Omega. However, he is confused about how to deal with the particles momentum and this is the code he wrote: function xdot = symCR3BP(t,x,mu
  • #1
Deadstar
104
0
Hey folks I'm trying to code the Hamiltonian form of the circular restricted three body problem and would like a bit of help here. I've managed to code the non-Hamiltonian form and have gotten it to work fine but came run into trouble here.

I'm using the synodic coordinate system as described here http://en.wikipedia.org/wiki/Jacobi_integral#Synodic_system and have found the Hamiltonian form of the system to be...

[tex]H = \frac{1}{2}(p_x^2 + p_y^2) - xp_y + yp_x - \Omega[/tex]

where p is the particles momentum and [tex]\Omega = \frac{1-mu}{r_1} + \frac{\mu}{r_2}[/tex] . Note that I'm not involving the z-component yet until I get the basics sorted out.

Now this can be written as the following set of first order differential equations...

[tex]\dot{x} = p_x + y[/tex]
[tex]\dot{p_x} = p_y - \frac{\partial \Omega}{\partial x}[/tex]
[tex]\dot{y} = p_y - x[/tex]
[tex]\dot{p_y} = -p_x - \frac{\partial \Omega}{\partial y}[/tex]

(I prefer to write it like this, keeping x parts together and so on rather than keeping position parts together etc...)

Now this is where I get a bit stuck as I'm a bit confused about how to deal the the particles momentum. This is the code I wrote for the function...

function xdot = symCR3BP(t,x,mu)
xdot = zeros(4,1);
xdot(1) = x(2) + x(3);
xdot(2) = x(4) - (1-mu)*(x(1) + mu)/(((x(1) + mu)^2 + x(3)^2)^1.5) - mu*(x(1)-1+mu)/(((x(1) - (1 - mu))^2 + x(3)^2)^1.5);
xdot(3) = x(4) - x(1);
xdot(4) = -x(2) - (1-mu)*x(3)/(((x(1) + mu)^2 + x(3)^2)^1.5) - mu*x(3)/(((x(1) - (1 - mu))^2 + x(3)^2)^1.5);
end


Now notice I have never defined the particles mass and I'm not quite sure where to put it! An integration of this with a symplectic integrator just produces rubbish and any attempt to include mass in this yields momentums that are so small that they don't contribute to anything.

So where do I put the particles mass? I have tried to include it initial conditions but that did not work either. My usual test for integrators and this problem is to start near the L4 or L5 points and doing that with the above quickly sends the particle shooting out in an ever growing spiral which does not follow my other results. (my initial condition in the rotating frame is [0.5;0;0.9;0] which produces some form of horseshoe/tadpole type orbit for the standard 3 body problem function using any of my integrators.)

If anyones needs any more information just ask.
Thanks.
 
Physics news on Phys.org
  • #2
I studied this a while back, but my code wasn't anything like this so I don't know how much help I can be.

The first thing I wonder is why you're even using momentum? In the circular restricted 3 body problem, the mass of the 3rd body is negligible, so it doesn't affect the paths of the massive bodies. Whatever its mass actually is doesn't matter because as long as the inertial mass = the gravitational mass, the acceleration of the body is the same.

I don't see any reference to momentum in your link so it confuses me. What is your overall objective? TO demonstrate the existence of stationary solutions? Or the stability of these solutions? This is all possible analytically. If you want to make simulations of unstable orbits you can just use some basic (or complex) predictions, eg. new_position = old_position + speed*timestep + 0.5*acceleration*timestep^2, or something like that (I've forgotten the details). A suitably complex version of this code will produce thousands of orbits before there is any observable divergence.
 
  • #3
Hey thanks for the reply sorry for the delay in replying back!

My goal was to create a symplectic integrator in Matlab which I have done. It has worked fine with every other function I have used.

Then I turned my attentions to the three body problem and wondered if I could do a symplectic integration of that. Now perhaps I just plainly don't understand something but I'm under the impression that I should convert the 3BP into a set of Hamiltonian equations (shown in first post). Then I can use them in my symplectic integrator such that my particles trajectory conserves the Jacobi constant.

I have been reading though that because of the coordinate system... The Hamiltonian of the 3BP does not conserve energy so perhaps this is all fruitless...


I have already coded the 3BP in the usual sense and have gotten it to work in that it produces the expected particle trajectories (horseshoe orbits, orbits around L4/5 etc...) however the Jacobi constant always ends up increasing and the particle starts shooting of to infinity after some time.

My goal is...
Perform a symplectic integration of the circular restricted three body problem such that this does not happen (or at least not within large integration limits).

My problems are...
How to involve momentum.
Can it be done using an implicit Runge Kutta.
 
  • #4
I'm not surprised it flies off. Some orbits will really appear stable then after a while, fly off. Eg. how did the Trojan asteroids get there in the first place? Many probably were passing by and became caught in that orbit by the immense gravity of Jupiter/sun. If this can happen in dynamics, the time-reversal is also possible - orbits spending a long time at L4/5 and then flying off.

The alternative might be because of the chaotic nature of the system- it is unpredictable, though still deterministic, so your calculation will always diverge to some degree. My simulations never perfectly conserved energy either.I don't know how I can help with symplectic integrators, I never studied them, so that might explain it, but I can't understand why you're trying to involve momentum. The 3rd body has effectively zero mass, so it sounds like you are trying to force a particular solution (using Hamiltonians for problems involving momentum) on a certain problem. In fact this is explicitly stated in your goal: "solve X using Y". To me at least, I cannot see how Y will help you solve X.
 
  • #5


Hi there, it seems like you have a good understanding of the Hamiltonian form of the circular restricted three body problem and have already made good progress with your code. However, I can see where you are getting stuck with incorporating the particle's mass into the equations.

Firstly, it's important to note that the Hamiltonian form of the problem does not explicitly include the mass of the particles. This is because the Hamiltonian is a function of position and momentum, not mass. However, the mass does indirectly affect the equations through the gravitational potential term \Omega, which you have correctly included in your equations.

In order to incorporate the mass into your code, you will need to define the mass of the particles before running the simulation. This can be done by assigning a value to the variable 'mu' in your function, or by defining it as a global variable. Then, you can use this value in your equations for \Omega, as you have already done.

It's also important to make sure that the units of mass are consistent with the units of distance and time that you are using in your simulation. This can affect the magnitude of the momentums and therefore the behavior of the system.

Additionally, I would suggest checking your initial conditions and making sure they are consistent with the Hamiltonian form of the problem. Starting near the L4 or L5 points should produce a horseshoe or tadpole orbit, as you mentioned. If you are not seeing this behavior, there may be an error in your initial conditions or in your code.

I hope this helps and good luck with your project!
 

Related to Where Should I Include Particle Mass in My Hamiltonian CR3BP Code?

1. What is the three body problem in Matlab?

The three body problem in Matlab refers to a mathematical model that describes the motion of three objects interacting with each other through gravitational forces. This problem is notoriously difficult to solve and has been a subject of study for many mathematicians and scientists.

2. How does Matlab solve the three body problem?

Matlab uses numerical methods to solve the three body problem. These methods involve breaking down the problem into smaller, more manageable parts and using algorithms to calculate the positions and velocities of the three bodies at different points in time. The accuracy of the solution depends on the specific method used and the precision of the input data.

3. What are the applications of solving the three body problem in Matlab?

Solving the three body problem in Matlab has many practical applications, such as predicting the movement of celestial bodies in the solar system, understanding the dynamics of satellites and spacecraft, and studying the orbits of binary star systems. It can also be used to model complex systems in physics, engineering, and other fields.

4. What challenges are involved in solving the three body problem in Matlab?

The three body problem is notoriously difficult to solve because it involves solving a set of highly nonlinear differential equations. This means that even small changes in initial conditions or parameters can lead to significantly different solutions. Additionally, the problem becomes more complex when more than three bodies are involved, making it even harder to find a precise solution.

5. Can Matlab handle the three body problem with more than three bodies?

Yes, Matlab can handle the three body problem with more than three bodies, but it becomes increasingly challenging as the number of bodies increases. This is because the computational complexity and time required to solve the problem also increase. Therefore, it is important to carefully consider the limitations and assumptions of the model when using Matlab to solve the problem with multiple bodies.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Atomic and Condensed Matter
Replies
7
Views
337
  • Advanced Physics Homework Help
Replies
1
Views
1K
  • Quantum Physics
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
12
Views
2K
  • Beyond the Standard Models
Replies
1
Views
1K
Replies
3
Views
259
  • Advanced Physics Homework Help
Replies
9
Views
1K
  • Classical Physics
Replies
0
Views
495
Back
Top