You are not logged in.
while i was on holiday i was figuring out formulas for projectile motion with air resistance and a constant external force, i.e. constant wind or gravity, and ive figured it out.
first of all
v0 is velocity at t=0, i.e. initial velocity, and g is the constant external force being applied to the projectile, and f is a number 0 < f < 1 for the air restistance, or any other resistance where f = 1 is no resistance, and 0 would be total resistance in such a way that you would have, applying the resistance and external force
and ofcourse, these formulae are pointless if g is 0, or if v0 and g are 0, although they will still work if g = 0, they will not all work for v0 = 0
i wasnt quite sure how to get a formula for v with a given time, so i went through the series to see how it expanded
then i couldnt quite remember how intergration and differentiating exponentials went and figured out through rough memory and approximating gradients of exponential graphs
so for acceleration
and for displacement
and with some rearranging, s(t) can be written
where the big bit in brackets is a constant for constant v0,f,gto find the terminal velocity is the limit to infinity of the velocity, which since 0 < f < 1, there always will be a terminal velocity.
and lastly, finding the zero's of the velocity, to find the time at which the displacement will be at its peak.
ive only tested on paper till now, but ive made a small flash application, that you can edit the values of, and itll show you a simulation of it, displaying the acceleration, velocity and displacement against time, stating the terminal velocity, and drawing a vertical line at the the time for which v(t) is 0 from the last formula.
note, dont get mislead by the arc it will make, this is only displaying the displacement etc of height, so imagine its a ball on a vertical slider being hit up, or down like in the imaging on the right (requires flash player 8)
http://delta-luca.110mb.com/kinematics.html
the red line is acceleration
the green line is velocity
the blue line is displacement
the magenta line is a vertical line drawn at the value of t found with the last equation at which velocity is 0
and the yellow line is a horizontal line drawn at the displacement found using the value of t used in the magenta line
----edit
update flash application, cyan line is a horizontal line drawn to display the terminal velocity on the graph
Last edited by luca-deltodesco (2006-09-06 04:56:24)
The Beginning Of All Things To End.
The End Of All Things To Come.
Offline
Thats......different.
Theres no other place like home or is there..............
Offline
Thats......different.
yep.
The Beginning Of All Things To End.
The End Of All Things To Come.
Offline
Gee, that is really good stuff, luca.
Air resistance would be a function of the drag coefficient (http://en.wikipedia.org/wiki/Drag_coefficient) of the object and the air speed.
(Love the flash animation - you wouldn't like to make some for the website?)
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Offline
(Love the flash animation - you wouldn't like to make some for the website?)
to do with what? (thats a 'sure')
The Beginning Of All Things To End.
The End Of All Things To Come.
Offline
Oh, lots of things! The site needs lots more animations because they are so effective at teaching and are so much fun to use. From simple "drag the corner to see that the angles add to 180" to complex "create your own 3D images".
But it is often more fun to follow your passion, so you could animate whatver you want (so long as it is math-related), and I can put it on the website with your name below it. (I can even pay for animations out of the growing kitty, but it is only small change.)
"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman
Offline
I meant to say thats diferent in a nice way as in tha is thinking ut side the square
Theres no other place like home or is there..............
Offline
it would be really heplful for me, if i could see this long-lost flash file for missile calculation. i would like to use these on a small flash-game i'm working on. but am not very good with such high-end maths...
Offline
Unless accuracy is absolutely needed, you can just simulate the missiles rather than using exact equations which would allow for much more varied scenarios, like wind that changes over time without any need for complex calculations:
You could simulate the missile simply as a particle, each frame you would calculate the forces being exerted on it, and the resultant acceleration to modify the velocity, and calculate the next position of the missile. something along the lines of:
Obviously, in application you wouldn't have wind etc stored as constants inside each missile, but in a singleton perhaps for the world variables.
package
{
import flash.display.MovieClip;
//treating missile as a straight line segement of length 'length'
public class Missile extends MovieClip
{
private var px:Number, py:Number; //reason for using these rather than inherited x,y is for accuracy as x,y are rounded
private var vx:Number, vy:Number; //velocity
private var mass:Number, imass:Number; //mass, reciprocal of mass
//assumes the missile graphic is centred, and horizontal at 0 rotation
public function init(x:Number, y:Number, xv:Number, yv:Number, m:Number)
{
px = x; py = y;
vx = xv; vy = yv;
mass = m; imass = 1/m;
}
//h is the timestep in your simulation, at 60fps, it should be 1/60 etc.
public function advance(h:Number):void
{
//force accumulators
var fx:Number, fy:Number = fx = 0;
//---compute forces
//wind:
fx -= 75;
//gravity:
fy += 220*mass;
//air resistance:
//relative velocity of missile with respect to the air
var rvx:Number = vx+75;
var rvy:Number = vy;
if(rvx!=0||rvy!=0)
{
var rvl:Number = 0.02*Math.sqrt(rvx*rvx+rvy*rvy); // 0.02 varied
fx -= rvx*rvl;
fy -= rvy*rvl;
}
//---compute acceleration
var ax:Number = fx*imass;
var ay:Number = fy*imass;
//---numerically integrate for new velocity and displacement
vx += ax*h;
vy += ay*h;
px += vx*h;
py += vy*h;
//---update x,y,rotation based on these values
x = px;
y = py;
//set rotation so that it faces direction of motion
rotation = Math.atan2(vy,vx)*180/Math.PI;
}
}
}
the code in the .fla is then:
import Missile;
var missiles:Array = new Array();
function mdown(ev:MouseEvent):void
{
var m:MissileClip = new MissileClip();
m.init(0,400,mouseX*3,(mouseY-400)*3,5);
addChild(m);
missiles.push(m);
}
stage.addEventListener(MouseEvent.MOUSE_DOWN,mdown);
const h:Number = 1/60;
function main(ev:Event):void
{
for(var i:int = 0; i<missiles.length; i++)
{
var m:MissileClip = missiles[i];
m.advance(h);
if(m.y>450)
{
removeChild(m);
missiles.splice(i--,1);
}
}
}
stage.addEventListener(Event.ENTER_FRAME,main);
where MissileClip is the class name of the missile graphic clip, who's base class is Missile
Note how with the left wind of 45Newtons, when missiles begin to fall vertically, they actually fall a little to the left.
With the constant force of gravity and wind, the missiles reach a terminal velocity controlled by the drag constant, in this case 0.02 and their mass, and the values of gravity and wind.
http://spamtheweb.com/ul/upload/060409/ … issile.php
Last edited by luca-deltodesco (2009-04-06 03:52:01)
The Beginning Of All Things To End.
The End Of All Things To Come.
Offline
darn kind you are... not only providing with the formulae, you also created a class for this. i really thank you very much.
it seems, that this is 2d-only. i am thinking to use these in 3d-space. lets see, how i can apply these into 3d-space, as it brings another variable, volume or depth...
Offline
in terms of the kinematics, it is perfectly straight forward, rendering is up to you
The Beginning Of All Things To End.
The End Of All Things To Come.
Offline
no rendering will be done. does this run in x-y-z formatted space, i'd like to ask... i see that the calculation has only x and y-coords...
Offline
each dimension is independant of the others in all but one calculation which calculates the length of the vector:
you have a vector representing the displacement of the body in 'n' dimensions, it's velocity in 'n' dimensons, you have a wind term, a vector in 'n' dimensions, and the gravity in 'n' dimensions, a force accumulator in 'n' dimensions etc, all of the operations are just addition and scaling by a scalar
the only calculation that is not independant of the dimension is the magnitude calculation, which is just sqrt(x^2 + y^2 + z^2 + w^2) etc.
The Beginning Of All Things To End.
The End Of All Things To Come.
Offline