Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Calculating height of parabola, based on base width and arc length


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
9 replies to this topic

#1 VladimirM   Members   -  Reputation: 130

Like
0Likes
Like

Posted 23 August 2012 - 04:39 PM

this is the formula for the arc length of a parabola 0.5√16h²+w² + [w²/(8h)][Ln(4h + √16h²+w²) - Ln(w)], from http://www.had2know.com/academics/parabola-segment-arc-length-area.html ., if i know the arc length and the base width, how can i find the height?

I've tried solving for h, using wolfram alpha and mathematica, both failed... said it cant be solved, But there must be a way? It's mathematics, everything is possible, right? :)

Sponsor:

#2 Radikalizm   Crossbones+   -  Reputation: 2943

Like
0Likes
Like

Posted 23 August 2012 - 05:07 PM

Why don't you take the original equation for your parabola and calculate the height from there?

You can do this with good ol' calculus by finding the extrema for the equation by calculating all zero-values for the first derivative of your equation within your given range. You can then use the second derivative to determine whether each extremum is a local maximum, a local minimum or an inflection point.

Since you're working with a parabola you'll only find one extremum which will be the x-value for your highest point. Evaluate this x in your original function and you'll get your height.

EDIT:

Easier yet, if your parabola is of the form y = a*x^2 + b, where a < 0 (otherwise you can't find a maximum) then your height is simply the value of b

Edited by Radikalizm, 23 August 2012 - 05:15 PM.

I gets all your texture budgets!


#3 VladimirM   Members   -  Reputation: 130

Like
0Likes
Like

Posted 23 August 2012 - 08:01 PM

the base width of my parabola varies (the distance between x1 and x2), between some value q and 0, the thing is that i need the arc length to always be equal to q, I am modeling a spring that when compressed bends like a parabola, so when the spring compresses to a smaller length than its rest length q, i must maintain the length by bending it. and in order to bend it to a certain arc length (q), i must calculate the height every time the base width changes.

#4 Bacterius   Crossbones+   -  Reputation: 9098

Like
1Likes
Like

Posted 23 August 2012 - 10:13 PM

L = 0.5√16h²+w² + [w²/(8h)][Ln(4h + √16h²+w²) - Ln(w)]

This equation cannot be rearranged in terms of height with elementary algebra, because it has the both inside and outside a transcendental function (here ). You can write it out as a closed-form recursive process or a recurrence and then approximate it numerically (or directly approximate it via Newton-Raphson with two variables) - wouldn't know how to do it right then though, sorry.

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


#5 VladimirM   Members   -  Reputation: 130

Like
0Likes
Like

Posted 24 August 2012 - 06:08 AM

I have no idea how to do any of those things you mentioned, i just finished high school my knowledge of math is limited.. Is there some software that does these approximations or do i have to try and do it myself?

#6 Bacterius   Crossbones+   -  Reputation: 9098

Like
0Likes
Like

Posted 24 August 2012 - 06:13 AM

So if I understand you correctly, you need to keep the length of the parabolic arc constant, while modifying its base width, so you need to obtain the correct height for it to have the same length?

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


#7 VladimirM   Members   -  Reputation: 130

Like
0Likes
Like

Posted 24 August 2012 - 05:52 PM

So if I understand you correctly, you need to keep the length of the parabolic arc constant, while modifying its base width, so you need to obtain the correct height for it to have the same length?


exactly

#8 Bacterius   Crossbones+   -  Reputation: 9098

Like
0Likes
Like

Posted 24 August 2012 - 06:04 PM

OK, I think I got it. I would expect the length of the parabola to increase monotonically as the height increases, for a same base width. In this case, you can use good old bisection. This will allow you to converge on the correct height required to obtain a given arc length, knowing the base width. I would expect the algorithm to converge pretty quickly on the solution, which means it should be fast if you only need, say, 5 digits of precision, but I can't say anything about performance. I believe it would be correct though.

The code would look something like this (may have some edge cases but it's the idea):

input: base length W, required length L.
output: approximate correct H such that Length(W, H) = L

1. Let lo = 0, hi = 4h + c (twice the limit form plus some constant, try various c)
2. Compute H_mid = (lo + hi) / 2
3. Compute L' = Length(W, H_mid)
4. If L' < L, let lo = H_mid and goto 2
5. If L' > L, let hi = H_mid and goto 2
6. If L' is close to L, return H_mid

Though note that if arc length doesn't strictly increase with height with constant base width as I think it does, this might not work.

EDIT:

If w is a constant, then:

O(0.5√16h²+w² + [w²/(8h)][ln(4h + √16h²+w²) - ln(w)]) = O(0.5√16h² + [1/(8h)][ln(4h + √16h²)]) = O(2h + ln(8h)/(8h)) = O(2h + ln(8h)/(8h))

Which tends to 2h in the limit, so the arc length does increase monotonically with h, this should work.

You can also use Newton-Raphson instead by differentiating (have you seen this method at high school?), it would converge faster but each iteration takes more work, and the differentiated expression may not be so nice to compute.

Edited by Bacterius, 24 August 2012 - 11:24 PM.

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


#9 Postie   Members   -  Reputation: 1083

Like
0Likes
Like

Posted 24 August 2012 - 10:50 PM

Just out of interest, how is the parabola being used? If you're talking about the motion of a projectile under the force of gravity, there are other equations you can use that are more suited to the task.
Currently working on an open world survival RPG - For info check out my Development blog: ByteWrangler

#10 VladimirM   Members   -  Reputation: 130

Like
0Likes
Like

Posted 28 August 2012 - 08:21 AM

Thanks bacterius, i aproximated it using taylor series but it only worked for a small arc length to base width ratio, so the good old bisection is what i will settle for :)

Just out of interest, how is the parabola being used? If you're talking about the motion of a projectile under the force of gravity, there are other equations you can use that are more suited to the task.


I have springs that compress, and i want to keep their length constant so i bend them accordingly when they compress.




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