continuous projectile path

Started by
6 comments, last by erissian 17 years, 6 months ago
Im writing a physics library and I want it to support both continuous projectile paths and segmented paths (just takes a function pointer that returns the force at some time t). The continuous projectile algorithm started off easy enough. instead of: a(t) = F/m v(t) = Ft/m + v0 x(t) = Ft^2/(2m) + v0t + x0 the equations become: a(t) = F(t)/m v(t) = int(F dt)/m + v0 x(t) = int(int(F dt) dt)/m + v0t + x0 where int(F dt) is the integral of F with respect to t this works fine for any F(t) where the only variable in F is t. However, when I tried to use the simple air friction force equation, F=-b*v=-b*dx/dt, I ran into some problems. I solved for y using the differential equation: int(F dt) = -b*x y'(t) = x(t) y'(t) = y/m + v0t + x0 I got that x = m*v0/b which is a constant. I know this is wrong but I did the math write and plugging x back into the equations works. I think I might have the force function wrong because if G(t) = int(F dt) then G(0) should be 0 because v(0) = v0. However G(t) in this case isnt 0, its -b*x.
Advertisement
For general motion, try to stick to r:

(I don't know how to make dots and double dots, so " denotes second derivative wrt t)

mr" = -br'
r" + (b/m)r' = 0
which can be solved with r' = A*exp(-bt/m)

a more useful version would be to consider r' as
r = -(A B)*exp(-bt/m)*(m/b)
r' = (A B)*exp(-bt/m)*(b/m)
r" = -(A B)*exp(-bt/m)*(b/m)

where (A B) are arbitrary constants for the x and y vectors, respectively.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
Ive never even seen the dot notation for derivatives before today anyway, I use ' and ".

ok how did you get a different answer than me? I solved for y in the equations:
y' = r
and
r = y/m + v0t + x0

which is just the second derivative of the one you used..

anyway, is there any way to generalize this to some set of functions F, G, H where G' = F and H' = G? I want to have a projectile class that takes three functions pointers and can calculate the position of the projectile at some time. If F is only a function of t what I have works but I dont see a way to include all functions of F..

r" = F(t)/m
r' = G(t)/m + v0
r = H(t)/m + v0t + x0
Well, what you're trying to solve in the resistance case is a differential equation. This is because F is essentially the second derivative of x, and is dependant on x.

When solving a linear differential equation, it's common to use the exponetial function, or trigonometric functions, because their derivatives are in very much the same form.

This case is essentially in the form of:
x' + gx = 0

So what functions of x would fit into this? Well, you can usually guarantee that the exponential function will. Let's say x is Aebt. The time derivative is bAebt. That makes our equation:
bAebt + gAebt = 0
Which reduces to:
b + g = 0
b = -g
So then we can rewrite this as:
x = Ae-gt

In this case, we started with F as a function of x, and we can write it like this:
F = ma = -bv
Where a = dv/dt = v'
So, dividing both sides by m:
v' = -(b/m)v
v' + (b/m)v = 0
Which is the same form as our x' + gx = 0 we had before.

You can't just integrate over t, because F isn't dependant on t. You would still get stuck at this step:

v(x) = -(b/m)x

Which again is the same form we used before, x' + gx = 0.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
For reference - in physics dots are usually used to denote derivatives with respect to time and ' is used to denote spatial derivatives.
ok I guess what Im really asking is if I have a function F(v,x,t) and the derivitives and integrals of F if needed, what are r, r' and r"? Its impossible right? since the function F contains r and r'.. anyway I have one more question. Im currently taken diff. eq. and we havnt gotten to second differential non linear equations yet so can someone show me how to get r, r', and r" from F(t) = Gm/r^2 ?
r^-2 * r" = G
I tried taking the double integral of boths side, wtr r on the left, wtr t on the right. However I ended up with a polynomial answer which cant be right. Also, the solution I got has r'(0) = 0 and r"(0) = 0.
ok I guess what Im really asking is if I have a function F(v,x,t) and the derivitives and integrals of F if needed, what are r, r' and r"? Its impossible right? since the function F contains r and r'.. anyway I have one more question. Im currently taken diff. eq. and we havnt gotten to second differential non linear equations yet so can someone show me how to get r, r', and r" from F(t) = Gm/r^2 ?
r^-2 * r" = G
I tried taking the double integral of boths side, wtr r on the left, wtr t on the right. However I ended up with a polynomial answer which cant be right. Also, the solution I got has r'(0) = 0 and r"(0) = 0.
Well, it's not impossible, it's just a differential equation.
Whenever you have a scenario like v(x) or a(x) or a(v), or any y(n)(y(m)), it's a differential equation.

In the case of F = GMm/r^2, it's solvable by separation.

(And once again, I'm using r" to represent d2r/dt2)

F = ma = -GMm/r^2
(1) a = -GM/r^2

Recognize that a is the time derivative of v:
a = dv/dt

Using the chain rule:

dv dv dr
-- = -- --
dt dr dt

Also, dx/dt = v, so:
a = dv/dt = (dv/dr)(dr/dt) = (dv/dr)(v)
(2) a = vdv/dr

Using (1) and (2):
vdv/dr = -GM/r^2
vdv = -GM/r^2 dr

Integrating:
0.5 v^2 = +GM/r
v = sqrt(2GM/r)

So:
r = r
r' = sqrt(2GM/r)
r" = -GM/r^2
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)

This topic is closed to new replies.

Advertisement