Computer Science Canada

Gravity

Author:  Catalyst [ Fri Jan 23, 2004 10:58 pm ]
Post subject:  Gravity

I was bored in comp sci. so i made this

Author:  sport [ Fri Jan 23, 2004 11:03 pm ]
Post subject: 

Great program for being bored. Is it random or does it actually have a scientific way to it?

Author:  Catalyst [ Fri Jan 23, 2004 11:05 pm ]
Post subject: 

uses Newton's
gravitational attraction formula and some vector math
Fg=(m1*m2*G)/(d^2)

Author:  AsianSensation [ Fri Jan 23, 2004 11:07 pm ]
Post subject: 

nice physics stuff, did you do this during your compsci class? Laughing it seems that's when you seem to be bored most of the time.

Author:  Catalyst [ Fri Jan 23, 2004 11:11 pm ]
Post subject: 

a lesson on selection (5 months in to ICS3M(full year))
i think you get the idea

Author:  Homer_simpson [ Sat Jan 24, 2004 12:48 am ]
Post subject: 

pretty nice +bits

Author:  shorthair [ Sat Jan 24, 2004 12:56 am ]
Post subject: 

I watched for 15 mins and they dont seem to be going into the center, they stay on there path ,is it becasue its based on a real algorithm

Author:  Tony [ Sat Jan 24, 2004 1:27 am ]
Post subject: 

wow catalyst - if I was your CS teacher I'd made sure you're ALWAYS bored in my class Laughing

shorthair - they damn better stay on the path, else Earth will fly right into the sun, and as far as I know, that ain't cool... that's in fact very HOT Twisted Evil

Author:  Cervantes [ Sat Jan 31, 2004 10:18 am ]
Post subject: 

wow that's a really good program!

but seriously shorthair, 15 minutes?! crazy..

anyone know off the top of their head if that's the same formula used in the example programs that deal with gravity?

Author:  shorthair [ Sat Jan 31, 2004 10:23 am ]
Post subject: 

when i made one , i used potential energy , and kinetic energy formulas , and obviously your good ol , s = d / t, d = s * t , t = d/s ,.............. i had alot more than one formula

Author:  Cervantes [ Sat Jan 31, 2004 10:29 am ]
Post subject: 

wanna post it? Smile

Author:  shorthair [ Sat Jan 31, 2004 10:41 am ]
Post subject: 

