This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for Simple Pendulum Simulation

Return to Simple Pendulum Simulation

DutaDuta

2012/1/14

Very nice! :)
DutaDuta

2012/1/14

Very nice! :)
mikeyboymikeyboy

2012/10/10

Can anyone have a look at this and suggest how to make the swing reduce each oscillation?
sp33dysp33dy

2012/10/10

I've no idea, but it must have something to do with Friction. Air??? so as it moves, a tiny fraction of air resistance has to be removed?? Purely a guess.
sp33dysp33dy

2012/10/10

Might have been a good guess! http://www.ehow.com/facts_7438844_pendulum-slow-down_.html
mikeyboymikeyboy

2012/10/10

Yeah, its just finding away to incorporate that into the code as I don't know java very well :/
gusbus123gusbus123

2012/10/10

Simple way is to add a variable called gravity that = 1. Then every time it reaches the highest point of which it can go the amount of force applied for it to go back around the other way is reduced by the amount of gravity there is.
gusbus123gusbus123

2012/10/10

Or another way of doing it which will make the gravity change as it moves up and down would go something like this. initiate a variable called gravity that = 0. have a check in the act that will make the gravity be equal to : (length of wire - distance between y coordinates of center point and the ball) / 10. Then make a check in the area of code where it applies the force which will do : If the ball is going downwards (Dipping down in the U shape) the force applied will + the amount of gravity there is. Otherwise if the ball is going upwards the force applied will - the amount of gravity.
gusbus123gusbus123

2012/10/10

By the way i do not understand what your code is saying that is why i am not giving you a fully formated piece of code to you, what i have given you is based on the information i can see from watching what the scenario is doing.
MatheMagicianMatheMagician

2012/10/10

I would like it (if you haven't already) if you implemented the equation for the period of a pedulum: that is 2*PI*sqrt(Length of string (in meters)/9.8 meters per sec)
MatheMagicianMatheMagician

2012/10/10

That is all in meters and assuming you are doing this on earth: so if you want to change it to your own variables, the basic equation is this: 2*PI*sqrt(length of pendulum/Gravitational acceleration)
sp33dysp33dy

2012/10/10

That's the problem I face.. I don't know the math or have time to figure it out.
SPowerSPower

2012/10/10

Once the ball moves, it doesn't stop anymore. Not so realistic.
Game/maniacGame/maniac

2012/10/10

pretty good
mikeyboymikeyboy

2013/2/13

Is there anyone that can look at this code, try and understand it, and then suggest ways of incorporating gravity so the pendulum will slow down to a stop, rather than continuously?