Posted: Fri Oct 15, 2004 3:39 pm Post subject: Solar System Simulation
I've recently been thinking about making a solar system simulation, using Newtonian physics. Could anyone perhaps give me a quick rundown of what I'll need to know (in terms of the physics, not the coding )
Sponsor Sponsor
josh
Posted: Fri Oct 15, 2004 3:51 pm Post subject: (No subject)
by simulation do you mean a mathematical one or a 2D or a 3D one???
that is a sick idea by the way
Cervantes
Posted: Fri Oct 15, 2004 3:58 pm Post subject: (No subject)
2D, using math.
Just the basics, at first.
josh
Posted: Fri Oct 15, 2004 4:12 pm Post subject: (No subject)
I might have some books that mention it, I will try and find some info
Martin
Posted: Sat Oct 16, 2004 2:15 am Post subject: (No subject)
Newton's equations are wrong.
Cervantes
Posted: Sat Oct 16, 2004 6:30 am Post subject: (No subject)
I know, but I still want to use them.
Using Newton's equations, don't we end up with circular orbits? And with the General Theory of Relativity, we end up with elliptical oribts?
Andy
Posted: Sat Oct 16, 2004 1:41 pm Post subject: (No subject)
just use centripetal acceleration formulas... where MAc=Fg... with Ac=V^2/r or Ac=4pi^2rf^2
Martin
Posted: Sun Oct 17, 2004 1:29 am Post subject: (No subject)
Yeah, ignore friction (it's physics, real world forces don't apply), and just give them an initial velocity perpindicular to the object they're to be orbitting, and it should work. Remember, planets pull on each other
And for god's sake, make it OO.
Sponsor Sponsor
Cervantes
Posted: Mon Oct 25, 2004 6:37 pm Post subject: (No subject)
dodge_tomahawk wrote:
just use centripetal acceleration formulas... where MAc=Fg... with Ac=V^2/r or Ac=4pi^2rf^2
would you mind explaining that a little more please?
Martin wrote:
Remember, planets pull on each other "wink:
Oh god, I know! I plan on making an initialization section of the program where you can edit the mass of the planets (along with various other things), in which case some funky things could happen.. perhaps with the right mass, the solar system will orbit earth!
Tony showed me a way of creating a gravity field a while back, and it worked well enough for its purpose at that time, but what would it do in a solar system simulation?
code:
View.Set ("graphics:600;600,nobuttonbar")
var ball :
record
x, y, dx, dy, GFdist, GFxdist, GFydist, GFangle, GFforce : real
end record
function MathDistance (x1, y1, x2, y2 : real) : real
result (((x2 - x1) ** 2) + ((y2 - y1) ** 2)) ** 0.5
end MathDistance
setscreen ("offscreenonly")
loop
cls
ball.x += ball.dx
ball.y += ball.dy
if ball.x > maxx - ballradius or ball.x < ballradius then
ball.dx := -ball.dx
ball.x += (2 * ball.dx) %move it 2 steps ahead to help prevent sticking
end if
if ball.y > maxy - ballradius or ball.y < ballradius then
ball.dy := -ball.dy
ball.y += (2 * ball.dy) %move it 2 steps ahead to help prevent sticking
end if
%%%%%%%%%GRAVITY FIELD EFFECTS%%%%%%
ball.GFdist := MathDistance (gravityfield.x, gravityfield.y, ball.x, ball.y)
ball.GFforce := gravityfield.strength * (1 / (ball.GFdist * ball.GFdist))
if ball.x not= gravityfield.x then
ball.GFxdist := gravityfield.x - ball.x
ball.GFydist := gravityfield.y - ball.y
ball.GFangle := arctand (ball.GFxdist / ball.GFydist)
else
if ball.y > gravityfield.y then
ball.GFangle := 90
else
ball.GFangle := 270
end if
end if
if ball.x < gravityfield.x then
ball.GFangle := ball.GFangle + 180
end if
ball.dx -= ball.GFforce * cosd (ball.GFangle)
ball.dy -= ball.GFforce * sind (ball.GFangle)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if ball.dx > highestspeed then
ball.dx := highestspeed
elsif ball.dx < -highestspeed then
ball.dx := -highestspeed
end if
if ball.dy > highestspeed then
ball.dy := highestspeed
elsif ball.dy < -highestspeed then
ball.dy := -highestspeed
end if
See how the ball goes right, then left, then back? Gravity shouldn't do that! or should it? One of those good ol' fashioned "Educational Films" showed that our solar system is not revolving around the centre of the galaxy in a 2D plane, it is revolving around it and going up and down as well. Picture the Milky Way as a disc, totally flat (close enough..) then the sun and our solar system would be, at one point, below that disc, and then, as time passes, it moves up, passing through the disc, continues upwards, reaches its peak, and then comes back down. Kinda like a sine wave.
Why, oh, why, is that?
Tony
Posted: Mon Oct 25, 2004 6:48 pm Post subject: (No subject)
well you need to give the ball a little push at first to make it spin around the center...
code:
ball.dx := 1.75
ball.dy := 0
gravityfield.strength := 200
that works out much nicer though the code is still not perfect, as you can tell yourself from the resulting animation... Though it was enough back in the day
Posted: Mon Oct 25, 2004 6:51 pm Post subject: (No subject)
Oh, I know, in order to get the orbit it would need that push. But, what I was trying to show, is that, without the push, you'd think it would go straight towards the gravity field, but in fact it wavers back and forth on its way there.
Catalyst
Posted: Mon Oct 25, 2004 7:42 pm Post subject: (No subject)
Posted: Mon Oct 25, 2004 10:20 pm Post subject: (No subject)
Orbits as I understand them are the result of a warping of spacetime due to a large mass present. Since there isn't friction to slow an object down, and given an initial velocity, the object just follows the simplest path, in an orbit. And wasn't there the gravitational force formula, y'know with the mass, distance and the universal gravitational constant.
It doesn't sound easy though, but you like math
and if you look at catalysts program wouldn't the direction and magnitude of the force being exerted on the moving circles have to be somehow balanced with the circle's initial velocity to have an orbit?
Cervantes
Posted: Tue Oct 26, 2004 5:53 pm Post subject: (No subject)
What is the universal gravitational constant?
And, catalyst, is what you posted this only open source instead of .exe? My winRAR hates me, and gives me annoying error messages whenever I try to extract something. Could you, or anyone willing, perhaps send it to me as a winzip?
I don't want to get offtopic here, but does anyone know where to get a free full version of winRAR (not a trail version)?
Andy
Posted: Tue Oct 26, 2004 6:17 pm Post subject: (No subject)
6.67300 × 10-11 m3 kg-1 s-2 kepler discovered that