Jump to content

  • Log In with Google      Sign In   
  • Create Account


getting gravity and initial velocity


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 sanghlee   Members   -  Reputation: 106

Like
0Likes
Like

Posted 07 February 2013 - 05:07 AM

I've been working on this problem for awhile but couln't get right result. So I hope anybody help me.

 

 

Lets say there's a man at height H. And he jumps stright upward and reaches maxH and fall back to ground(zero height) in given time(t).

 

What would be initial velocity(jump power) and gravity?

 

The man must reach to maxH(not over it) and fall back to ground in GIVEN TIME!

 

 

If he jumps from ground, it's solved by assuming that v=0 at half of given time.

 

But I can't solve if that man jumps from specific height.

 

 

Below is what I want to do.

 

void jump( float current_height, float max_height, float desired_time )

{

  g = ...?

  v0 = ...?

}

 

 

Thanks in advance.



Sponsor:

#2 RulerOfNothing   Members   -  Reputation: 1160

Like
0Likes
Like

Posted 07 February 2013 - 07:23 AM

Taking the equation for displacement with constant acceleration:
y=y0+v0*t+0.5*a*t*t
where y0 is the height, v0 is the initial velocity and a is the acceleration (which should be negative), you can solve for y=0 which gives you a quadratic equation. Solving this equation gives y=(-v0+sqrt(v0*v0-2*a*y0))/a or y=(-v0-sqrt(v0*v0-2*a*y0))/a. The physically relevant solution is obviously the positive one. Does this help?


EDIT: scratch that. If you want to get both gravity and initial velocity, you need another piece of information (probably the time taken to reach the maximum height) unless I am making another mistake here.

Edited by RulerOfNothing, 07 February 2013 - 07:30 AM.


#3 EWClay   Members   -  Reputation: 659

Like
0Likes
Like

Posted 07 February 2013 - 08:49 AM

No, it's possible.

The time to reach maximum height is v/g and we also know v^2 = 2g(maxH - H). So substituting gives the time in terms of g.

The time to fall is sqrt(2 maxH/g).

Both times added together equal t. So you can solve for g and from that find v.

#4 Sporniket   Members   -  Reputation: 331

Like
0Likes
Like

Posted 07 February 2013 - 09:36 AM

given the fact that there is only gravity in action once the man is in the air, the time needed to go from altitude H to MaxH is the same as a freefall from altitude MaxH to H.

 

Let call Hjump the altitude from where the man jump, and Hland the altitude of the man where it lands after reaching Hmax

Thus, compute the time needed for a free fall from altitude MaxH to Hjump = T1 ; the time needed for a free fall from altitude MaxH to Hland = T2 ; total time needed : T = T1+T2

 

Notice that your "given time" is a time limit only, as there is no way, given Hjump, Hland and MaxH, to influence the time requirred to do the jump


Space Zig-Zag, a casual game of skill for Android by Sporniket-Studio.com


#5 Milcho   Crossbones+   -  Reputation: 1175

Like
2Likes
Like

Posted 07 February 2013 - 10:32 AM

I believe this to be a solution:

 

First, obtain Initial Velocity:

 

Initial vertical velocity as a function: Vb(Td, Ha, Hb ) = (-Td - ( Td^2 - Td^2/(Ha-Hb)*Ha )^(1/2)  ) / ( Td^2 / (2*(Ha-Hb) ) )

Or in equation format:

 

tD = total time

HA = starting height

HB = max height

 

Once you have that, gravity can be derived:

 

Gravity as a function: g( Td, Ha, V ) = (-Ha-V*Td)/(Td*Td) 
Or in equation format:
 
tD =  total time
HA = starting height
V = initial velocity, obtained from first equation

 

Here's my derivation

Picture Link:

Document Link:

https://docs.google.com/file/d/0B39w-yzqjMIaMDNvT0RFczFHVlU/edit?usp=sharing ( google docs messes up the equations, download the docx to view them )

 

You can enter the above equation into any standard calculator that supports equations. (win power calc is what I used).

Testing it seems to work. For example:

 

Vb(1.02, 0, 1.276) = 5.003

Vb(1.328, 2, 3.276) = 5.0008
 
You can check those values at http://www.had2know.com/academics/trajectory-parabola-equations-calculator.html - entering the corresponding values, and 90 for the "trajectory angle"
 
Note: Throughout my calculations I assumed the formulas looked like this: h = h0 + v0*t + g*t0^2 - meaning, I was adding gravity, instead of doing -g. Basically you have to realize that I was expecting the value of g to be negative. This will come into account when deriving gravity.
 
Edit 5: Added derivation work and visual formulas.
 
Note that there may be simpler solutions, but I couldn't find any smile.png

Edited by Milcho, 07 February 2013 - 12:57 PM.


#6 Sporniket   Members   -  Reputation: 331

Like
0Likes
Like

Posted 07 February 2013 - 11:02 AM

Notice that your "given time" is a time limit only, as there is no way, given Hjump, Hland and MaxH, to influence the time requirred to do the jump

 

