Post Reply 
Hypergeometric function – Perimeter of an Ellipse and other applications (wp34s)
01-11-2020, 01:20 AM (This post was last modified: 01-13-2020 02:59 AM by Gerson W. Barbosa.)
Post: #6
RE: Hypergeometric function – Perimeter of an Ellipse and other applications (wp34s)
This new approximation formula involving AGM is more accurate than the previous one:


p ≈ 2π{agm(a,b)[77h⁴ - 768(h² - 1)] - [54h⁴ - 512(h² - 1)]√(ab)}/[23h⁴ - 256(h² - 1)]

where h = [(a - b)/(a + b)]

wp34s program:

001:LBL A
002:©ENTER
003:STO- Y
004:RCL+ T
005:/
006:x²
007:STO I
008:STO× I
009:DEC X
010:# 128
011:STO+ X
012:×
013:⇆ ZYXY
014:AGM
015:RCL L
016:RCL× T
017:√
018:# 054
019:RCL× I
020:RCL- T
021:RCL- T
022:×
023:# 077
024:RCL× I
025:RCL- T
026:RCL- T
027:RCL- T
028:RCL× Z
029:-
030:R↑
031:# 023
032:RCL× I
033:-
034:/
035:STO+ X
036:# π 
037:×  
038:RTN


Let’s try it with some examples:

9 ENTER 8 A -> 53.453285002971875533(62066)

9 ENTER 7 A -> 50.46202449950552(54160)

9 ENTER 6 A -> 47.596318767871(06954)

9 ENTER 4 A -> 42.36559853(28349)

9 ENTER 3 A -> 40.094679(4402)

9 ENTER 2 A -> 38.155(3995)

9 ENTER 1 A -> 36.68(6938)



Halley’s comet orbit:

a = 2667950000 km
b = 678281900 km

p ≈ 11464317964.011670 km
p = 11464318984.102995 km

difference: 1020.091 km


Let’s compare it with Ramanujan’s second approximation:

p ≈ π(a + b){1 + 3h²/[10 + √(4 - 3h²)]}

where h = [(a - b)/(a + b)]


039:LBL B
040:⇆ XYYZ
041:STO+ Z
042:-
043:RCL/ Y
044:x²
045:# 003
046:×
047:SDR 001
048:# 004
049:RCL- L
050:√
051:SDR 001
052:INC X
053:/
054:INC X
055:×
056:# π
057:×  
058:END


9 ENTER 8 B -> 53.45328500297187(49239)

9 ENTER 7 B -> 50.46202449950(44277)

9 ENTER 6 B -> 47.596318767(75370)

9 ENTER 4 B -> 42.365598(45195)

9 ENTER 3 B -> 40.09467(8339)

9 ENTER 2 B -> 38.155(3915)

9 ENTER 1 B -> 36.687(5063)



Halley’s comet orbit:

a = 2667950000 km
b = 678281900 km

p ≈ 11464316399.11117 km
p = 11464318984.10300 km

difference: 2584.992 km


As the ellipse becomes more and more eccentric Ramanujan’s formula will eventually give smaller errors when compared to the AGM approximation, but overall the latter is better, at the cost of more complexity. For calculators with built-in AGM like the wp34s, that should be an option when Hypergeometric function is not available.

——-

PS: 01-13-2020, 02:59 AM

Here’s yet another approximation for the perimeter of the ellipse. It’s a bit less accurate than the previous one, but no square root is required, only basic arithmetic operations.

p ≈ π{(a + b)[h²(3h² - 136) + 320] + [a b/(a + b)](96h² - 256)}/[h²(3h² - 112) + 256]

where h = [(a - b)/(a + b)]


wp34s program:

001:LBL A
002:©ENTER
003:STO-Y
004:RCL+ T
005:/
006:x²
007:STO I
008:R↓
009:||
010:RCL L
011:RCL+ Z
012:# 003
013:RCL× I
014:# 136
015:-
016:RCL× I
017:# 160
018:+ 
019:RCL+ L
020:×
021:# 096
022:RCL× I
023:# 128
024:STO+ X
025:-
026:RCL× Z
027:+
028:# 003
029:RCL× I
030:# 112
031:-  
032:RCL× I
033:# 128
034:+ 
035:RCL+ L
036:/
037:# π  
038:×
039:END


9 ENTER 8 A -> 53.45328500297187(21835)

9 ENTER 7 A -> 50.462024499(4995106)

9 ENTER 6 A -> 47.596318767(23094)

9 ENTER 4 A -> 42.365598(09087)

9 ENTER 3 A -> 40.09467(3044)

9 ENTER 2 A -> 38.155(3243)

9 ENTER 1 A -> 36.68(6589)



Halley’s comet orbit:

a = 2667950000 km
b = 678281900 km

p ≈ 11464306668.94052 km
p = 11464318984.10299 km

difference: 12315.162 km
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Hypergeometric function – Perimeter of an Ellipse and other applications (wp34s) - Gerson W. Barbosa - 01-11-2020 01:20 AM



User(s) browsing this thread: 2 Guest(s)