View Full Version : numerical computation contest
A diversion, for anyone so inclined.
Jon Stratis
14-12-2012, 15:24
Does the answer have to be completely numerical, or can it contain known variables/equations (for example, could I say pi/8 versus 0.392699..., or 2*sin (1) were either of those the actual answer. Disclaimer: I have done no math at this point, and I highly doubt that I randomly picked the answer :P)
Does the answer have to be completely numerical, or can it contain known variables/equations (for example, could I say pi/8 versus 0.392699..., or 2*sin (1) were either of those the actual answer. Disclaimer: I have done no math at this point, and I highly doubt that I randomly picked the answer :P)
Looking for a numerical answer, in decimal form. Winner is person who gets answer correct to the most decimal digits.
edit:
If you can find an exact explicit closed-form analytical solution using only add, subtract, multiply, divide, powers, roots, exponentiation, logarithms, trig functions, and inverse trig functions, you will be declared the winner.
I believe the answer is 44.4984550191007992545541 feet
(although I used a "wolfram alpha method":) , not an analytic one to solve the equation)
Christopher149
14-12-2012, 15:53
Is this close?
h = (in ft)
44.49845501910079925455416001673359894996896435222 95612116880595546581686999560519753347236106529250 14422691969000110577445163659978002373921158891281 96107912233956035279094688973264141285038352833979 92808923081071616667853526325563707812597289771290 34979416624799668990733212350734392869697893501318 89111943559177977405431271912121416410363234025409 52753032492871047810149624788135594125012352228840 06058879524106347465534347539833791041297948729285 69084156937833895515653679687331260207084213606326 0
Is this close?
h = (in ft)
44.49845501910079925455416001673359894996896435222 95612116880595546581686999560519753347236106529250 14422691969000110577445163659978002373921158891281 96107912233956035279094688973264141285038352833979 92808923081071616667853526325563707812597289771290 34979416624799668990733212350734392869697893501318 89111943559177977405431271912121416410363234025409 52753032492871047810149624788135594125012352228840 06058879524106347465534347539833791041297948729285 69084156937833895515653679687331260207084213606326 0
The arc is only one foot longer than the chord. How could the answer possibly be larger than one?
EDIT: Anyway, here is my work. SPOILERS!
/http://i.imgur.com/2IYR8.png (http://i.imgur.com/2IYR8.png)
So my guess is zero. It's not exact, but close.
Is this close?
h = (in ft)
44.49845501910079925455416001673359894996896435222 95612116880595546581686999560519753347236106529250 14422691969000110577445163659978002373921158891281 96107912233956035279094688973264141285038352833979 92808923081071616667853526325563707812597289771290 34979416624799668990733212350734392869697893501318 89111943559177977405431271912121416410363234025409 52753032492871047810149624788135594125012352228840 06058879524106347465534347539833791041297948729285 69084156937833895515653679687331260207084213606326 0
Close enough. Tell the folks how you did it.
Jon Stratis
14-12-2012, 16:37
The arc is only one foot longer than the chord. How could the answer possibly be larger than one?
Create a simple approximation. Imagine a point C that lies at the top of the line H. You can then create a triangle ABC, where length AB is known (5280 ft) and length BC = AC = 5281/2 = 2640.5.
We know that h bisects line AB - lets call the intersection between AB and h to be H. we know that the length AH = BH = 5280/2 = 2640.
So, now we know two sides to the right triangle AHC - AH and AC. Taking the square of the hypotenuse minus the square of one side gives us the square of the other side. In other words, 2640.5^2 - 2640^2 = h^2 (the pythagorean theorem).
So, in this extremely rough approximation, we get h = 51.383. Given that, it's not hard to imagine that Christopher's answer could be correct, to some number of decimal places.
Create a simple approximation. Imagine a point C that lies at the top of the line H. You can then create a triangle ABC, where length AB is known (5280 ft) and length BC = AC = 5281/2 = 2640.5.
We know that h bisects line AB - lets call the intersection between AB and h to be H. we know that the length AH = BH = 5280/2 = 2640.
So, now we know two sides to the right triangle AHC - AH and AC. Taking the square of the hypotenuse minus the square of one side gives us the square of the other side. In other words, 2640.5^2 - 2640^2 = h^2 (the pythagorean theorem).
So, in this extremely rough approximation, we get h = 51.383. Given that, it's not hard to imagine that Christopher's answer could be correct, to some number of decimal places.
Thanks!
it's not hard to imagine that Christopher's answer could be correct, to some number of decimal places.
498 decimal places :)
I checked them. They appear to be correct.
Christopher149
14-12-2012, 16:56
Close enough. Tell the folks how you did it.
Since this is a circular arc, I start with a circle. Based off of a diagram like this (http://en.wikipedia.org/wiki/File:Circle-trig6.svg), I draw a triangle and take theta to be as is shown in that picture. From the right triangle, we know radius * sin(theta) = 5280 / 2. From the definition of arc length, we also know that radius * 2 * theta = 5281. We have two equations and two unknowns, so I substituted one into the other and let Mathematica determine theta. From theta, we easily get the radius. Next, we use this equation (http://en.wikipedia.org/wiki/Circle#Sagitta) relating chord length and the height to the radius. Again, I let Mathematica handle the equation to a ridiculous number of decimal places.
Mathematica Code
Clear[t, h, r, c, a]
c = 5280
a = 5281
t = t /.
FindRoot[a/(2 t) * Sin[t] == c/2, {t, 1.8},
AccuracyGoal -> 100000, PrecisionGoal -> 100000,
WorkingPrecision -> 500]
r = a/(2 t)
FindRoot[r == c^2/(8 h) + h/2, {h, 100}, AccuracyGoal -> 100000,
PrecisionGoal -> 100000, WorkingPrecision -> 500]
EDIT: I can get more decimal places ... :)
I was bored and tried to find a closed form by hand, it didn't work out by the time I refreshed it and it was over :p
http://i.imgur.com/RDi2ol.jpg
Mathematica Code
Clear[t, h, r, c, a]
c = 5280
a = 5281
t = t /.
FindRoot[a/(2 t) * Sin[t] == c/2, {t, 1.8},
AccuracyGoal -> 100000, PrecisionGoal -> 100000,
WorkingPrecision -> 500]
r = a/(2 t)
FindRoot[r == c^2/(8 h) + h/2, {h, 100}, AccuracyGoal -> 100000,
PrecisionGoal -> 100000, WorkingPrecision -> 500]
Here's Maxima code:
fpprec: 600$
L:5280$ eps:1$
y: x/sin(x)-(L+eps)/L$
a: bf_find_root(y,x,1/1000,4/100);
h: (L/2)*(1-cos(a))/sin(a);
EDIT: I can get more decimal places ... :)
So can I :)
Maxima 5.27.0 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
(%i1) fpprec: 600$
L:5280$ eps:1$
y: x/sin(x)-(L+eps)/L$
a: bf_find_root(y,x,1/1000,4/100);
h: (L/2)*(1-cos(a))/sin(a);
4.449845501910079925455416001673359894996896435222 9561211688059554658168\
69995605197533472361065292501442269196900011057744 5163659978002373921158891281\
96107912233956035279094688973264141285038352833979 9280892308107161666785352632\
55637078125972897712903497941662479966899073321235 0734392869697893501318891119\
43559177977405431271912121416410363234025409527530 3249287104781014962478813559\
41250123522288400605887952410634746553434753983379 1041297948729285690841569378\
33895515653679687331260207084213606326025818227820 1500825791387457906343098887\
92585902813527839515398426107519229168847321404898 64979154825b1
(%i7)
Christopher149
14-12-2012, 17:28
4.449845501910079925455416001673359894996896435222 9561211688059554658168\
69995605197533472361065292501442269196900011057744 5163659978002373921158891281\
96107912233956035279094688973264141285038352833979 9280892308107161666785352632\
55637078125972897712903497941662479966899073321235 0734392869697893501318891119\
43559177977405431271912121416410363234025409527530 3249287104781014962478813559\
41250123522288400605887952410634746553434753983379 1041297948729285690841569378\
33895515653679687331260207084213606326025818227820 1500825791387457906343098887\
92585902813527839515398426107519229168847321404898 64979154825b1
(%i7)
4.4498 ... I thought it was 44.498 ... ;)
4.4498 ... I thought it was 44.498 ... ;)
Um... The exponent is at the end of those 600 digits :)
Richard Wallace
14-12-2012, 20:34
Russ,
I understand you intended this one as a programming exercise -- hence you posted it in the programming forum.
However, it can also serve as an example of engineering approximation. Jon showed earlier how the Pythagorean theorem gives 51.48 ft as a rough approximation.
For a slightly better one, I used the Taylor series expansion for the sinc function, defined as sinc(x) = sin(x)/x. The first two terms of that expansion are:
sinc(x) = 1 - (x^2)/6 + ....
The arc length is 2rx and the chord length is 2rsin(x), where 2x is the angle subtended by the arc. Since the chord is one mile long and the arc is one foot longer, we have:
sinc(x) = 5280/5281
and the truncated series approximation above gives
x = sqrt(6/5281) = 0.03371 radians, or about 1.931 degrees.
Then the arc is part of a circle with perimeter
(5281/5280) x (180/1.931) = 93.23 miles,
so the radius r is 14.84 miles [this is a very flat arc!]
and the height h is 14.84 x (1 - cos(x)) miles = 44.49 ft.
Back in the day, engineers without benefit of cheap computers could have gotten this close using slide rules; i.e., four figures.
Excellent post Richard.
You anticipated where I was going to take this.
DampRobot
14-12-2012, 23:23
Ether,
I'm not a programmer, but I love a good geometrical challenge.
The equations I came up with were: (r-h)sin(l/2r)=x/2 and 2rsin(l/2r)=(x^2/4+h^2)^1/2
where r was the radius of the curve, h was the height specified in your diagram, l was the length of the curve, and x was the length of the chord. To find the numerical solution, input values for l and x, and solve for h or r.
Was the "challenge" to write a program that found the solutions of these functions through guess and check? Or did I come up with a different solution? Plugging in the values on this thread with my trusty graphing calculator, I got a reasonable approximation of the answers posted on this thread.
Tom Line
14-12-2012, 23:28
Ether,
I'm not a programmer, but I love a good geometrical challenge.
The equations I came up with were: (r-h)sin(l/2r)=x/2 and 2rsin(l/2r)=(x^2/4+h^2)^1/2
where r was the radius of the curve, h was the height specified in your diagram, l was the length of the curve, and x was the length of the chord. To find the numerical solution, input values for l and x, and solve for h or r.
Was the "challenge" to write a program that found the solutions of these functions through guess and check? Or did I come up with a different solution? Plugging in the values on this thread with my trusty graphing calculator, I got a reasonable approximation of the answers posted on this thread.
Even getting a reasonable approimation is good enough, because there is no exact answer. I simplified until I ended up with a formula that looked something like this:
sin (theta/2) = (theta * Arc) / (2 * chord length)
With theta being the angle inside the two radii that would have gone from the center of the circle to the end of the cords.
That can only be solved iteratively, graphically, or by a lookup table (for those of us who remember not having calculators....)
Once you have theta, the height is trivial.
Was the "challenge" to write a program that found the solutions of these functions through guess and check?
There is no explicit solution so you have to use iteration.
For folks like Christopher149 who know how to use modern math tools like Mathematica this is very simple to do, and you can get answers of arbitrary precision.
Mathematica is very expensive, but there are free CAS (Computer Algebra System) tools like Maxima which anybody can download and install for free. Maxima can also solve this problem with arbitrary precision (see my earlier post where I used Maxima to get 600 digits).
Attached are:
- The derivation of the equations
- A simple Delphi console app code which uses a binary search to find theta
If you replace sin(theta)/theta - 5280/5281 with a 12th degree Taylor expansion (http://www.chiefdelphi.com/forums/attachment.php?attachmentid=13302&stc=1&d=1355554177) (see Richard's earlier post about Taylor expansion), you can squeeze out 16 decimal digits of accuracy with this simple code using Intel's X86 Extended Precision (http://en.wikipedia.org/wiki/Extended_precision#x86_Extended_Precision_Format) floats
This reminds me of a chapter in one of my favorite books:
The History of PI (http://www.amazon.com/A-History-Pi-Petr-Beckmann/dp/0312381859/ref=sr_1_1?ie=UTF8&qid=1355593500&sr=8-1&keywords=the+history+of+PI)
Specifically, you guys are reminding me of chapter 10, "The Digit Hunters".
I am very impressed. Happy hunting.
The equations I came up with were: (r-h)sin(l/2r)=x/2 and 2rsin(l/2r)=(x^2/4+h^2)^1/2
where r was the radius of the curve, h was the height specified in your diagram, l was the length of the curve, and x was the length of the chord.
I think you made a mistake somewhere along the way. Those equations don't look correct.
x/2 = rsin(l/2r), not (r-h)sin(l/2r)
and
2rsin(l/r) = x, not (x^2/4+h^2)^1/2
I believe the answer is 44.4984550191007992545541 feet
(although I used a "wolfram alpha method":) , not an analytic one to solve the equation)
Sorry, I completely overlooked your post !
You were the first to get a correct answer.
Would you please post you work?
Alpha Beta
15-12-2012, 18:20
Sorry, I completely overlooked your post !
You were the first to get a correct answer.
I don't think you overlooked it. There seems to be a delay in people getting their first couple of posts published when they are new to the forum. The awkward thing is those posts then sneak back into the list of posts in the spot they were written at. Easy to miss them completely if a lot of posts have been written in the mean time.
...those posts then sneak back into the list of posts in the spot they were written at.
Aha. So I'm not losing my mind (yet).
sin (theta/2) = (theta * Arc) / (2 * chord length)
That should be sin (theta/2) = (theta * chord) / (2 * arc)
Just for fun, here's a graph (http://www.chiefdelphi.com/forums/attachment.php?attachmentid=13314&stc=1&d=1355700630) showing the behavior of the 2nd, 4th, 6th, and 8th degree Taylor approximations for the sinc function from zero to 3pi/2 radians.
Here's Maxima code (http://www.chiefdelphi.com/forums/attachment.php?attachmentid=13313&stc=1&d=1355697847) to generate the graph.
Maxima (http://maxima.sourceforge.net/) is free software with an active and helpful mailing list.
Richard Wallace
16-12-2012, 18:38
Just for fun, here's a graph ...
It would be interesting to see a graph comparing the 2nd, 4th, 6th, and 8th order expansions of 1 - sinc(x) plotted vs. x, for 0 < x < 0.05. The range of most interest will be near 1/5280 .... ;)
I'd do it myself, but have been unable to locate Maxima as an iPad app (yet).
It would be interesting to see a graph comparing the 2nd, 4th, 6th, and 8th order expansions of 1 - sinc(x) plotted vs. x, for 0 < x < 0.05. The range of most interest will be near 1/5280 .... ;)
... or 1/5281 :)
sin(θ)/θ = 5280/5281 = 1 - 1/5281 => 1 - sin(θ)/θ = 1/5281
The Taylor expansions (even the 2nd degree one) are so accurate over the range 0<x<0.05 that you can't see the difference on the graph at that scale. Which maybe was your point :)
Also attached is the 64 decimal digit precision computation of θ using the zero of the function y = 5280/5281 - sin(θ)/θ and its Taylor expansions.
Finally, notice that the Taylor8 expansion actually gives a more accurate answer than the original function itself, when using only 16 digit precision. Presumably, this is because Taylor8 is numerically more stable.
This whole thread reminds me of an easy (for you all) geometry question. Imagine a sphere the diameter of the Earth. Add to that a belt around the equator that has no space between it and the surface of the sphere. By how much must the length of that belt be increased to allow a playing card to be slipped underneath the belt at all points along it?
This whole thread reminds me of an easy (for you all) geometry question. Imagine a sphere the diameter of the Earth. Add to that a belt around the equator that has no space between it and the surface of the sphere. By how much must the length of that belt be increased to allow a playing card to be slipped underneath the belt at all points along it?
That problem has a simple explicit closed-form solution.
C = pi*d
C' = pi*d' = pi*(d+2t)
C'-C = pi*(d+2t) - pi*d = pi*2t
... where "t" is the thickness of the card.
Richard Wallace
16-12-2012, 21:23
Actually this problem is considerably more practical:
Imagine a steel rail one mile long, pinned to earth at points A and B one mile apart. The rail is warmed by about thirty Fahrenheit degrees, so that it elongates by one foot, causing it to deform from its original straightness into a circular arc. How far does the arc deviate from the original line, at a point halfway between A and B?
That problem has a simple explicit closed-form solution.
C = pi*d
C' = pi*d' = pi*(d+2t)
C'-C = pi*(d+2t) - pi*d = pi*2t
... where "t" is the thickness of the card.
I told you it was easy! What usually hangs fledgling geometers is the "2t" to allow the card under on both sides of the sphere. Everyone else just guesses "big" numbers because the sphere is so big.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.