(12C Platinum) Length of An Ellipse
|
07-07-2019, 05:44 AM
(This post was last modified: 07-07-2019 05:47 AM by Gamo.)
Post: #1
|
|||
|
|||
(12C Platinum) Length of An Ellipse
Calculate the Length of an ellipse according to this series formula:
------------------------- Example: FIX 5 a = 50 b = 10 50 [ENTER] 10 [R/S] display 210.08595 ------------------------ Program: RPN mode: "Program run this formula in three terms" Code: Gamo |
|||
07-07-2019, 10:35 AM
Post: #2
|
|||
|
|||
RE: (12C Platinum) Length of An Ellipse
Attached a number of approximations & infinite series to calculate the perimeter of an Ellipse.
Denny Tuckerman |
|||
07-07-2019, 04:06 PM
Post: #3
|
|||
|
|||
RE: (12C Platinum) Length of An Ellipse
(07-07-2019 05:44 AM)Gamo Wrote: Program: RPN mode: "Program run this formula in three terms" ... You might consider Ramanujan's approximation, less code and almost 2 extra terms! Replace steps 011-031 with this: Quote:011 Enter Using your example, a=50, b=10, FIX 5, we get ellipse perimeter = 210.10028, absolute error = -0.00017 |
|||
07-08-2019, 04:51 AM
Post: #4
|
|||
|
|||
RE: (12C Platinum) Length of An Ellipse
Thanks Albert Chan
That formula is much simple as stated in the link "The simplest formula possible for the circumference of a general ellipse" Gamo |
|||
07-08-2019, 02:53 PM
Post: #5
|
|||
|
|||
RE: (12C Platinum) Length of An Ellipse
(07-07-2019 04:06 PM)Albert Chan Wrote: a=50, b=10, FIX 5, we get ellipse perimeter = 210.10028, absolute error = -0.00017 FYI, absolute error based on ellipse perimeter AGM2 method: (50, 10) repeated AGM: → (30 , √(500) ≅ 22.36067977), gap = 7.63932023 → (26.18033989, 25.90020064), gap = 0.28013825 → (26.04027027, 26.03989355), gap = 0.00037672 → (26.04008191, 26.04008191) effective radius = (30² - (0.5)(7.63932023²) - (1)(0.28013825²) - (2)(0.00037672²)) / 26.04008191 = 33.43852445 ellipse perimeter = 2 * pi * 33.43852445 = 210.1004455 ≅ 210.10045 |
|||
07-23-2019, 05:06 PM
(This post was last modified: 07-23-2019 05:35 PM by John Keith.)
Post: #6
|
|||
|
|||
RE: (12C Platinum) Length of An Ellipse
I have tried several of these methods and I believe that Ramanujan's approximation is the clear winner. It gives 6 - 9 digits of accuracy for reasonable ellipses and is small and fast. For exact solutions, Albert's AGM2 program is fastest by far, almost 200* as fast as numerical integration on the HP 50! The Gauss-Kummer infinite series (series 2 from the PDF in post #2) looks good but the terms are very slow to compute and the program is large and complicated.
At the risk of trolling this thread I am posting HP-48 versions of the programs for those who may be interested. Ramanujan: Code:
For the HP 50, ROT ROT can be replaced by UNROT. AGM2: Code:
This is just a straightforward translation of Albert's Lua code which could be made smaller and faster by moving local variables to the stack at the cost of readability (and effort!). |
|||
01-16-2020, 10:18 PM
(This post was last modified: 01-18-2020 01:04 AM by Albert Chan.)
Post: #7
|
|||
|
|||
RE: (12C Platinum) Length of An Ellipse
For ellipse perimeter using integrals, we can use Weierstrass Substitution.
\(t = \tan(x/2)\quad\quad\quad → dt = sec^2(x/2)/2\;dx\quad\quad\quad\quad\quad\quad \; → dx = \left({2\over 1+t^2}\right)\;dt \) Ellipse perimeter = \(4a \int _0 ^{\pi \over 2} \sqrt{1 - e^2\sin^2 x}\;dx = 4a \int _0 ^1 \sqrt{1 - e^2\left({2t \over 1+t^2}\right)^2} \left({2\over 1+t^2}\right)\;dt \) Example, Casio FX-115ES Plus, a=50, b=10 → e² = 1-(b/a)² = 24/25 Perimeter = 210.100445396890 // 4*50*EllipticE(24/25) dx integral = 210.100445053320 // time = 4.0 sec dt integral = 210.100445398816 // time = 2.8 sec Turns out dx integral work better with simple Trapezoidal rule ! John D Cook's blog: Three surprises with the trapezoid rule Quote:2. Although the trapezoid rule is inefficient in general, it can be shockingly efficient for periodic functions. Redo above example for ellipse perimeter. (n = number of trapezoids) Code: n dx trapezoid dx simpson dx romberg |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)