Skip to main content
17 events
when toggle format what by license comment
Nov 22, 2022 at 17:17 history edited Lutz Lehmann CC BY-SA 4.0
expand some error discussion to delete comment
Nov 22, 2022 at 10:43 comment added jack23456 No. I’ve corrected it
Nov 22, 2022 at 10:28 comment added Lutz Lehmann In stage 1, do you still have xA, vA everywhere?
Nov 22, 2022 at 10:02 comment added jack23456 I uploaded in the original question an image that should clarify what I mean
Nov 22, 2022 at 9:20 history edited Lutz Lehmann CC BY-SA 4.0
add a zoom-in
Nov 22, 2022 at 9:17 comment added Lutz Lehmann I'm not sure I understood the last comment. The graph is extremely condensed. For instance just plotting the segment from 7.5 to 8.5 shows the Verlet energy having the shape of an upturned "mexican hat" (like the second derivative of the Gaussian bell curve) while RK4 has a slight ramp up and then gently falling down to the next level.
Nov 22, 2022 at 9:02 comment added jack23456 ok thanks. In any case I spoke too early because looking at the energy of rk4, I see that there is some problems. In particular the general trend is to stay constant not as in your picture), and at each orbit there is a peak and a valley. The problem is that there are more than one step in which that happen, that is that the energy is high for a certain number of steps and than low for a certain number of steps, not only for one value as it is in your velar implementation
Nov 22, 2022 at 8:40 comment added Lutz Lehmann Your "Euler" is the symplectic Euler method. The time loop is the same as for leapfrog Verlet, the difference is the initialization and interpretation. It is correct, as you can update the velocities in the first loop as the updated positions are stored externally, they do not contribute to the acceleration. The position updates could also be completely done in the second loop, there would then be no need for the x_A,… variables. // I do not see any "Verlet" code in the provided sources. My comment about the error in Verlet was indirect, the spikes in the energy are just 200 times too large.
Nov 22, 2022 at 8:22 comment added jack23456 ok thanks a lot. Now the RK4 methods seems to work well. You told that also for Verlet there was an error of the same kind but I don't understand where. thanks
Nov 21, 2022 at 22:06 comment added jack23456 @helloworld922, thank for your answers, I think I have understood the problem. I have edited the original answer, adding the code that you told me was wrong. Sorry if it is not a "clean" code. Was this the problem I was making? I plotted also the trajectories and now the collapse in the middle of the two ellipses.
Nov 21, 2022 at 18:15 history edited Lutz Lehmann CC BY-SA 4.0
Some reorganization, reaction to comments
Nov 21, 2022 at 17:29 comment added helloworld922 I updated my answer so hopefully it's more clear what Lutz is getting at. Let me know if that makes sense.
Nov 21, 2022 at 17:02 comment added jack23456 @helloworld922 I think we are doing the following thing: At first step we compute the three components for body A, then B then C. Only at the end we update the positions. So in the next stage we use the updated positions. right? So I don't understand yourr point
Nov 21, 2022 at 16:52 comment added helloworld922 @jack23456 under your RK4 section you've unrolled the loop for the stages, so you handle all of body A first, then body B, then body C, but instead you must do all of stage 1 first, then all of stage 2, etc. The reason this doesn't work is because when you start to compute the forces for body A on stage 2 you're still using the positions of the other bodies before stage 1 has been computed, instead of after.
Nov 21, 2022 at 16:45 comment added jack23456 Thanks for your answer. I completely agree with you with this passage: 'The loop order in the method step is always "outer loop - stages, inner loop - components" not "outer - components, inner - stages". ' but I don't understand where, in the code I have posted, I did that
Nov 21, 2022 at 16:15 history edited Lutz Lehmann CC BY-SA 4.0
added 15 characters in body
Nov 21, 2022 at 16:09 history answered Lutz Lehmann CC BY-SA 4.0