Added: 2 years ago
From: lefty8957
Views: 9,423
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (27)

Sign In or Sign Up now to post a comment!
  • Can you email me the code?

    My email is:

    GinDiamond15@yahoo.com

  • They "explode", because, finally, the balls meet almost adjacent to each other. That speeds them up so much, that they are going so fast that their speed overcomes the gravity, and they fly off.

  • Can you put up the code for this?

  • would make a nice screensaver

  • numerical rounding errors are inevitable, so even if everything seem to work properly, as time goes by, energy is not basicly conserved and various things can happen, the balls get too close that the force basically diverges and it "explodes", but nice job.

  • The red and orange balls get rather close. I'd say they pulled each other into such a sharp turn that the resulting momentum beat out their respective pull.

  • It was building a deathstar. :)

  • I believe what happened there is called a gravitational slingshot in which the velocity from one of the particles got transferred to the other since the gravitational force between them became so strong.

  • I've had a similar problem. It was because the attraction between the particles has a relation to the distance between them. If the distance gets shorter, the attraction becomes larger, and thus the acceleration and speed become greater. If the speed is high the distance per frame is also large. And that's when my particles flew out of the canvas. So something like acceleration = something/distance. If distance is near zero, the acceleration is near infinity. This was the cause of my prob.

  • how do you make them orbit?!

  • you can't expect everything in quantum physics to work the way you think intuitively.

  • @bobsonenzo WTF are you talking about? it's simple gravitational pull, no quantum mechanics and no nothing.

  • The reason why it speeds up is because and red balls pass very close to one another. To confirm this I suggest outputting the coordinates also.

    Another example of this effect is present in the bottom right (about 1:46 onwards) where the yellow and red balls orbit each other rapidly. (due to increased gravity and acceleration due to decreased distance)

  • I think I know what causes the problem.

    All the gravity simulators approximate the trajectories by calculating small 'steps'. When a particle gets very close to other particle, it gains enormous velocity, and traverses a significant distance away from the other particle during one 'step'. As a result, large distance makes the gravity insignificant, compared to particles' momentum.

    The solution: if two particles are close enough to each other, turn off the gravity between them for one 'step'.

  • How can we see the source code of this Python program?

  • One good thing to check if the simulation was right is controlling the position of the center of mass of the system.

    You have a closed system so the center of mass at every step of the simulation must move at the same velocity of the begginning, so if its velocity is 0 at the beginning its position will not change during the simulation otherwise there is a numerical error, maybe the time step is too wide.

  • (read my post below first)

    Basically, there's nothing wrong with the program from what I can see, except that it simply doesn't run fast enough to accurately calculate the high speed of the balls at that point. This effect is even more pronounced if 2 balls actually collide, or otherwise get very close. The program computes an extremely high force causing the balls to shoot past each other, but doesn't recalculate fast enough to catch the opposing force that occurs just afterwards.

  • When the orange ball speeds up, it's because it comes too close to another ball (the red one), and they "slingshot" off of each other, causing those 2 balls to fly away. This in some way unbalances the rest of the balls, causing them to also fly away.

  • @theoriginalimanalien yup i was bout to comment the same thing. like how we send probes out yonder, sling shotting them off planets.

  • Apparently, the ball had problems with getting back on sphere surface. Make sure that whenever the ball escapes, you put it EXACTLY on the right path. It looks like you check for some position condition and shift a bit if it's true. The ball will escape if the shift was not enough (too big velocity + too small dt).

  • @dawidlaszuk can you explain what the dt is to me? i'm still pretty new at vpython.

    thanks

  • @happymerc it's not about vpython. refering to _dt_ i meant time interval. In physics and mathematics usually _d_ stands for derivative, which is infinitely small increase. Also, and that's a RULE, in physics never check only if two variables are equal. Only lessEqual and moreEqual make sense. And if you really need to compare, do it like | newValue - comparingValue | <= eps, where eps is acceptable error (epsilon).

  • alright i guess my physics class isn't quite up to par, since i've never heard of it. i was in pre calc, dropped it, and then ended up trying to get back in, but wasn't allowed. but i have heard of derivatives. what do you mean by "which is infinitely small increase. you mean it's basically an asymptote? and where did the never check if only two variables are equal come from? sorry if i'm being an idiot, just trying to understand.

  • @happymerc well, not exactly asymptote that is. I'm sorry, but this is not the place to teach maths/physics. If you seriously want to simulate, basics of physics are essential ( well, I think they are, but on the other hand I'm a physicist myself, so i'm not reliable source on that ;P ). I assume, that you use some kind of if statement to set those ball on a sphere. because each number is represented by 32bit, than it means that there is a the smallest number. you are never sure if there

  • you are never sure if there wasn't any 'mistake' and the new value is what it should be. Also, if modeling physical events, remember that there's no such thing as strict low. Every law is more or less only approximation to what we observe. As an example see Newton's Law of Motion and Einstein's Special Relativity. For better understanding please see: machine epsilon, limes.

  • and the last, but most important thing: do not ever be afraid to ask, even if you think that it makes you look idiotic. it's essential to truly understand things. better talk less about things you know, than talk plenty and don't know what. but of course you do know that :) good luck :)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more