CPU Time Comparison. â« nanosec @ PC with Intel Core i7-2675QM. 21. Elliptic Integral/Function. Bulirsch Carlson Cody new. K(m). 93. 330. 62. 24. B(m), D(m).
Precise & Fast Computation of Elliptic Functions & Elliptic Integrals aka
How Sushi Mania became Samurai Swordsmith Toshio Fukushima (Nat’l Astron. Obs. Japan) ResearchGate Fukushima Click
Sushi
Samurai Sword
3
Sushi
Asteroid Itokawa, Eros, Ida, Kleopatra, …
4
Why Elliptic Function/Integral?
Samurai Sword for Astronomer
Elliptic F. = Extension of Trig./Hyp. F
Elliptic Function: 3D Rotational Dynamics Elliptic Integral: Gravity Field Evaluation sn(u|0) = sin u, cn(u|0) = cos u, dn(u|0) = 1 sn(u|1) = tanh u, cn(u|1) = dn(u|1) = 1/cosh u
Elliptic I. = Ext. of Inverse Trig./Hyp. F
F(phi|0) = phi, F(phi|1) = atanh(sin phi) 5
General Elliptic Integral
Pdx Definition: G ≡ ∫ Q P: Polyn.
Q: Degree 3 or 4 Polyn.
Reduction Th.: Legendre (1825-1832)
G (ϕ , n | m ) = aF (ϕ | m ) + bE (ϕ | m ) + cΠ (ϕ , n | m ) + R (ϕ , n | m )
F, E, Pi: Legendre’s 1st, 2nd, & 3rd Kind Elliptic I R: General Rational F phi: Amplitude, m: Parameter, n: Characteristic 6
st 1 ,
nd 2 ,
rd 3
& Kind Elliptic I st 1 nd 2
F (ϕ | m ) ≡ ∫
ϕ
0
dθ ∆ (θ | m )
ϕ
E (ϕ | m ) ≡ ∫ ∆ (θ | m ) dθ 0
rd 3
ϕ
dθ
0
(1 − n sin θ ) ∆ (θ | m )
Π (ϕ , n | m ) ≡ ∫
Jacobi’s Delta F
2
∆ (ϕ | m ) ≡ 1 − m sin 2 θ 7
Associate Elliptic I B (ϕ | m ) ≡ ∫
ϕ
0
E (ϕ | m ) − (1 − m ) F (ϕ | m ) = m 1 − m sin 2 θ 2
cos θ dθ
D (ϕ | m ) ≡ ∫
ϕ
0
J (ϕ , n | m ) ≡ ∫
ϕ
0
F (ϕ | m ) − E (ϕ | m ) = 2 m 1 − m sin θ sin 2 θ dθ
Π (ϕ , n | m ) − F (ϕ | m ) = n 1 − m sin 2 θ
sin 2 θ dθ 2 θ) − 1 n sin (
8
Jacobian Elliptic F
Gauss and Abel Trio: sn, cn, dn Amplitude F = Inv. Incompl. EI: 1st Kind
ϕ = am(u | m) ↔ u = F (ϕ | m )
Jacobian EF = Trig. F of Amplitude
sn ( u | m ) = sin ϕ , cn ( u | m ) = cos ϕ , dn ( u | m ) = ∆ (ϕ | m ) 9
10
Existing Methods: I
Complete EI of 1st, 2nd Kind: K(m), E(m) Cody’s Chebyshev Approx.
Genius of Hastings (1955)
K ( m ) = K1 ( m ) ln (1 − m ) + K 0 ( m )
Cody and Wait (1980)
“Software Manual for the Elementary Functions” 11
Existing Methods: II
Complete EI
Incomplete EI
Bulirsch’s cel: Precise but not-so-Fast. Bulirsch’s el1: Fast and Precise Bulirsch’s el2, el3: Fast but Imprecise Carlson’s RF, RD, RJ : Precise but Slow
Jacobian EF
Bulirsch’s sncndn: Precise but not-so-Fast. 12
Bulirsch and Carlson
R.Z. Bulirsch
Elliptic I/F, GBS Method
B.C. Carlson
Symmetric Elliptic I
13
Necessity is Mother of Invention 14
New Methods: I
Single Variable F: K(m), E(m), … “Divide & Rule”: Piecewise Minimax Appr. Fukushima (2009b, 2011a, 2013c, 2015) Estrin’s Scheme Most Efficient Parallel Algorithm 2.0-3.5 times faster than Horner if using AVX2 @ Intel Haswell CPU
15
New Methods: II
Addition Th. of EF: Lagrange Double Argument Transf. 2 scd c2 − s2d 2 d 2 − ms 2 c 2 sn 2u = , cn 2u = , dn 2u = 4 4 1 − ms 1 − ms 1 − ms 4
scd2 (Fukushima, NM, 2013a)
1. Reduce u to sufficiently small u’=u/2N 2. Evaluate Truncated Maclaurin Series w.r.t. u’ 3. Apply Double Argument Transf. N times 16
Application to st 1 Kind Incomplete EI
y
Half Arg. Formula y ' = 1 + 1 − 1 + 1 − y my ( )( ) 2 y=sn (u|m) elf (Fukushima, NM, 2010a)
1. 2. 3. 4.
Compute y=sin2(phi) Apply Half Arg. Formula N times to Reduce y Evaluate F’ by Maclaurin Series w.r.t. y’ F(phi|m) = 2N F’ 17
Application to nd rd 2 & 3 Kind EI
Double Arg. Formulas of D and J
D = 2 D '+ t , J = 2 J '+ T ( t , h )
t = s / c, h = n (1 − n )( n − m )
elbdj (Fukushima, JCAM, 2011b,2012a)
1. 2. 3. 4.
Compute y=sin2(phi) Apply Half Arg. Formula N times to Reduce y Evaluate D’ & J’ by Maclaurin Series w.r.t. y’ Apply Double Arg. Formula N times for D and J 18
Universal ArcTangent F
Definition
tan −1 ht / h ( h > 0) T (t, h ) ≡ t ( h = 0) −1 tanh −ht / −h ( h < 0 )
(
(
)
)
uatan (Fukushima, JCAM, 2012a, Appendix)
19
New Method for J(n|m)
Add. Th. w.r.t. n: Jacobi Double Charact. Transf. 2 ( c + d ) J − yK J'= c (1 + c )(1 + d )
y ≡ n/m c = 1 − y , d = 1 − my
celj (Fukushima, JCAM, 2013d) 20
CPU Time Comparison
nanosec @ PC with Intel Core i7-2675QM
Elliptic Integral/Function K(m)
Bulirsch Carlson Cody new 93
330
B(m), D(m)
186
922
29
B(m), D(m), J(n|m)
383
1871
159
F(phi|m)
178
313
173
712
213
1426
464
B(phi|m), D(phi|m) B(phi|m), D(phi|m), J(phi,n|m) sn(u|m), cn(u|m), dn(u|m)
165
62
24
116 21
Conclusion
Single Var. F: Piecewise Minimax Approx. Multi-Var. F: Half/Double Arg. Transf.
Forward Problem: All Elliptic I/F Inverse Problem: General Elliptic I Derivatives: Recursive Computation
1.4-32 times Speed-Up except F(phi|m) Fortran 90 Software @ ResearchGate 22