Computer Science Canada

physics and applying it to programming

Author:  jonos [ Fri Feb 20, 2004 11:51 pm ]
Post subject:  physics and applying it to programming

im trying to learn how to apply physics (grade 10) to programming, but its really hard, and im not very good at that kind of stuff. if anyone wants to post something that could be helpful, and easy to understand, it would be really good for me and some other people who may not know what to do. ive heard catalyst can explain this stuff good.... Very Happy

Author:  Tony [ Sat Feb 21, 2004 12:34 am ]
Post subject: 

I dont think thats the way it works... you dont just learn a concept and stick that into your program. Its rether you're writing a program and you're required to use a specific approach.

Oftentimes in games you would be required to model physically correct situations, and thats where knowledge comes in.

So how about you tell us what you want to know, and we'll fill you in

Author:  jonos [ Sat Feb 21, 2004 9:30 am ]
Post subject: 

well i was bothering shorthair about this, and i was trying to get realistic acceleration and speed. this is what i got:

this has nothing to do with the formula a=v/t (i think) which i was trying to apply, but this is all i could work out:

code:

setscreen ("graphics:700, 100")

var a : int := maxy div 2
var b, c : int := 1

loop
    drawline (20, 0, 20, maxy, black)
    drawline (maxx - 20, 0, maxx - 20, maxy, black)
    drawoval (a, maxy div 2, 5, 5, brightred)
    a := a + b
    b := b + 1
    c := b
    exit when a > maxx - 20
    delay (25)
    cls
end loop

Author:  Cervantes [ Sat Feb 21, 2004 10:24 am ]
Post subject: 

Why do you have c in there? It isn't doing anything Thinking

I know where you're coming from Jonos. I wanna learn physics too Sad But you can't expect to learn all the physics you need from compsci. I think we're just gunna have to wait until gr 11 Crying or Very sad

But in the time being, just copy code from other ppls programs Smile thoughtful's pool owns Smile

Author:  jonos [ Sat Feb 21, 2004 10:30 pm ]
Post subject: 

finally!!! someone who knows what it feels like. the c was there for something else i was trying but didn't work. i just forgot to remove it. yeah, maybe i should just wait, or try making simple things.

does the acceleration thing look okay though?

Author:  jonos [ Sat Feb 21, 2004 11:30 pm ]
Post subject: 

i know its good (thoughtful's thing), but i need to know about the cos and sin and tan and all that, so maybe i should just wait, or read the math text (we aren't there yet)

Author:  Tony [ Sun Feb 22, 2004 1:40 am ]
Post subject: 

i recomend teaching yourself trig from math 10 first, then forces from physics 11

the cool thing is that not only will it help you in programming, but you'll also do great when it comes to actually 'learning' those units in school Laughing

Author:  Acid [ Thu Feb 26, 2004 10:45 am ]
Post subject: 

I once made a VB program that graphed projectile motion. All you had to input was the initial velocity upward.

It can be graphed as a quadratic function like this:

Y = V1(X) - 9.8 (X^2)

Where Y is the height, X is the time in seconds, and V1 is the initial velocity. Since the acceleration due to gravity is 9.8 m/s^2 the maximum Y value will be the maximum height of the projectile, and the second X value will be when the object hits the ground.

Author:  Cervantes [ Thu Feb 26, 2004 6:08 pm ]
Post subject: 

tony -> Forces in Gr 11? Is that different from the motion unit that my class did in gr 10 science?

we did a bunch of stuff with vectors, Scale Diagrams and (crappy having Math sem 2 and science sem 1) kinematic equations.

Author:  wtd [ Thu Feb 26, 2004 6:35 pm ]
Post subject: 

If you plan to do a lot of math or physics work when it comes to programming, it may be worth it check out a functional programming language like Haskell, Lisp, OCaml, or even Dylan.

Author:  Tony [ Thu Feb 26, 2004 8:32 pm ]
Post subject: 

Cervantes -> gr11 physics takes a deeper look at the workings of the kinematics... like various forces involved and such... I dont really remember anything from grade 10... such a long way back Rolling Eyes

Author:  shorthair [ Thu Feb 26, 2004 9:33 pm ]
Post subject: 

good old kinematics , graviational and potential energy ,, thats a great part of physics , we got to built a trebuche and a mortar aswellwhen we did projectiles

Author:  Andy [ Thu Feb 26, 2004 9:35 pm ]
Post subject: 

tat's it? we're doing sound, light and other types of waves rite now

Author:  recneps [ Thu Feb 26, 2004 9:41 pm ]
Post subject: 

in Gr 10, all we did was velocity, acceleration, and how to calculate different forms with GRESS (and review on slope, how to draw graphs, etc:D)

Author:  shorthair [ Thu Feb 26, 2004 9:42 pm ]
Post subject: 

there good , transverse waves and longitudinal waves , doppler effect ( can be used with sound aswell as light , though based on redand blue shift ) ....... Grade 11 has a great intro to physics ,

Author:  Tony [ Thu Feb 26, 2004 11:34 pm ]
Post subject: 

waves are kinda useless to programming unless you're modeling their behaviour Laughing

Author:  BlAcK TuRtLe [ Thu Mar 04, 2004 4:36 pm ]
Post subject: 

forces in grade 11 we're doin right now. We just did gravitational forces. Its not that hard reall just alot of crummy formulae Mad

Author:  Tony [ Thu Mar 04, 2004 4:57 pm ]
Post subject: 

haha, just wait till physics 12 Laughing we get to calculate forces between quontum electrical charges in magnetic fields and such Laughing

Author:  Homer_simpson [ Sun Mar 07, 2004 3:23 am ]
Post subject: 

for a good physics based program... u probably should know oop...
for example let's say u wanna make simple physic world with simple laws of physics on it...
now first u gotto create a world... in that world u can have ground,gravity,wall,etc...
then u need some objects,and objects have properties like position,angle,mass,velocity,energy,etc...
after that comes the physics engine... the physics engine is the part where u start applying rules of physics to yer object like:collision detection,gravitational pull,etc...

and finally u can draw yer world and object...

i had a physics particle engine posted here somewhere, check that out it's the perfect example for what i'm talking about...


: