GeographicLib  1.46
EllipticFunction.hpp
Go to the documentation of this file.
1 /**
2  * \file EllipticFunction.hpp
3  * \brief Header for GeographicLib::EllipticFunction class
4  *
5  * Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed
6  * under the MIT/X11 License. For more information, see
7  * http://geographiclib.sourceforge.net/
8  **********************************************************************/
9 
10 #if !defined(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP)
11 #define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP 1
12 
14 
15 namespace GeographicLib {
16 
17  /**
18  * \brief Elliptic integrals and functions
19  *
20  * This provides the elliptic functions and integrals needed for Ellipsoid,
21  * GeodesicExact, and TransverseMercatorExact. Two categories of function
22  * are provided:
23  * - \e static functions to compute symmetric elliptic integrals
24  * (http://dlmf.nist.gov/19.16.i)
25  * - \e member functions to compute Legrendre's elliptic
26  * integrals (http://dlmf.nist.gov/19.2.ii) and the
27  * Jacobi elliptic functions (http://dlmf.nist.gov/22.2).
28  * .
29  * In the latter case, an object is constructed giving the modulus \e k (and
30  * optionally the parameter &alpha;<sup>2</sup>). The modulus is always
31  * passed as its square <i>k</i><sup>2</sup> which allows \e k to be pure
32  * imaginary (<i>k</i><sup>2</sup> &lt; 0). (Confusingly, Abramowitz and
33  * Stegun call \e m = <i>k</i><sup>2</sup> the "parameter" and \e n =
34  * &alpha;<sup>2</sup> the "characteristic".)
35  *
36  * In geodesic applications, it is convenient to separate the incomplete
37  * integrals into secular and periodic components, e.g.,
38  * \f[
39  * E(\phi, k) = (2 E(\phi) / \pi) [ \phi + \delta E(\phi, k) ]
40  * \f]
41  * where &delta;\e E(&phi;, \e k) is an odd periodic function with period
42  * &pi;.
43  *
44  * The computation of the elliptic integrals uses the algorithms given in
45  * - B. C. Carlson,
46  * <a href="https://dx.doi.org/10.1007/BF02198293"> Computation of real or
47  * complex elliptic integrals</a>, Numerical Algorithms 10, 13--26 (1995)
48  * .
49  * with the additional optimizations given in http://dlmf.nist.gov/19.36.i.
50  * The computation of the Jacobi elliptic functions uses the algorithm given
51  * in
52  * - R. Bulirsch,
53  * <a href="https://dx.doi.org/10.1007/BF01397975"> Numerical Calculation of
54  * Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik 7,
55  * 78--90 (1965).
56  * .
57  * The notation follows http://dlmf.nist.gov/19 and http://dlmf.nist.gov/22
58  *
59  * Example of use:
60  * \include example-EllipticFunction.cpp
61  **********************************************************************/
63  private:
64  typedef Math::real real;
65  enum { num_ = 13 }; // Max depth required for sncndn. Probably 5 is enough.
66  real _k2, _kp2, _alpha2, _alphap2, _eps;
67  real _Kc, _Ec, _Dc, _Pic, _Gc, _Hc;
68  public:
69  /** \name Constructor
70  **********************************************************************/
71  ///@{
72  /**
73  * Constructor specifying the modulus and parameter.
74  *
75  * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
76  * <i>k</i><sup>2</sup> must lie in (-&infin;, 1). (No checking is
77  * done.)
78  * @param[in] alpha2 the parameter &alpha;<sup>2</sup>.
79  * &alpha;<sup>2</sup> must lie in (-&infin;, 1). (No checking is done.)
80  *
81  * If only elliptic integrals of the first and second kinds are needed,
82  * then set &alpha;<sup>2</sup> = 0 (the default value); in this case, we
83  * have &Pi;(&phi;, 0, \e k) = \e F(&phi;, \e k), \e G(&phi;, 0, \e k) = \e
84  * E(&phi;, \e k), and \e H(&phi;, 0, \e k) = \e F(&phi;, \e k) - \e
85  * D(&phi;, \e k).
86  **********************************************************************/
87  EllipticFunction(real k2 = 0, real alpha2 = 0)
88  { Reset(k2, alpha2); }
89 
90  /**
91  * Constructor specifying the modulus and parameter and their complements.
92  *
93  * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
94  * <i>k</i><sup>2</sup> must lie in (-&infin;, 1). (No checking is
95  * done.)
96  * @param[in] alpha2 the parameter &alpha;<sup>2</sup>.
97  * &alpha;<sup>2</sup> must lie in (-&infin;, 1). (No checking is done.)
98  * @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> =
99  * 1 &minus; <i>k</i><sup>2</sup>.
100  * @param[in] alphap2 the complementary parameter &alpha;'<sup>2</sup> = 1
101  * &minus; &alpha;<sup>2</sup>.
102  *
103  * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2
104  * = 1. (No checking is done that these conditions are met.) This
105  * constructor is provided to enable accuracy to be maintained, e.g., when
106  * \e k is very close to unity.
107  **********************************************************************/
108  EllipticFunction(real k2, real alpha2, real kp2, real alphap2)
109  { Reset(k2, alpha2, kp2, alphap2); }
110 
111  /**
112  * Reset the modulus and parameter.
113  *
114  * @param[in] k2 the new value of square of the modulus
115  * <i>k</i><sup>2</sup> which must lie in (-&infin;, 1). (No checking is
116  * done.)
117  * @param[in] alpha2 the new value of parameter &alpha;<sup>2</sup>.
118  * &alpha;<sup>2</sup> must lie in (-&infin;, 1). (No checking is done.)
119  **********************************************************************/
120  void Reset(real k2 = 0, real alpha2 = 0)
121  { Reset(k2, alpha2, 1 - k2, 1 - alpha2); }
122 
123  /**
124  * Reset the modulus and parameter supplying also their complements.
125  *
126  * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
127  * <i>k</i><sup>2</sup> must lie in (-&infin;, 1). (No checking is
128  * done.)
129  * @param[in] alpha2 the parameter &alpha;<sup>2</sup>.
130  * &alpha;<sup>2</sup> must lie in (-&infin;, 1). (No checking is done.)
131  * @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> =
132  * 1 &minus; <i>k</i><sup>2</sup>.
133  * @param[in] alphap2 the complementary parameter &alpha;'<sup>2</sup> = 1
134  * &minus; &alpha;<sup>2</sup>.
135  *
136  * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2
137  * = 1. (No checking is done that these conditions are met.) This
138  * constructor is provided to enable accuracy to be maintained, e.g., when
139  * is very small.
140  **********************************************************************/
141  void Reset(real k2, real alpha2, real kp2, real alphap2);
142 
143  ///@}
144 
145  /** \name Inspector functions.
146  **********************************************************************/
147  ///@{
148  /**
149  * @return the square of the modulus <i>k</i><sup>2</sup>.
150  **********************************************************************/
151  Math::real k2() const { return _k2; }
152 
153  /**
154  * @return the square of the complementary modulus <i>k'</i><sup>2</sup> =
155  * 1 &minus; <i>k</i><sup>2</sup>.
156  **********************************************************************/
157  Math::real kp2() const { return _kp2; }
158 
159  /**
160  * @return the parameter &alpha;<sup>2</sup>.
161  **********************************************************************/
162  Math::real alpha2() const { return _alpha2; }
163 
164  /**
165  * @return the complementary parameter &alpha;'<sup>2</sup> = 1 &minus;
166  * &alpha;<sup>2</sup>.
167  **********************************************************************/
168  Math::real alphap2() const { return _alphap2; }
169  ///@}
170 
171  /** \name Complete elliptic integrals.
172  **********************************************************************/
173  ///@{
174  /**
175  * The complete integral of the first kind.
176  *
177  * @return \e K(\e k).
178  *
179  * \e K(\e k) is defined in http://dlmf.nist.gov/19.2.E4
180  * \f[
181  * K(k) = \int_0^{\pi/2} \frac1{\sqrt{1-k^2\sin^2\phi}}\,d\phi.
182  * \f]
183  **********************************************************************/
184  Math::real K() const { return _Kc; }
185 
186  /**
187  * The complete integral of the second kind.
188  *
189  * @return \e E(\e k)
190  *
191  * \e E(\e k) is defined in http://dlmf.nist.gov/19.2.E5
192  * \f[
193  * E(k) = \int_0^{\pi/2} \sqrt{1-k^2\sin^2\phi}\,d\phi.
194  * \f]
195  **********************************************************************/
196  Math::real E() const { return _Ec; }
197 
198  /**
199  * Jahnke's complete integral.
200  *
201  * @return \e D(\e k).
202  *
203  * \e D(\e k) is defined in http://dlmf.nist.gov/19.2.E6
204  * \f[
205  * D(k) = \int_0^{\pi/2} \frac{\sin^2\phi}{\sqrt{1-k^2\sin^2\phi}}\,d\phi.
206  * \f]
207  **********************************************************************/
208  Math::real D() const { return _Dc; }
209 
210  /**
211  * The difference between the complete integrals of the first and second
212  * kinds.
213  *
214  * @return \e K(\e k) &minus; \e E(\e k).
215  **********************************************************************/
216  Math::real KE() const { return _k2 * _Dc; }
217 
218  /**
219  * The complete integral of the third kind.
220  *
221  * @return &Pi;(&alpha;<sup>2</sup>, \e k)
222  *
223  * &Pi;(&alpha;<sup>2</sup>, \e k) is defined in
224  * http://dlmf.nist.gov/19.2.E7
225  * \f[
226  * \Pi(\alpha^2, k) = \int_0^{\pi/2}
227  * \frac1{\sqrt{1-k^2\sin^2\phi}(1 - \alpha^2\sin^2\phi)}\,d\phi.
228  * \f]
229  **********************************************************************/
230  Math::real Pi() const { return _Pic; }
231 
232  /**
233  * Legendre's complete geodesic longitude integral.
234  *
235  * @return \e G(&alpha;<sup>2</sup>, \e k)
236  *
237  * \e G(&alpha;<sup>2</sup>, \e k) is given by
238  * \f[
239  * G(\alpha^2, k) = \int_0^{\pi/2}
240  * \frac{\sqrt{1-k^2\sin^2\phi}}{1 - \alpha^2\sin^2\phi}\,d\phi.
241  * \f]
242  **********************************************************************/
243  Math::real G() const { return _Gc; }
244 
245  /**
246  * Cayley's complete geodesic longitude difference integral.
247  *
248  * @return \e H(&alpha;<sup>2</sup>, \e k)
249  *
250  * \e H(&alpha;<sup>2</sup>, \e k) is given by
251  * \f[
252  * H(\alpha^2, k) = \int_0^{\pi/2}
253  * \frac{\cos^2\phi}{(1-\alpha^2\sin^2\phi)\sqrt{1-k^2\sin^2\phi}}
254  * \,d\phi.
255  * \f]
256  **********************************************************************/
257  Math::real H() const { return _Hc; }
258  ///@}
259 
260  /** \name Incomplete elliptic integrals.
261  **********************************************************************/
262  ///@{
263  /**
264  * The incomplete integral of the first kind.
265  *
266  * @param[in] phi
267  * @return \e F(&phi;, \e k).
268  *
269  * \e F(&phi;, \e k) is defined in http://dlmf.nist.gov/19.2.E4
270  * \f[
271  * F(\phi, k) = \int_0^\phi \frac1{\sqrt{1-k^2\sin^2\theta}}\,d\theta.
272  * \f]
273  **********************************************************************/
274  Math::real F(real phi) const;
275 
276  /**
277  * The incomplete integral of the second kind.
278  *
279  * @param[in] phi
280  * @return \e E(&phi;, \e k).
281  *
282  * \e E(&phi;, \e k) is defined in http://dlmf.nist.gov/19.2.E5
283  * \f[
284  * E(\phi, k) = \int_0^\phi \sqrt{1-k^2\sin^2\theta}\,d\theta.
285  * \f]
286  **********************************************************************/
287  Math::real E(real phi) const;
288 
289  /**
290  * The incomplete integral of the second kind with the argument given in
291  * degrees.
292  *
293  * @param[in] ang in <i>degrees</i>.
294  * @return \e E(&pi; <i>ang</i>/180, \e k).
295  **********************************************************************/
296  Math::real Ed(real ang) const;
297 
298  /**
299  * The inverse of the incomplete integral of the second kind.
300  *
301  * @param[in] x
302  * @return &phi; = <i>E</i><sup>&minus;1</sup>(\e x, \e k); i.e., the
303  * solution of such that \e E(&phi;, \e k) = \e x.
304  **********************************************************************/
305  Math::real Einv(real x) const;
306 
307  /**
308  * The incomplete integral of the third kind.
309  *
310  * @param[in] phi
311  * @return &Pi;(&phi;, &alpha;<sup>2</sup>, \e k).
312  *
313  * &Pi;(&phi;, &alpha;<sup>2</sup>, \e k) is defined in
314  * http://dlmf.nist.gov/19.2.E7
315  * \f[
316  * \Pi(\phi, \alpha^2, k) = \int_0^\phi
317  * \frac1{\sqrt{1-k^2\sin^2\theta}(1 - \alpha^2\sin^2\theta)}\,d\theta.
318  * \f]
319  **********************************************************************/
320  Math::real Pi(real phi) const;
321 
322  /**
323  * Jahnke's incomplete elliptic integral.
324  *
325  * @param[in] phi
326  * @return \e D(&phi;, \e k).
327  *
328  * \e D(&phi;, \e k) is defined in http://dlmf.nist.gov/19.2.E4
329  * \f[
330  * D(\phi, k) = \int_0^\phi
331  * \frac{\sin^2\theta}{\sqrt{1-k^2\sin^2\theta}}\,d\theta.
332  * \f]
333  **********************************************************************/
334  Math::real D(real phi) const;
335 
336  /**
337  * Legendre's geodesic longitude integral.
338  *
339  * @param[in] phi
340  * @return \e G(&phi;, &alpha;<sup>2</sup>, \e k).
341  *
342  * \e G(&phi;, &alpha;<sup>2</sup>, \e k) is defined by
343  * \f[
344  * \begin{align}
345  * G(\phi, \alpha^2, k) &=
346  * \frac{k^2}{\alpha^2} F(\phi, k) +
347  * \biggl(1 - \frac{k^2}{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\
348  * &= \int_0^\phi
349  * \frac{\sqrt{1-k^2\sin^2\theta}}{1 - \alpha^2\sin^2\theta}\,d\theta.
350  * \end{align}
351  * \f]
352  *
353  * Legendre expresses the longitude of a point on the geodesic in terms of
354  * this combination of elliptic integrals in Exercices de Calcul
355  * Int&eacute;gral, Vol. 1 (1811), p. 181,
356  * https://books.google.com/books?id=riIOAAAAQAAJ&pg=PA181.
357  *
358  * See \ref geodellip for the expression for the longitude in terms of this
359  * function.
360  **********************************************************************/
361  Math::real G(real phi) const;
362 
363  /**
364  * Cayley's geodesic longitude difference integral.
365  *
366  * @param[in] phi
367  * @return \e H(&phi;, &alpha;<sup>2</sup>, \e k).
368  *
369  * \e H(&phi;, &alpha;<sup>2</sup>, \e k) is defined by
370  * \f[
371  * \begin{align}
372  * H(\phi, \alpha^2, k) &=
373  * \frac1{\alpha^2} F(\phi, k) +
374  * \biggl(1 - \frac1{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\
375  * &= \int_0^\phi
376  * \frac{\cos^2\theta}{(1-\alpha^2\sin^2\theta)\sqrt{1-k^2\sin^2\theta}}
377  * \,d\theta.
378  * \end{align}
379  * \f]
380  *
381  * Cayley expresses the longitude difference of a point on the geodesic in
382  * terms of this combination of elliptic integrals in Phil. Mag. <b>40</b>
383  * (1870), p. 333, https://books.google.com/books?id=Zk0wAAAAIAAJ&pg=PA333.
384  *
385  * See \ref geodellip for the expression for the longitude in terms of this
386  * function.
387  **********************************************************************/
388  Math::real H(real phi) const;
389  ///@}
390 
391  /** \name Incomplete integrals in terms of Jacobi elliptic functions.
392  **********************************************************************/
393  /**
394  * The incomplete integral of the first kind in terms of Jacobi elliptic
395  * functions.
396  *
397  * @param[in] sn = sin&phi;
398  * @param[in] cn = cos&phi;
399  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
400  * sin<sup>2</sup>&phi;)
401  * @return \e F(&phi;, \e k) as though &phi; &isin; (&minus;&pi;, &pi;].
402  **********************************************************************/
403  Math::real F(real sn, real cn, real dn) const;
404 
405  /**
406  * The incomplete integral of the second kind in terms of Jacobi elliptic
407  * functions.
408  *
409  * @param[in] sn = sin&phi;
410  * @param[in] cn = cos&phi;
411  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
412  * sin<sup>2</sup>&phi;)
413  * @return \e E(&phi;, \e k) as though &phi; &isin; (&minus;&pi;, &pi;].
414  **********************************************************************/
415  Math::real E(real sn, real cn, real dn) const;
416 
417  /**
418  * The incomplete integral of the third kind in terms of Jacobi elliptic
419  * functions.
420  *
421  * @param[in] sn = sin&phi;
422  * @param[in] cn = cos&phi;
423  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
424  * sin<sup>2</sup>&phi;)
425  * @return &Pi;(&phi;, &alpha;<sup>2</sup>, \e k) as though &phi; &isin;
426  * (&minus;&pi;, &pi;].
427  **********************************************************************/
428  Math::real Pi(real sn, real cn, real dn) const;
429 
430  /**
431  * Jahnke's incomplete elliptic integral in terms of Jacobi elliptic
432  * functions.
433  *
434  * @param[in] sn = sin&phi;
435  * @param[in] cn = cos&phi;
436  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
437  * sin<sup>2</sup>&phi;)
438  * @return \e D(&phi;, \e k) as though &phi; &isin; (&minus;&pi;, &pi;].
439  **********************************************************************/
440  Math::real D(real sn, real cn, real dn) const;
441 
442  /**
443  * Legendre's geodesic longitude integral in terms of Jacobi elliptic
444  * functions.
445  *
446  * @param[in] sn = sin&phi;
447  * @param[in] cn = cos&phi;
448  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
449  * sin<sup>2</sup>&phi;)
450  * @return \e G(&phi;, &alpha;<sup>2</sup>, \e k) as though &phi; &isin;
451  * (&minus;&pi;, &pi;].
452  **********************************************************************/
453  Math::real G(real sn, real cn, real dn) const;
454 
455  /**
456  * Cayley's geodesic longitude difference integral in terms of Jacobi
457  * elliptic functions.
458  *
459  * @param[in] sn = sin&phi;
460  * @param[in] cn = cos&phi;
461  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
462  * sin<sup>2</sup>&phi;)
463  * @return \e H(&phi;, &alpha;<sup>2</sup>, \e k) as though &phi; &isin;
464  * (&minus;&pi;, &pi;].
465  **********************************************************************/
466  Math::real H(real sn, real cn, real dn) const;
467  ///@}
468 
469  /** \name Periodic versions of incomplete elliptic integrals.
470  **********************************************************************/
471  ///@{
472  /**
473  * The periodic incomplete integral of the first kind.
474  *
475  * @param[in] sn = sin&phi;
476  * @param[in] cn = cos&phi;
477  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
478  * sin<sup>2</sup>&phi;)
479  * @return the periodic function &pi; \e F(&phi;, \e k) / (2 \e K(\e k)) -
480  * &phi;
481  **********************************************************************/
482  Math::real deltaF(real sn, real cn, real dn) const;
483 
484  /**
485  * The periodic incomplete integral of the second kind.
486  *
487  * @param[in] sn = sin&phi;
488  * @param[in] cn = cos&phi;
489  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
490  * sin<sup>2</sup>&phi;)
491  * @return the periodic function &pi; \e E(&phi;, \e k) / (2 \e E(\e k)) -
492  * &phi;
493  **********************************************************************/
494  Math::real deltaE(real sn, real cn, real dn) const;
495 
496  /**
497  * The periodic inverse of the incomplete integral of the second kind.
498  *
499  * @param[in] stau = sin&tau;
500  * @param[in] ctau = sin&tau;
501  * @return the periodic function <i>E</i><sup>&minus;1</sup>(&tau; (2 \e
502  * E(\e k)/&pi;), \e k) - &tau;
503  **********************************************************************/
504  Math::real deltaEinv(real stau, real ctau) const;
505 
506  /**
507  * The periodic incomplete integral of the third kind.
508  *
509  * @param[in] sn = sin&phi;
510  * @param[in] cn = cos&phi;
511  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
512  * sin<sup>2</sup>&phi;)
513  * @return the periodic function &pi; &Pi;(&phi;, \e k) / (2 &Pi;(\e k)) -
514  * &phi;
515  **********************************************************************/
516  Math::real deltaPi(real sn, real cn, real dn) const;
517 
518  /**
519  * The periodic Jahnke's incomplete elliptic integral.
520  *
521  * @param[in] sn = sin&phi;
522  * @param[in] cn = cos&phi;
523  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
524  * sin<sup>2</sup>&phi;)
525  * @return the periodic function &pi; \e D(&phi;, \e k) / (2 \e D(\e k)) -
526  * &phi;
527  **********************************************************************/
528  Math::real deltaD(real sn, real cn, real dn) const;
529 
530  /**
531  * Legendre's periodic geodesic longitude integral.
532  *
533  * @param[in] sn = sin&phi;
534  * @param[in] cn = cos&phi;
535  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
536  * sin<sup>2</sup>&phi;)
537  * @return the periodic function &pi; \e G(&phi;, \e k) / (2 \e G(\e k)) -
538  * &phi;
539  **********************************************************************/
540  Math::real deltaG(real sn, real cn, real dn) const;
541 
542  /**
543  * Cayley's periodic geodesic longitude difference integral.
544  *
545  * @param[in] sn = sin&phi;
546  * @param[in] cn = cos&phi;
547  * @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
548  * sin<sup>2</sup>&phi;)
549  * @return the periodic function &pi; \e H(&phi;, \e k) / (2 \e H(\e k)) -
550  * &phi;
551  **********************************************************************/
552  Math::real deltaH(real sn, real cn, real dn) const;
553  ///@}
554 
555  /** \name Elliptic functions.
556  **********************************************************************/
557  ///@{
558  /**
559  * The Jacobi elliptic functions.
560  *
561  * @param[in] x the argument.
562  * @param[out] sn sn(\e x, \e k).
563  * @param[out] cn cn(\e x, \e k).
564  * @param[out] dn dn(\e x, \e k).
565  **********************************************************************/
566  void sncndn(real x, real& sn, real& cn, real& dn) const;
567 
568  /**
569  * The &Delta; amplitude function.
570  *
571  * @param[in] sn sin&phi;
572  * @param[in] cn cos&phi;
573  * @return &Delta; = sqrt(1 &minus; <i>k</i><sup>2</sup>
574  * sin<sup>2</sup>&phi;)
575  **********************************************************************/
576  Math::real Delta(real sn, real cn) const {
577  using std::sqrt;
578  return sqrt(_k2 < 0 ? 1 - _k2 * sn*sn : _kp2 + _k2 * cn*cn);
579  }
580  ///@}
581 
582  /** \name Symmetric elliptic integrals.
583  **********************************************************************/
584  ///@{
585  /**
586  * Symmetric integral of the first kind <i>R</i><sub><i>F</i></sub>.
587  *
588  * @param[in] x
589  * @param[in] y
590  * @param[in] z
591  * @return <i>R</i><sub><i>F</i></sub>(\e x, \e y, \e z)
592  *
593  * <i>R</i><sub><i>F</i></sub> is defined in http://dlmf.nist.gov/19.16.E1
594  * \f[ R_F(x, y, z) = \frac12
595  * \int_0^\infty\frac1{\sqrt{(t + x) (t + y) (t + z)}}\, dt \f]
596  * If one of the arguments is zero, it is more efficient to call the
597  * two-argument version of this function with the non-zero arguments.
598  **********************************************************************/
599  static real RF(real x, real y, real z);
600 
601  /**
602  * Complete symmetric integral of the first kind,
603  * <i>R</i><sub><i>F</i></sub> with one argument zero.
604  *
605  * @param[in] x
606  * @param[in] y
607  * @return <i>R</i><sub><i>F</i></sub>(\e x, \e y, 0)
608  **********************************************************************/
609  static real RF(real x, real y);
610 
611  /**
612  * Degenerate symmetric integral of the first kind
613  * <i>R</i><sub><i>C</i></sub>.
614  *
615  * @param[in] x
616  * @param[in] y
617  * @return <i>R</i><sub><i>C</i></sub>(\e x, \e y) =
618  * <i>R</i><sub><i>F</i></sub>(\e x, \e y, \e y)
619  *
620  * <i>R</i><sub><i>C</i></sub> is defined in http://dlmf.nist.gov/19.2.E17
621  * \f[ R_C(x, y) = \frac12
622  * \int_0^\infty\frac1{\sqrt{t + x}(t + y)}\,dt \f]
623  **********************************************************************/
624  static real RC(real x, real y);
625 
626  /**
627  * Symmetric integral of the second kind <i>R</i><sub><i>G</i></sub>.
628  *
629  * @param[in] x
630  * @param[in] y
631  * @param[in] z
632  * @return <i>R</i><sub><i>G</i></sub>(\e x, \e y, \e z)
633  *
634  * <i>R</i><sub><i>G</i></sub> is defined in Carlson, eq 1.5
635  * \f[ R_G(x, y, z) = \frac14
636  * \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2}
637  * \biggl(
638  * \frac x{t + x} + \frac y{t + y} + \frac z{t + z}
639  * \biggr)t\,dt \f]
640  * See also http://dlmf.nist.gov/19.16.E3.
641  * If one of the arguments is zero, it is more efficient to call the
642  * two-argument version of this function with the non-zero arguments.
643  **********************************************************************/
644  static real RG(real x, real y, real z);
645 
646  /**
647  * Complete symmetric integral of the second kind,
648  * <i>R</i><sub><i>G</i></sub> with one argument zero.
649  *
650  * @param[in] x
651  * @param[in] y
652  * @return <i>R</i><sub><i>G</i></sub>(\e x, \e y, 0)
653  **********************************************************************/
654  static real RG(real x, real y);
655 
656  /**
657  * Symmetric integral of the third kind <i>R</i><sub><i>J</i></sub>.
658  *
659  * @param[in] x
660  * @param[in] y
661  * @param[in] z
662  * @param[in] p
663  * @return <i>R</i><sub><i>J</i></sub>(\e x, \e y, \e z, \e p)
664  *
665  * <i>R</i><sub><i>J</i></sub> is defined in http://dlmf.nist.gov/19.16.E2
666  * \f[ R_J(x, y, z, p) = \frac32
667  * \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2} (t + p)^{-1}\, dt \f]
668  **********************************************************************/
669  static real RJ(real x, real y, real z, real p);
670 
671  /**
672  * Degenerate symmetric integral of the third kind
673  * <i>R</i><sub><i>D</i></sub>.
674  *
675  * @param[in] x
676  * @param[in] y
677  * @param[in] z
678  * @return <i>R</i><sub><i>D</i></sub>(\e x, \e y, \e z) =
679  * <i>R</i><sub><i>J</i></sub>(\e x, \e y, \e z, \e z)
680  *
681  * <i>R</i><sub><i>D</i></sub> is defined in http://dlmf.nist.gov/19.16.E5
682  * \f[ R_D(x, y, z) = \frac32
683  * \int_0^\infty[(t + x) (t + y)]^{-1/2} (t + z)^{-3/2}\, dt \f]
684  **********************************************************************/
685  static real RD(real x, real y, real z);
686  ///@}
687 
688  };
689 
690 } // namespace GeographicLib
691 
692 #endif // GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:90
void Reset(real k2=0, real alpha2=0)
GeographicLib::Math::real real
Definition: GeodSolve.cpp:31
Elliptic integrals and functions.
Math::real Delta(real sn, real cn) const
Namespace for GeographicLib.
Definition: Accumulator.cpp:12
EllipticFunction(real k2, real alpha2, real kp2, real alphap2)
Header for GeographicLib::Constants class.
EllipticFunction(real k2=0, real alpha2=0)