Started by Aug 23 2012 04:39 PM

,
9 replies to this topic

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?

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?

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

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!

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.

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)]

*“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”*

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?

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?

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

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):

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.

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.**

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

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

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

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.