CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: ordelore on April 13, 2017, 12:15:58 AM

Title: Gravity Simulator [TI-84+CE]
Post by: ordelore on April 13, 2017, 12:15:58 AM
I made a gravity simulator during physics.
The directions should be self-explanatory. The arrow keys are used to adjust the object's mass and velocity.
I'll work on speed optimization later.
Requires OS 5.2.1 or greater because I use toString().
GIF included
Title: Re: Gravity Simulator
Post by: _iPhoenix_ on April 13, 2017, 12:28:15 AM
Dang it!

I was going to do something just like this, but you did it much better than I could have.
Well done, and it is a very nice program.
Title: Re: Gravity Simulator [TI-84+CE]
Post by: Alvajoy123 on April 13, 2017, 02:35:13 PM
Looks good  :thumbsup:
Title: Re: Gravity Simulator [TI-84+CE]
Post by: p2 on May 09, 2017, 10:48:52 PM
impressive.
Could u add text with the vector data and the formulas around the lines?
Then u could actually use it in a productive way during class :)

(maybe add a tiny explosion gif in the point where they meet? :D

and btw what happens if u do parallel lines?
Title: Re: Gravity Simulator [TI-84+CE]
Post by: Snektron on May 09, 2017, 11:04:04 PM
Reminds me of the stuff i did during school. My calculator would often get confiscated by my physics teacher, which resulted in me talking with other students instead of minding my own calculator business. Not a smart move on her part ;D
Title: Re: Gravity Simulator [TI-84+CE]
Post by: p2 on May 09, 2017, 11:42:53 PM
this was sooo much the same for me x.x
Title: Re: Gravity Simulator
Post by: ordelore on May 10, 2017, 12:11:38 AM
Quote from: p2 on May 09, 2017, 10:48:52 PM
and btw what happens if u do parallel lines?
Because both starting positions are fixed, there is no way to have parallel lines. Also, because gravity is universal, any object travelling in parallel lines won't be doing so for long.
I initially had vector data, but the speed slowdown didn't seem worth it to me.
Title: Re: Gravity Simulator [TI-84+CE]
Post by: c4ooo on May 10, 2017, 01:18:31 AM
Quote from: p2 on May 09, 2017, 10:48:52 PM
impressive.
Could u add text with the vector data and the formulas around the lines?
Then u could actually use it in a productive way during class :)

(maybe add a tiny explosion gif in the point where they meet? :D

and btw what happens if u do parallel lines?
A=F/M
Fg = M1*M2/R^2

thus

A =  (M1*M2/R^2/)/ M

Each frame: calculate A for each object, add A to velocity of the object, then add velocity to the position. The more smaller the delta time, the more accurate the simulation is. (The reason the two object shoot off so fast in the gif is becouse the distance between them becomes very close to zero, thus making A approach infinity)

If you want to moddel an object and a fixed ("on rails") planet, which is a more often occurring scenario, A =  (M1*M2/R^2/)/ M can be simplified to  A =  Mass Of Planet/R^2