Ooops, I forgot that there can be an angle for the jump... Varying angle and velocity will influence the time of the jump, thus the goal of a given time is right... sorry.


Space Zig-Zag, a casual game of skill for Android by Sporniket-Studio.com


#7 Milcho   Crossbones+   -  Reputation: 1175

Like
1Likes
Like

Posted 07 February 2013 - 11:07 AM

Ooops, I forgot that there can be an angle for the jump

Angle? Angle has nothing to do with it, as far as I understood. 

Sanghlee was only asking for vertical velocity (he mentioned a man jumping straight up).

 

More importantly, the calculations for vertical velocity can be entirely independently done from those for horizontal, because horizontal velocity has no effect on the time it takes an object to fall down.



#8 sanghlee   Members   -  Reputation: 106

Like
0Likes
Like

Posted 08 February 2013 - 07:00 AM

SUPER THANKS to Milcho! Especially good derivation and super kind explanation!

 

I've not read details of your derivation yet but your fomula works perfectly!

 

You're right about the angle. I just needed upward force.

 

I'm impressed that you've gave excellent explanation to just a online question.

 

I'll be asking you if I have question while reading your derivation.

 

You helped me alot. Thanks again!

 

 

 

I believe this to be a solution:

 

First, obtain Initial Velocity:

 

Initial vertical velocity as a function: Vb(Td, Ha, Hb ) = (-Td - ( Td^2 - Td^2/(Ha-Hb)*Ha )^(1/2)  ) / ( Td^2 / (2*(Ha-Hb) ) )

Or in equation format:

iD8zcrK.jpg

 

tD = total time

HA = starting height

HB = max height

 

Once you have that, gravity can be derived:

 

Gravity as a function: g( Td, Ha, V ) = (-Ha-V*Td)/(Td*Td) 
Or in equation format:
EBBFbNi.jpg
 
tD =  total time
HA = starting height
V = initial velocity, obtained from first equation

 

Here's my derivation

Picture Link:

FvkK2I6l.jpg

Document Link:

https://docs.google.com/file/d/0B39w-yzqjMIaMDNvT0RFczFHVlU/edit?usp=sharing ( google docs messes up the equations, download the docx to view them )

 

You can enter the above equation into any standard calculator that supports equations. (win power calc is what I used).

Testing it seems to work. For example:

 

Vb(1.02, 0, 1.276) = 5.003

Vb(1.328, 2, 3.276) = 5.0008
 
You can check those values at http://www.had2know.com/academics/trajectory-parabola-equations-calculator.html - entering the corresponding values, and 90 for the "trajectory angle"
 
Note: Throughout my calculations I assumed the formulas looked like this: h = h0 + v0*t + g*t0^2 - meaning, I was adding gravity, instead of doing -g. Basically you have to realize that I was expecting the value of g to be negative. This will come into account when deriving gravity.
 
Edit 5: Added derivation work and visual formulas.
 
Note that there may be simpler solutions, but I couldn't find any smile.png


#9 Milcho   Crossbones+   -  Reputation: 1175

Like
0Likes
Like

Posted 08 February 2013 - 07:48 AM

Glad to help - but as I said, there are probably simpler ways to calcualate the V0.

And here is one simplification: (to clarify, this is the exact same formula from above, only simplified)

 

V(Td, Ha, Hb) = 2*( Hb - Ha + (Hb*Hb - Ha*Hb)^(1/2) ) / Td

 

Same variable name/meanings - and it should run faster, and works just as well.


Edited by Milcho, 08 February 2013 - 07:57 AM.


#10 Bacterius   Crossbones+   -  Reputation: 8580

Like
0Likes
Like

Posted 08 February 2013 - 08:14 AM

I solved this problem in the general case a while ago, on this thread, but the LaTeX parsing bug currently plaguing the forum has utterly destroyed it.

 

The general idea was to define two arbitrary points A and B, and find the correct initial velocity vector such that an object launched at A subject to vertical gravity g will intersect B. This leads to a parametric equation in time t (since there are infinitely many solutions). You can rearrange it and properly define A and B to adapt the result to your situation, rearranging for the required variable.

 

I will reproduce the important part of the derivation here, out of context, without LaTeX (I honestly cannot be bothered typesetting the equations and uploading them in JPG format, sorry):

Assuming gravity is the only force on the bomb, and is strictly downwards, and that point B does not move while the bomb is in the air (obviously) and that there are no obstacles to consider, then you can in fact work out the exact initial velocity vector needed to hit point B. First, let A be at coordinates (Ax, Ay) and B at coordinates (Bx, By).Then, using some kinematics, the position of the bomb at any time t will be:

 

(Ax + Vx t, Ay + Vy t + 0.5gt^2)

 

So for the bomb to hit B somehow, we need the coordinates of the bomb to satisfy:

 

Ax + Vx t = Bx

Ay + Vy t + 0.5 gt^2 = By

 

For some t. Rearranging:

 

