Hypergeometric function – Perimeter of an Ellipse and other applications (wp34s)
02-08-2020, 11:17 PM (This post was last modified: 02-09-2020 01:37 AM by Gerson W. Barbosa.)
Post: #18
 Gerson W. Barbosa Senior Member Posts: 1,454 Joined: Dec 2013
RE: Hypergeometric function – Perimeter of an Ellipse and other applications (wp34s)
Here is an explanation of the (unorthodox) method I've been using to find these approximations. It is based on sheer observation rather than on complicated mathematical analysis. For example, The ratio between four times the equivalent radius and its difference from the arithmetic mean of the semi-axes is about sixteen times the inverse of the square of the h parameter (difference of the semi-axes over their sum) plus 3:

$$\frac{4r}{r-\frac{a+b}{2}}\approx \frac{16}{h^{2}}+3$$

By solving it for r we obtain

$$r \approx \frac{a+b}{2}\left ( \frac{3h^{2}+16}{16-h^{2}} \right )$$

or

$$p\approx \pi \left ( a+ b \right )\left ( \frac{3h^{2}+16}{16-h^{2}} \right )$$

(1 655 947.321 km) (Numbers attached to a length unity between parentheses here and elsewhere following a formula or program refer to the error obtained when using it to compute the perimeter of the orbit of Halley's comet).

That's Selmer's approximation from 1975 (Gauss, Landen, Ramanujan, the Arithmetic-Geometric Mean, Ellipses, π, and the Ladies Diary, page 600). This linked paper contains a derivation of Ramanujan's second approximation (page 602).

This can be carried one step further:

$$\frac{4r }{r - \frac{a+b}{2}} \approx c - \frac{1}{\frac{c-9}{3}}$$

where

$$c = \frac{16}{h^{2}}+3$$

$$r \approx \frac{a+b}{2} \left ( \frac{256-48h^{2}-21h^{4}}{256-112h^{2}+3h^{4} } \right )$$

or

$$p \approx \pi \left ( a+b \right )\left ( \frac{256-48h^{2}-21h^{4}}{256-112h^{2}+3h^{4} } \right )$$

(12 315.162 km)

That's Jacobsen's and Waadeland's approximation from 1985 (page 601 in the previously linked paper).

That can be carried even further:

$$\frac{4r }{r - \frac{a+b}{2}} \approx c - \frac{1}{\frac{c-9}{3}-\frac{1}{\frac{9d}{11}}}$$

where

$$c = \frac{16}{h^{2}}+3$$

and

$$d = \frac{\left ( \frac{16}{h^{2}}+3 \right )-9}{3 }$$

which implies

$$r \approx\left ( \frac{a+b}{2} \right )\left ( \frac{4096-2304h^{2}-224h^{4}+93h^{6}}{4096-3328h^{2}+544h^{4}-7h^{6}} \right )$$

or

$$p \approx \pi \left ( a+b \right )\left ( \frac{4096-2304h^{2}-224h^{4}+93h^{6}}{4096-3328h^{2}+544h^{4}-7h^{6}} \right )$$

(477.529 km)

-----------------

The next three formulae are not particularly useful, but they might be interesting nonetheless:

-----------------

$$p\approx \pi \left ( a+b \right )\left ( 1+\frac{1}{8h^{-2}-\frac{1}{8h^{-2}-\frac{17}{8}}} \right )^{2}$$

(23 933.122 km)

-----------------

$$p\approx 2\pi \left [ a+b- AGM\left (a-c,b+c \right ) \right ]$$

where

$$c=\left ( a-b \right )\left ( \frac{h^{2}}{16}+\frac{h^{4}}{256}+\frac{h^{6}}{4096} \right )$$

$$h=\frac{a-b}{a+b }$$

and

$$a\geqslant b$$

Code:
 0001 **LBL A 0002 x<? Y 0003 x[<->] Y 0004 [cmplx]STO A 0005 [<->] XYYZ 0006 STO+ Z 0007 - 0008 [cmplx]ENTER 0009 RCL/ Y 0010 x[^2] 0011 # 016 0012 / 0013 ENTER[^] 0014 INC X 0015 RCL[times] Y 0016 INC X 0017 [times] 0018 RCL[times] Z 0019 RCL+ A 0020 RCL B 0021 RCL- L 0022 AGM 0023 - 0024 STO+ X 0025 # [pi] 0026 [times] 0027 END

(8040.370 km)

-----------------

$$p\approx 2\pi\left ( \frac{\frac{\left ( a-b \right )^{2}}{4h\cdot AGM\left ( a,b \right )}}{1+\frac{h^{4}}{8-4h^{2}-\frac{25h^{4}}{16}-\frac{h^{6}}{\frac{32}{9}-\frac{9h^{2}}{4}}}} \right )$$

(4754.164 km)

-----------------

It appears the best option in terms of size, speed and accuracy is the AGM method presented by Albert Chan associated with Ramanujan's second approximation, which requires no more than 35 steps on the wp34s:

Code:
 0001 **LBL A 0002 [cmplx]ENTER 0003 [times] 0004 STO I 0005 [sqrt] 0006 x[<->] T 0007 RCL+ Y 0008 R[v] 0009 AGM 0010 STO/ I 0011 x[<->] Z 0012 # 002 0013 / 0014 [<->] XYYZ 0015 STO+ Z 0016 - 0017 RCL/ Y 0018 x[^2] 0019 # 003 0020 [times] 0021 SDR 001 0022 # 004 0023 RCL- L 0024 [sqrt] 0025 SDR 001 0026 INC X 0027 / 0028 INC X 0029 [times] 0030 # [pi] 0031 STO[times] I 0032 [times] 0033 RCL- I 0034 STO+ X 0035 END

(10.132 cm)