Perimeter of the Ellipse (HP-15C) - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Perimeter of the Ellipse (HP-15C) (/thread-17003.html) Pages: 1 2 |
RE: Perimeter of the Ellipse (HP-15C) - Gerson W. Barbosa - 06-04-2021 10:47 PM Thank you very much, C.Ret, for the HP-15C version! The HP-15C was my first calculator and I am supposed to know how to program it, yet I had no idea on how to start. The results almost exactly match my latest table, except for 1, 2 or 3 ULPs. There was only one result with a 5-ULP difference, but it turned out to be still close to the actual result, but on the other side. Only about 8 seconds on my HP-15C, purchased brand-new in ‘83 or ‘84. As a comparison, one AGM iteration takes 2.5 seconds, but then again my program might not be nearly as optimized as it could. RE: Perimeter of the Ellipse (HP-15C) - C.Ret - 06-05-2021 12:31 AM Code: 001- ►LBL E RE: Perimeter of the Ellipse (HP-15C) - ijabbott - 06-05-2021 10:31 AM I found this paper that uses a modified AGM (MAGM) sequence. It may be of interest to some people (expecially Albert Chan if he hasn't already seen it!). An Eloquent Formula for the Perimeter of an Ellipse Semjon Adlaj RE: Perimeter of the Ellipse (HP-15C) - C.Ret - 06-05-2021 03:40 PM Thank a lot for the publication reference. I was wandering what AGM stand for and I was at the point asking for explanations. Through this instructive reading, I have now the good definitions and explanations of what are AGM and MAGM. That all I need for a better understanding on how my program works ! RE: Perimeter of the Ellipse (HP-15C) - Gerson W. Barbosa - 06-05-2021 08:00 PM (06-04-2021 06:12 PM)Gerson W. Barbosa Wrote: ——————— While this forces an exact result for y = 0, it only spoils the other results. The same happens when the 1/3 constant is used. A better option for both 10 and 12-digit results is to discard even the 1/3 constant: p(a, b) ~ π(a - b)(y + 1/(4y - 1/(4y - 3/(4y - 3/(4y - 11/(12y - (4/(2y - 1)))))))) Code:
In C.Ret’s program just delete the steps 16 through 18 [ 3 1/x + ]. RE: Perimeter of the Ellipse (HP-15C) - Albert Chan - 06-05-2021 10:35 PM (06-05-2021 08:00 PM)Gerson W. Barbosa Wrote: A better option for both 10 and 12-digit results is to discard even the 1/3 constant: Try replacing last constant 1 as (19/18)/y. This keep rel error below 1 ppm, well until h = ((a-b)/(a+b))^2 > 0.9616 RE: Perimeter of the Ellipse (HP-15C) - C.Ret - 06-06-2021 07:07 AM (06-05-2021 08:00 PM)Gerson W. Barbosa Wrote: A better option for both 10 and 12-digit results is to discard even the 1/3 constant: (06-05-2021 10:35 PM)Albert Chan Wrote: Try replacing last constant 1 as (19/18)/y. This keep rel error below 1 ppm, well until h = ((a-b)/(a+b))^2 > 0.9616 Code: 001- ►LBL E \( P(a,b)\approx\pi(a-b)(y+1/(4y-1/(4y-3/(4y-3/(4y-11/(12y-(4/(2y-19/18y)))))))) \) \( P(a,b)\approx\pi(a-b)\frac{110592y^8-122880y^6+18704y^4+7488y^2-627}{110592y^7-150528y^5+54608y^3-4244y} \) with \( y=\frac{a+b}{a-b} \) \( P(a,b)\approx\pi(a+b)\frac{110592-122880h+18704h^2+7488h^3-627h^4}{110592-150528h+54608h^2-4244h^3} \) with \( h=\left(\frac{a-b}{a+b}\right)^2 \) Code: a b P(a,b) Calc'Lap 7 DATA 19,18, 4,2, 11,12, 3,4, 3,4, 1,4, 1,4 10 INPUT "Elps Radii A,B ";A,B @ IF A<>B THEN Y=(A+B)/(A-B) ELSE P=2*PI*A @ GOTO 30 20 C=0 @ FOR I=1 TO 7 @ READ N,D @ C=N/(D*Y-C) @ NEXT I @ P=PI*(A-B)*(Y+C) 30 DISP USING 40;A,B,P 40 IMAGE "P("K",",K")=",4D.8D RE: Perimeter of the Ellipse (HP-15C) - Gerson W. Barbosa - 07-14-2021 11:34 PM (06-05-2021 12:31 AM)C.Ret Wrote: Just for the record, here is a version of your program using three registers, by former forum member Mike (Stgt), from Jun/06. Actually, he wrote it for the HP-15C, like you did, but I prefer the HP-32S II, because it’s faster. Code:
Regards, Gerson. RE: Perimeter of the Ellipse (HP-15C) - floppy - 04-18-2023 09:24 AM (05-26-2021 11:49 AM)MeindertKuipers Wrote: Some background on the approximations for the perimeter of an ellipse, amazing video to watch (like most of this series)Remark: Parker is an "non-reference" (a bit a tik-tok math-touch video. however, took me time to come to this conclusion). Comments regarding this video page 8 of https://indico-hlit.jinr.ru/event/187/contributions/1769/attachments/543/931/SAdlaj.pdf |