Vx = (Bx - Ax) / t

Vy = (By - Ay - 0.5gt^2) / t

 

Simplifying:

 

Vx = (Bx - Ax) / t

Vy = (By - Ay) / t - 0.5gt

 

This is a parametric equation in t, which basically gives a bigger and bigger velocity vector as you decrease the time (the faster you shoot, the less time gravity has to effect the bomb, so at infinite speed you can pretty much just aim towards B and shoot). As you increase the time t, gravity becomes more important (see the gravity term in the equation) and the direction itself matters less, so you get an increasingly large arc.

 

This is probably overkill for your particular situation, but since this is a vector solution, it lends itself perfectly to higher dimensions and arbitrary gravity vectors (the quoted paragraph is a special case with vertical gravity only, in two dimensions, the full result is in the following post on said thread). You can even make it work with arbitrary gravitational fields using calculus, but that is definitely overkill.


The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#11 Milcho   Crossbones+   -  Reputation: 1175

Like
0Likes
Like

Posted 08 February 2013 - 08:32 AM

Bacterius, correct me if I'm wrong:

Your equations assume:

1) fixed starting point,

2) fixed ending point,

3) fixed gravity and

4) no restrictions as to how much time the object needs to take there.

 

Using that information, you derive the initial necessary velocity to move from point A to point B.

 

Assumptions 1) and 2) apply here as well, but from the initial post, as I understand, the gravity is an unknown which must be found, and you're given the total time T which the movement takes (or needs to take).

I don't believe that your equations, as you posted them in the current format, will solve these requirements.

 

Of course, I could be missing something...



#12 Bacterius   Crossbones+   -  Reputation: 8580

Like
0Likes
Like

Posted 08 February 2013 - 08:39 AM

Bacterius, correct me if I'm wrong:

Your equations assume:

1) fixed starting point,

2) fixed ending point,

3) fixed gravity and

4) no restrictions as to how much time the object needs to take there.

 

Using that information, you derive the initial necessary velocity to move from point A to point B.

 

Assumptions 1) and 2) apply here as well, but from the initial post, as I understand, the gravity is an unknown which must be found, and you're given the total time T which the movement takes (or needs to take).

I don't believe that your equations, as you posted them in the current format, will solve these requirements.

 

Of course, I could be missing something...

 

The parametric equation relates the three variables gravity, time from A to B and initial velocity, and can be rearranged to express any one of those variables in terms of the other two. Restrictions can be placed on any variable, including time. The original post gives a required time which can be plugged in, yielding equation relating g and initial velocity v0. With no restrictions, infinitely many (g, v0) solutions exist, and can be found by simply choosing arbitrary g or v0 and solving for the other.

 

Unless I made a mistake, which is entirely possible.


Edited by Bacterius, 08 February 2013 - 08:40 AM.

The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#13 Milcho   Crossbones+   -  Reputation: 1175

Like
1Likes
Like

Posted 08 February 2013 - 08:50 AM

The parametric equation relates the three variables gravity, time from A to B and initial velocity, and can be rearranged to express any one of those variables in terms of the other two.

 

Referring to this:

Vy = (By - Ay) / t - 0.5gt

You have initial velocity, distance, time and gravity. (referring to y-axis only here)

 

Two of those are unknown in the problem posted in this thread - the original velocity and the gravity.

Perhaps I'm missing the obvious, but there's no trivial way to expand or rearrange the equation to solve for both gravity and initial velocity  - only a way to give you a relation between them (two unknowns, one equation).  This would usually mean that there might be 0, or more solutions to the equation, however the one piece of information you do not account in those equations is the maximum height that the object needs to reach - which I think removes a degree of freedom and narrows down the solution to only 1.


Edited by Milcho, 08 February 2013 - 08:52 AM.


#14 Bacterius   Crossbones+   -  Reputation: 8580

Like
0Likes
Like

Posted 08 February 2013 - 08:54 AM

Two of those are unknown in the problem posted in this thread - the original velocity and the gravity.
Perhaps I'm missing the obvious, but there's no trivial way to expand or rearrange the equation to solve for both gravity and initial velocity  -only a way to give you a relation between them (two unknowns, one equation).  This would usually mean that there might be 0, or more solutions to the equation, however the one piece of information you do not account in those equations is the maximum height that the object needs to reach - which I think removes the last degree of freedom and narrows down the solution to only 1.

Ah, you are correct, I did not see that information. This will indeed be enough. In this case my equation applies twice, once at maximal height at time t, and once at initial height at double the time (2t), and you have to solve a system of two equations in g and v0 which should give the same (unique) solution you obtain. Thanks.

 

Easiest way is to equate initial velocity, and solve for g, and use that to solve for initial velocity (like you did) which gives the same solution.

 

Assuming initial height is the ground, this will for instance give solution v0 = 4h / t which is equivalent to your solution assuming Ha = 0.

 

At this point your solution probably makes more sense to everyone, though :)


Edited by Bacterius, 08 February 2013 - 09:16 AM.

The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS