1

I'm trying to program each of the pictured equations (I did not make the chart):

so a user may enter 3 of 5 variables and always return the missing 2 variables. I'm having some divide by 0 issues in instances when the acceleration is 0 and in other spots. The equation for finding time in the second row, second equation seems particularly strange. Also should I be receiving 2 answers from some of these.. ie square root problems?

First, are these equations accurate? And if they are accurate, what stipulations should I add to my program in order to prevent divide by 0 issues and possibly other problems.

If it helps you to know, I'm using JavaScript, but I'm more concerned about the nature of the math and how it relates to kinematics than about the language itself.

Thank you very much.

Dan Arrick
  • 85
  • 8
  • What do you mean by "accurate"? Did you re-arrange them yourself and want a proof-reader? Motion under constant acceleration is parabolic, so there certainly can be two solutions for certain variables. – meowgoesthedog Jul 30 '18 at 22:39
  • No, I did not re-arrange them myself but I'm hoping someone could corroborate these or see if there's anything fishy at quick glance. When solving for time for instance, I feel I should only get one answer. – Dan Arrick Jul 30 '18 at 22:46
  • In certain cases one of the time roots will be negative, but not always. e.g. imagine a cannonball launched from the ground at an angle - how many times does it reach a certain height above the ground? – meowgoesthedog Jul 30 '18 at 23:19
  • @DanArrick I suspect the way to deal with some variable being zero is to take the limit of the expression as that variable goes to zero. – Robert Dodier Jul 30 '18 at 23:44
  • Thanks all. Interesting idea @robert-dodier, I wonder if JavaScript is doing the limits.. I noticed that some divide by 0 answers evaluate to infinity or -infinity – Dan Arrick Jul 31 '18 at 03:43
  • @DanArrick If some expressions are undefined for something = 0, my guess is that there are other things that are going to zero and the whole expression will turn out to be well-defined. I haven't looked into that in detail, that's just a guess. You might have to go back to the original expression (I'm guessing an equation which expresses conservation of potential and kinetic energy) from which all of these equations are derived in order to substitute some terms = 0 and go from there. – Robert Dodier Jul 31 '18 at 16:39

2 Answers2

0

First of all the equations are accurate.

Then, looking at these equations, there are two boundary conditions where acceleration can be zero (a=0) or time elapsed can be zero(t=0) for which you have to add special cases to avoid divide by zero errors.

  1. if a = 0; then s = ut, v = u
  2. if t = 0; then s = 0, u,v,a = undefined (cannot determine the acceleration or velocity)
  3. For your second equation, you can calculate time that way or using this: t = (Math.sqrt(u*u + 2*a*s) - u)/a
  4. You can avoid multiple answers using the above equation and the following in 4th case: t = (v - Math.sqrt(v*v - 2*a*s))/a

Hope this helps.

Kaushik
  • 133
  • 13
0

These all look correct from what I've checked.

Equation 2 in row 2:

-u/a +/- sqrt(2*a*s + u^2)/a

does make sense to have 2 possible values.

If you think about it, this equation is saying: given the current position, acceleration, and starting velocity, what is the time. Note: the acceleration and starting velocity don't change with respect to time.

Since SUVAT motion is parabolic, there will usually be 2 solutions for a given position.

View this example image

In the above image, the parabola represents the position over time. The horizontal line represents the given position. The shape of the parabola is determine by the given acceleration and starting velocity. As you can see, there are 2 spots where the given position intersects the parabola, marked with vertical lines.