Its not turing , as its dense with graphics ( uses direct X , 0 made with Blitz 3d , you should bee able to understand the code , il ost it if your still intersted in it ,
Here is a tutorial ( i have written yes i actually wrote it ) concerning hte gravitational equations , you will need for orbit , and force attraction
===============================================
code:

The force of attraction, F, between two bodies of mass m1 and m2 is

F = Gm1m2
     ----------
     R squared

 m1 and m2 = the mass of both the ojects

 R = distance between the two bodies

 G = the universal gravitational constant = 6.67 x 10-11 N m2 kg-2


===============================================
code:


Gravitational acceleration, g, of an arbitrary body  :

g=G Me
    ------
    R squared

Me = Mass of the Earth 

R   = distance from the Earth's centre.

code:


Gravitational acceleration on the Earth's surface (assuming it is spherical mass) :

g=G Me
    ------
    Re squared

Re =radius of the Earth.

g = 9.81 m/s/s


===============================================
code:

The corresponding potential, U, is :
U = -6.25 x 107 m2 s-2

Author:  Cervantes [ Sat Jan 31, 2004 10:54 am ]
Post subject: 

interesting, how'd you learn to do this??
I am interested in seeing this program, if you would be so kind as to post it Smile

I think in gr 12 (thats the old gr 12, back when there was OAC / gr 13) my brother made a program (not sure what in) that showed the solar system in its orbit. It also allowed you to change values such as mass for the planets, distance from the sun, etc. I'd like to learn to make a program like that, but I'm not there yet.. Sad someday..

Author:  McKenzie [ Sat Jan 31, 2004 11:10 am ]
Post subject: 

You didn't move from Ajax by chance did you? A few years back when I was teaching in Ajax I had a student make what sounds like the exact same program.

Author:  Cervantes [ Sat Jan 31, 2004 12:40 pm ]
Post subject: 

me? no. been in Newmarket (well, near there) almost all my life. moved when I was two Razz

Author:  shorthair [ Sat Jan 31, 2004 12:42 pm ]
Post subject: 

i lerned all that from grade 11 physics , ( rockin course by the way ) , you learn all that and more

Author:  Cervantes [ Sat Jan 31, 2004 12:46 pm ]
Post subject: 

sweet, I can't wait to take that course. Hope I get it first semester along with compsci next year. Very Happy

Author:  Paul [ Sat Jan 31, 2004 12:51 pm ]
Post subject: 

This reminds me of a black hole, except its not black, you know with the event horizon and stuff. A great extension to this program would be to have random rays of light passing, and those that come to the event horizon, would get sucked in. (I of course have no idea how to do it)

Author:  shorthair [ Sat Jan 31, 2004 12:57 pm ]
Post subject: 

basic formulas of light , justneed to know that light always travels in straight lines , we know light travels at , 3.0 x 10 to the 8 m/s , so just give me a dirrection ditsance and a time , and its there right in fromnt of you , also you can use light ray diagrams to find the position of the light

Author:  Cervantes [ Sat Jan 31, 2004 1:08 pm ]
Post subject: 

black holes aren't black necessarily black paulbian Razz there is no light to reflect off the black hole to show us what colour the black hole is.

a black hole could be pink Razz

shorthair, "light always travels in straight lines" you said. except when near a black hole right? or am I hugely mistaken Confused

Author:  Paul [ Sat Jan 31, 2004 1:10 pm ]
Post subject: 

Ah, but if you do a simulation of a black hole, the center should be black, maybe the surroundings should have colors, cause there's light and other cosmic rays thats pulled in a crazy swirl but not inside the event horizon.

Author:  Cervantes [ Sat Jan 31, 2004 1:12 pm ]
Post subject: 

if its not pulled inside the event horizon then how would it be reflected off the black hole to show us the black hole's colour?

Author:  shorthair [ Sat Jan 31, 2004 1:14 pm ]
Post subject: 

nothing reflects off a black hole , it apparently sucks up all light , so we could never actually see one , because there would e no light that reflects off it , we cant recodt it becuase the lense relys on light coming back into it , also why is there a need for a black hole , i can make an event horizon , and a darn good reflecton engine based on a rotating side view of hte planets

Author:  Catalyst [ Sat Jan 31, 2004 1:31 pm ]
Post subject: 

some radiation comes out of a black hole
its called hawking radiation

Author:  shorthair [ Sat Jan 31, 2004 1:45 pm ]
Post subject: 

Never Heard about that , care to explain , before i go deep into a google search

Author:  Catalyst [ Sat Jan 31, 2004 1:53 pm ]
Post subject: 

its a bit complicated
but in a nutshell

according to quantum theory there are pairs of virtual particles (one normal one antimatter) randomly appearing and disappering in "empty space" all the time
stephen hawking proved that if this happens near the event horizon of a black hole, one of the particles may fall in and the
other would would escape the black hole via energy from the mass of the black hole itself
this is the "hawking radiation"
(it solved the confilict of black holes with the second law of thermodynamics)
this radiation implies that black holes will eventually evaporate away

(there is a lot of math and such behind this as well, and it seems very complicated)

Author:  shorthair [ Sat Jan 31, 2004 1:57 pm ]
Post subject: 

i remember that now , i have his book , the universe in a nutshell , i have never read it yet , but i looked over it and found some awsome stuff

Author:  Catalyst [ Sat Jan 31, 2004 2:19 pm ]
Post subject: 

his books are good Very Happy
if u havent already be sure to read a brief history of time

Author:  Cervantes [ Sat Jan 31, 2004 3:09 pm ]
Post subject: 

I think I heard of that hawking radiation bit before, at least some of it.
that seems so wierd though, that matter and antimatter particles could just pop in and out of 'empty space'. and if they pop in and out of 'empty space', why can't they do it in 'not empty space' like a meter to my left Thinking

Author:  Catalyst [ Sat Jan 31, 2004 4:35 pm ]
Post subject: 

i beleive it happens everywhere , but its only noticable when the space is "empty". There was an experiment that proved these pairs. Two metal plates were put really close together in a vacuum. This space was too small for the pairs to form, so the pressure from the pairs was less between the plates then around them. So the pressure difference pushed the plates together. (known as the casimir effect)

Author:  Cervantes [ Sat Jan 31, 2004 4:44 pm ]
Post subject: 

damn thats cool. (i seem to be asking this a lot lately but) where'd you learn that one? Thinking

Author:  Catalyst [ Sat Jan 31, 2004 4:48 pm ]
Post subject: 

im not sure
i think it was brief history of time, but i may be wrong

Author:  Cervantes [ Sat Jan 31, 2004 5:04 pm ]
Post subject: 

so you don't learn anything like that in school? Sad

Author:  Andy [ Sat Jan 31, 2004 5:05 pm ]
Post subject: 

catalyst never learned anything in school...

Author:  Paul [ Sat Jan 31, 2004 5:10 pm ]
Post subject: 

Ha, I get all my science facts from science fiction (oh the irony). Seriously, many science fiction books are written by scientists, and has real science facts. You just need to tell the difference between facts or fiction.

Author:  Cervantes [ Sat Jan 31, 2004 5:19 pm ]
Post subject: 

which books? there is an author who writes scifi about space that's apparently really really good and accurate on a lot of facts too.. can't remember his name offhand though Sad

Author:  Paul [ Sat Jan 31, 2004 5:24 pm ]
Post subject: 

I don't really know, I've read many books, but Isaac Isimov and his robot books are good. Smile

Author:  Catalyst [ Sat Jan 31, 2004 5:27 pm ]
Post subject: 

clarke's books are good

Author:  Kuntzy [ Sat Jan 31, 2004 6:12 pm ]
Post subject: 

I'm reading a book called Physics for Game Developers by David M. Bourg. I'm just at the beginning of the book, but from what i've seen of it so far, I would recommend it for antone who wants to put real time physics in their games. You don;t have to seperate fact from fiction in this book Laughing

Author:  Cervantes [ Sat Jan 31, 2004 6:16 pm ]
Post subject: 

sweet!! I gotta get me a copy of this book! Smile


: