**2**

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

###
#1
Members - Reputation: **130**

Posted 23 August 2012 - 04:39 PM

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?

###
#2
Crossbones+ - Reputation: **2885**

Posted 23 August 2012 - 05:07 PM

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
Members - Reputation: **130**

Posted 23 August 2012 - 08:01 PM

###
#4
Crossbones+ - Reputation: **8890**

Posted 23 August 2012 - 10:13 PM

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.L = 0.5√16h²+w² + [w²/(8h)][Ln(4h + √16h²+w²) - Ln(w)]

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*

###
#6
Crossbones+ - Reputation: **8890**

Posted 24 August 2012 - 06:13 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*

###
#8
Crossbones+ - Reputation: **8890**

Posted 24 August 2012 - 06:04 PM

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
Members - Reputation: **969**

Posted 24 August 2012 - 10:50 PM

###
#10
Members - Reputation: **130**

Posted 28 August 2012 - 08:21 AM

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.