00001 /** 00002 * \file EllipticFunction.hpp 00003 * \brief Header for GeographicLib::EllipticFunction class 00004 * 00005 * Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed 00006 * under the MIT/X11 License. For more information, see 00007 * http://geographiclib.sourceforge.net/ 00008 **********************************************************************/ 00009 00010 #if !defined(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP) 00011 #define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP 1 00012 00013 #include <GeographicLib/Constants.hpp> 00014 00015 namespace GeographicLib { 00016 00017 /** 00018 * \brief Elliptic integrals and functions 00019 * 00020 * This provides the elliptic functions and integrals needed for Ellipsoid, 00021 * GeodesicExact, and TransverseMercatorExact. Two categories of function 00022 * are provided: 00023 * - \e static functions to compute symmetric elliptic integrals 00024 * (http://dlmf.nist.gov/19.16.i) 00025 * - \e member functions to compute Legrendre's elliptic 00026 * integrals (http://dlmf.nist.gov/19.2.ii) and the 00027 * Jacobi elliptic functions (http://dlmf.nist.gov/22.2). 00028 * . 00029 * In the latter case, an object is constructed giving the modulus \e k (and 00030 * optionally the parameter α<sup>2</sup>). The modulus is always 00031 * passed as its square <i>k</i><sup>2</sup> which allows \e k to be pure 00032 * imaginary (<i>k</i><sup>2</sup> < 0). (Confusingly, Abramowitz and 00033 * Stegun call \e m = <i>k</i><sup>2</sup> the "parameter" and \e n = 00034 * α<sup>2</sup> the "characteristic".) 00035 * 00036 * In geodesic applications, it is convenient to separate the incomplete 00037 * integrals into secular and periodic components, e.g., 00038 * \f[ 00039 * E(\phi, k) = (2 E(\phi) / \pi) [ \phi + \delta E(\phi, k) ] 00040 * \f] 00041 * where δ\e E(φ, \e k) is an odd periodic function with period 00042 * π. 00043 * 00044 * The computation of the elliptic integrals uses the algorithms given in 00045 * - B. C. Carlson, 00046 * <a href="http://dx.doi.org/10.1007/BF02198293"> Computation of real or 00047 * complex elliptic integrals</a>, Numerical Algorithms 10, 13--26 (1995) 00048 * . 00049 * with the additional optimizations given in http://dlmf.nist.gov/19.36.i. 00050 * The computation of the Jacobi elliptic functions uses the algorithm given 00051 * in 00052 * - R. Bulirsch, 00053 * <a href="http://dx.doi.org/10.1007/BF01397975"> Numerical Calculation of 00054 * Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik 7, 00055 * 78--90 (1965). 00056 * . 00057 * The notation follows http://dlmf.nist.gov/19 and http://dlmf.nist.gov/22 00058 * 00059 * Example of use: 00060 * \include example-EllipticFunction.cpp 00061 **********************************************************************/ 00062 class GEOGRAPHICLIB_EXPORT EllipticFunction { 00063 private: 00064 typedef Math::real real; 00065 enum { num_ = 13 }; // Max depth required for sncndn. Probably 5 is enough. 00066 real _k2, _kp2, _alpha2, _alphap2, _eps; 00067 real _Kc, _Ec, _Dc, _Pic, _Gc, _Hc; 00068 public: 00069 /** \name Constructor 00070 **********************************************************************/ 00071 ///@{ 00072 /** 00073 * Constructor specifying the modulus and parameter. 00074 * 00075 * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>. 00076 * <i>k</i><sup>2</sup> must lie in (-∞, 1). (No checking is 00077 * done.) 00078 * @param[in] alpha2 the parameter α<sup>2</sup>. 00079 * α<sup>2</sup> must lie in (-∞, 1). (No checking is done.) 00080 * 00081 * If only elliptic integrals of the first and second kinds are needed, 00082 * then set α<sup>2</sup> = 0 (the default value); in this case, we 00083 * have Π(φ, 0, \e k) = \e F(φ, \e k), \e G(φ, 0, \e k) = \e 00084 * E(φ, \e k), and \e H(φ, 0, \e k) = \e F(φ, \e k) - \e 00085 * D(φ, \e k). 00086 **********************************************************************/ 00087 EllipticFunction(real k2 = 0, real alpha2 = 0) 00088 { Reset(k2, alpha2); } 00089 00090 /** 00091 * Constructor specifying the modulus and parameter and their complements. 00092 * 00093 * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>. 00094 * <i>k</i><sup>2</sup> must lie in (-∞, 1). (No checking is 00095 * done.) 00096 * @param[in] alpha2 the parameter α<sup>2</sup>. 00097 * α<sup>2</sup> must lie in (-∞, 1). (No checking is done.) 00098 * @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> = 00099 * 1 − <i>k</i><sup>2</sup>. 00100 * @param[in] alphap2 the complementary parameter α'<sup>2</sup> = 1 00101 * − α<sup>2</sup>. 00102 * 00103 * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2 00104 * = 1. (No checking is done that these conditions are met.) This 00105 * constructor is provided to enable accuracy to be maintained, e.g., when 00106 * \e k is very close to unity. 00107 **********************************************************************/ 00108 EllipticFunction(real k2, real alpha2, real kp2, real alphap2) 00109 { Reset(k2, alpha2, kp2, alphap2); } 00110 00111 /** 00112 * Reset the modulus and parameter. 00113 * 00114 * @param[in] k2 the new value of square of the modulus 00115 * <i>k</i><sup>2</sup> which must lie in (-∞, 1). (No checking is 00116 * done.) 00117 * @param[in] alpha2 the new value of parameter α<sup>2</sup>. 00118 * α<sup>2</sup> must lie in (-∞, 1). (No checking is done.) 00119 **********************************************************************/ 00120 void Reset(real k2 = 0, real alpha2 = 0) 00121 { Reset(k2, alpha2, 1 - k2, 1 - alpha2); } 00122 00123 /** 00124 * Reset the modulus and parameter supplying also their complements. 00125 * 00126 * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>. 00127 * <i>k</i><sup>2</sup> must lie in (-∞, 1). (No checking is 00128 * done.) 00129 * @param[in] alpha2 the parameter α<sup>2</sup>. 00130 * α<sup>2</sup> must lie in (-∞, 1). (No checking is done.) 00131 * @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> = 00132 * 1 − <i>k</i><sup>2</sup>. 00133 * @param[in] alphap2 the complementary parameter α'<sup>2</sup> = 1 00134 * − α<sup>2</sup>. 00135 * 00136 * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2 00137 * = 1. (No checking is done that these conditions are met.) This 00138 * constructor is provided to enable accuracy to be maintained, e.g., when 00139 * is very small. 00140 **********************************************************************/ 00141 void Reset(real k2, real alpha2, real kp2, real alphap2); 00142 00143 ///@} 00144 00145 /** \name Inspector functions. 00146 **********************************************************************/ 00147 ///@{ 00148 /** 00149 * @return the square of the modulus <i>k</i><sup>2</sup>. 00150 **********************************************************************/ 00151 Math::real k2() const { return _k2; } 00152 00153 /** 00154 * @return the square of the complementary modulus <i>k'</i><sup>2</sup> = 00155 * 1 − <i>k</i><sup>2</sup>. 00156 **********************************************************************/ 00157 Math::real kp2() const { return _kp2; } 00158 00159 /** 00160 * @return the parameter α<sup>2</sup>. 00161 **********************************************************************/ 00162 Math::real alpha2() const { return _alpha2; } 00163 00164 /** 00165 * @return the complementary parameter α'<sup>2</sup> = 1 − 00166 * α<sup>2</sup>. 00167 **********************************************************************/ 00168 Math::real alphap2() const { return _alphap2; } 00169 ///@} 00170 00171 /// \cond SKIP 00172 /** 00173 * @return the square of the modulus <i>k</i><sup>2</sup>. 00174 * 00175 * <b>DEPRECATED</b>, use k2() instead. 00176 **********************************************************************/ 00177 Math::real m() const { return _k2; } 00178 /** 00179 * @return the square of the complementary modulus <i>k'</i><sup>2</sup> = 00180 * 1 − <i>k</i><sup>2</sup>. 00181 * 00182 * <b>DEPRECATED</b>, use kp2() instead. 00183 **********************************************************************/ 00184 Math::real m1() const { return _kp2; } 00185 /// \endcond 00186 00187 /** \name Complete elliptic integrals. 00188 **********************************************************************/ 00189 ///@{ 00190 /** 00191 * The complete integral of the first kind. 00192 * 00193 * @return \e K(\e k). 00194 * 00195 * \e K(\e k) is defined in http://dlmf.nist.gov/19.2.E4 00196 * \f[ 00197 * K(k) = \int_0^{\pi/2} \frac1{\sqrt{1-k^2\sin^2\phi}}\,d\phi. 00198 * \f] 00199 **********************************************************************/ 00200 Math::real K() const { return _Kc; } 00201 00202 /** 00203 * The complete integral of the second kind. 00204 * 00205 * @return \e E(\e k) 00206 * 00207 * \e E(\e k) is defined in http://dlmf.nist.gov/19.2.E5 00208 * \f[ 00209 * E(k) = \int_0^{\pi/2} \sqrt{1-k^2\sin^2\phi}\,d\phi. 00210 * \f] 00211 **********************************************************************/ 00212 Math::real E() const { return _Ec; } 00213 00214 /** 00215 * Jahnke's complete integral. 00216 * 00217 * @return \e D(\e k). 00218 * 00219 * \e D(\e k) is defined in http://dlmf.nist.gov/19.2.E6 00220 * \f[ 00221 * D(k) = \int_0^{\pi/2} \frac{\sin^2\phi}{\sqrt{1-k^2\sin^2\phi}}\,d\phi. 00222 * \f] 00223 **********************************************************************/ 00224 Math::real D() const { return _Dc; } 00225 00226 /** 00227 * The difference between the complete integrals of the first and second 00228 * kinds. 00229 * 00230 * @return \e K(\e k) − \e E(\e k). 00231 **********************************************************************/ 00232 Math::real KE() const { return _k2 * _Dc; } 00233 00234 /** 00235 * The complete integral of the third kind. 00236 * 00237 * @return Π(α<sup>2</sup>, \e k) 00238 * 00239 * Π(α<sup>2</sup>, \e k) is defined in 00240 * http://dlmf.nist.gov/19.2.E7 00241 * \f[ 00242 * \Pi(\alpha^2, k) = \int_0^{\pi/2} 00243 * \frac1{\sqrt{1-k^2\sin^2\phi}(1 - \alpha^2\sin^2\phi_)}\,d\phi. 00244 * \f] 00245 **********************************************************************/ 00246 Math::real Pi() const { return _Pic; } 00247 00248 /** 00249 * Legendre's complete geodesic longitude integral. 00250 * 00251 * @return \e G(α<sup>2</sup>, \e k) 00252 * 00253 * \e G(α<sup>2</sup>, \e k) is given by 00254 * \f[ 00255 * G(\alpha^2, k) = \int_0^{\pi/2} 00256 * \frac{\sqrt{1-k^2\sin^2\phi}}{1 - \alpha^2\sin^2\phi}\,d\phi. 00257 * \f] 00258 **********************************************************************/ 00259 Math::real G() const { return _Gc; } 00260 00261 /** 00262 * Cayley's complete geodesic longitude difference integral. 00263 * 00264 * @return \e H(α<sup>2</sup>, \e k) 00265 * 00266 * \e H(α<sup>2</sup>, \e k) is given by 00267 * \f[ 00268 * H(\alpha^2, k) = \int_0^{\pi/2} 00269 * \frac{\cos^2\phi}{(1-\alpha^2\sin^2\phi)\sqrt{1-k^2\sin^2\phi}} 00270 * \,d\phi. 00271 * \f] 00272 **********************************************************************/ 00273 Math::real H() const { return _Hc; } 00274 ///@} 00275 00276 /** \name Incomplete elliptic integrals. 00277 **********************************************************************/ 00278 ///@{ 00279 /** 00280 * The incomplete integral of the first kind. 00281 * 00282 * @param[in] phi 00283 * @return \e F(φ, \e k). 00284 * 00285 * \e F(φ, \e k) is defined in http://dlmf.nist.gov/19.2.E4 00286 * \f[ 00287 * F(\phi, k) = \int_0^\phi \frac1{\sqrt{1-k^2\sin^2\theta}}\,d\theta. 00288 * \f] 00289 **********************************************************************/ 00290 Math::real F(real phi) const; 00291 00292 /** 00293 * The incomplete integral of the second kind. 00294 * 00295 * @param[in] phi 00296 * @return \e E(φ, \e k). 00297 * 00298 * \e E(φ, \e k) is defined in http://dlmf.nist.gov/19.2.E5 00299 * \f[ 00300 * E(\phi, k) = \int_0^\phi \sqrt{1-k^2\sin^2\theta}\,d\theta. 00301 * \f] 00302 **********************************************************************/ 00303 Math::real E(real phi) const; 00304 00305 /** 00306 * The incomplete integral of the second kind with the argument given in 00307 * degrees. 00308 * 00309 * @param[in] ang in <i>degrees</i>. 00310 * @return \e E(π <i>ang</i>/180, \e k). 00311 **********************************************************************/ 00312 Math::real Ed(real ang) const; 00313 00314 /** 00315 * The inverse of the incomplete integral of the second kind. 00316 * 00317 * @param[in] x 00318 * @return φ = <i>E</i><sup>−1</sup>(\e x, \e k); i.e., the 00319 * solution of such that \e E(φ, \e k) = \e x. 00320 **********************************************************************/ 00321 Math::real Einv(real x) const; 00322 00323 /** 00324 * The incomplete integral of the third kind. 00325 * 00326 * @param[in] phi 00327 * @return Π(φ, α<sup>2</sup>, \e k). 00328 * 00329 * Π(φ, α<sup>2</sup>, \e k) is defined in 00330 * http://dlmf.nist.gov/19.2.E7 00331 * \f[ 00332 * \Pi(\phi, \alpha^2, k) = \int_0^\phi 00333 * \frac1{\sqrt{1-k^2\sin^2\theta}(1 - \alpha^2\sin^2\theta_)}\,d\theta. 00334 * \f] 00335 **********************************************************************/ 00336 Math::real Pi(real phi) const; 00337 00338 /** 00339 * Jahnke's incomplete elliptic integral. 00340 * 00341 * @param[in] phi 00342 * @return \e D(φ, \e k). 00343 * 00344 * \e D(φ, \e k) is defined in http://dlmf.nist.gov/19.2.E4 00345 * \f[ 00346 * D(\phi, k) = \int_0^\phi 00347 * \frac{\sin^2\theta}{\sqrt{1-k^2\sin^2\theta}}\,d\theta. 00348 * \f] 00349 **********************************************************************/ 00350 Math::real D(real phi) const; 00351 00352 /** 00353 * Legendre's geodesic longitude integral. 00354 * 00355 * @param[in] phi 00356 * @return \e G(φ, α<sup>2</sup>, \e k). 00357 * 00358 * \e G(φ, α<sup>2</sup>, \e k) is defined by 00359 * \f[ 00360 * \begin{align} 00361 * G(\phi, \alpha^2, k) &= 00362 * \frac{k^2}{\alpha^2} F(\phi, k) + 00363 * \biggl(1 - \frac{k^2}{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\ 00364 * &= \int_0^\phi 00365 * \frac{\sqrt{1-k^2\sin^2\theta}}{1 - \alpha^2\sin^2\theta}\,d\theta. 00366 * \end{align} 00367 * \f] 00368 * 00369 * Legendre expresses the longitude of a point on the geodesic in terms of 00370 * this combination of elliptic integrals in Exercices de Calcul 00371 * Intégral, Vol. 1 (1811), p. 181, 00372 * http://books.google.com/books?id=riIOAAAAQAAJ&pg=PA181. 00373 * 00374 * See \ref geodellip for the expression for the longitude in terms of this 00375 * function. 00376 **********************************************************************/ 00377 Math::real G(real phi) const; 00378 00379 /** 00380 * Cayley's geodesic longitude difference integral. 00381 * 00382 * @param[in] phi 00383 * @return \e H(φ, α<sup>2</sup>, \e k). 00384 * 00385 * \e H(φ, α<sup>2</sup>, \e k) is defined by 00386 * \f[ 00387 * \begin{align} 00388 * H(\phi, \alpha^2, k) &= 00389 * \frac1{\alpha^2} F(\phi, k) + 00390 * \biggl(1 - \frac1{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\ 00391 * &= \int_0^\phi 00392 * \frac{\cos^2\theta}{(1-\alpha^2\sin^2\theta)\sqrt{1-k^2\sin^2\theta}} 00393 * \,d\theta. 00394 * \end{align} 00395 * \f] 00396 * 00397 * Cayley expresses the longitude difference of a point on the geodesic in 00398 * terms of this combination of elliptic integrals in Phil. Mag. <b>40</b> 00399 * (1870), p. 333, http://books.google.com/books?id=Zk0wAAAAIAAJ&pg=PA333. 00400 * 00401 * See \ref geodellip for the expression for the longitude in terms of this 00402 * function. 00403 **********************************************************************/ 00404 Math::real H(real phi) const; 00405 ///@} 00406 00407 /** \name Incomplete integrals in terms of Jacobi elliptic functions. 00408 **********************************************************************/ 00409 /** 00410 * The incomplete integral of the first kind in terms of Jacobi elliptic 00411 * functions. 00412 * 00413 * @param[in] sn = sinφ 00414 * @param[in] cn = cosφ 00415 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00416 * sin<sup>2</sup>φ) 00417 * @return \e F(φ, \e k) as though φ ∈ (−π, π]. 00418 **********************************************************************/ 00419 Math::real F(real sn, real cn, real dn) const; 00420 00421 /** 00422 * The incomplete integral of the second kind in terms of Jacobi elliptic 00423 * functions. 00424 * 00425 * @param[in] sn = sinφ 00426 * @param[in] cn = cosφ 00427 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00428 * sin<sup>2</sup>φ) 00429 * @return \e E(φ, \e k) as though φ ∈ (−π, π]. 00430 **********************************************************************/ 00431 Math::real E(real sn, real cn, real dn) const; 00432 00433 /** 00434 * The incomplete integral of the third kind in terms of Jacobi elliptic 00435 * functions. 00436 * 00437 * @param[in] sn = sinφ 00438 * @param[in] cn = cosφ 00439 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00440 * sin<sup>2</sup>φ) 00441 * @return Π(φ, α<sup>2</sup>, \e k) as though φ ∈ 00442 * (−π, π]. 00443 **********************************************************************/ 00444 Math::real Pi(real sn, real cn, real dn) const; 00445 00446 /** 00447 * Jahnke's incomplete elliptic integral in terms of Jacobi elliptic 00448 * functions. 00449 * 00450 * @param[in] sn = sinφ 00451 * @param[in] cn = cosφ 00452 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00453 * sin<sup>2</sup>φ) 00454 * @return \e D(φ, \e k) as though φ ∈ (−π, π]. 00455 **********************************************************************/ 00456 Math::real D(real sn, real cn, real dn) const; 00457 00458 /** 00459 * Legendre's geodesic longitude integral in terms of Jacobi elliptic 00460 * functions. 00461 * 00462 * @param[in] sn = sinφ 00463 * @param[in] cn = cosφ 00464 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00465 * sin<sup>2</sup>φ) 00466 * @return \e G(φ, α<sup>2</sup>, \e k) as though φ ∈ 00467 * (−π, π]. 00468 **********************************************************************/ 00469 Math::real G(real sn, real cn, real dn) const; 00470 00471 /** 00472 * Cayley's geodesic longitude difference integral in terms of Jacobi 00473 * elliptic functions. 00474 * 00475 * @param[in] sn = sinφ 00476 * @param[in] cn = cosφ 00477 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00478 * sin<sup>2</sup>φ) 00479 * @return \e H(φ, α<sup>2</sup>, \e k) as though φ ∈ 00480 * (−π, π]. 00481 **********************************************************************/ 00482 Math::real H(real sn, real cn, real dn) const; 00483 ///@} 00484 00485 /** \name Periodic versions of incomplete elliptic integrals. 00486 **********************************************************************/ 00487 ///@{ 00488 /** 00489 * The periodic incomplete integral of the first kind. 00490 * 00491 * @param[in] sn = sinφ 00492 * @param[in] cn = cosφ 00493 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00494 * sin<sup>2</sup>φ) 00495 * @return the periodic function π \e F(φ, \e k) / (2 \e K(\e k)) - 00496 * φ 00497 **********************************************************************/ 00498 Math::real deltaF(real sn, real cn, real dn) const; 00499 00500 /** 00501 * The periodic incomplete integral of the second kind. 00502 * 00503 * @param[in] sn = sinφ 00504 * @param[in] cn = cosφ 00505 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00506 * sin<sup>2</sup>φ) 00507 * @return the periodic function π \e E(φ, \e k) / (2 \e E(\e k)) - 00508 * φ 00509 **********************************************************************/ 00510 Math::real deltaE(real sn, real cn, real dn) const; 00511 00512 /** 00513 * The periodic inverse of the incomplete integral of the second kind. 00514 * 00515 * @param[in] stau = sinτ 00516 * @param[in] ctau = sinτ 00517 * @return the periodic function <i>E</i><sup>−1</sup>(τ (2 \e 00518 * E(\e k)/π), \e k) - τ 00519 **********************************************************************/ 00520 Math::real deltaEinv(real stau, real ctau) const; 00521 00522 /** 00523 * The periodic incomplete integral of the third kind. 00524 * 00525 * @param[in] sn = sinφ 00526 * @param[in] cn = cosφ 00527 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00528 * sin<sup>2</sup>φ) 00529 * @return the periodic function π Π(φ, \e k) / (2 Π(\e k)) - 00530 * φ 00531 **********************************************************************/ 00532 Math::real deltaPi(real sn, real cn, real dn) const; 00533 00534 /** 00535 * The periodic Jahnke's incomplete elliptic integral. 00536 * 00537 * @param[in] sn = sinφ 00538 * @param[in] cn = cosφ 00539 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00540 * sin<sup>2</sup>φ) 00541 * @return the periodic function π \e D(φ, \e k) / (2 \e D(\e k)) - 00542 * φ 00543 **********************************************************************/ 00544 Math::real deltaD(real sn, real cn, real dn) const; 00545 00546 /** 00547 * Legendre's periodic geodesic longitude integral. 00548 * 00549 * @param[in] sn = sinφ 00550 * @param[in] cn = cosφ 00551 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00552 * sin<sup>2</sup>φ) 00553 * @return the periodic function π \e G(φ, \e k) / (2 \e G(\e k)) - 00554 * φ 00555 **********************************************************************/ 00556 Math::real deltaG(real sn, real cn, real dn) const; 00557 00558 /** 00559 * Cayley's periodic geodesic longitude difference integral. 00560 * 00561 * @param[in] sn = sinφ 00562 * @param[in] cn = cosφ 00563 * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup> 00564 * sin<sup>2</sup>φ) 00565 * @return the periodic function π \e H(φ, \e k) / (2 \e H(\e k)) - 00566 * φ 00567 **********************************************************************/ 00568 Math::real deltaH(real sn, real cn, real dn) const; 00569 ///@} 00570 00571 /** \name Elliptic functions. 00572 **********************************************************************/ 00573 ///@{ 00574 /** 00575 * The Jacobi elliptic functions. 00576 * 00577 * @param[in] x the argument. 00578 * @param[out] sn sn(\e x, \e k). 00579 * @param[out] cn cn(\e x, \e k). 00580 * @param[out] dn dn(\e x, \e k). 00581 **********************************************************************/ 00582 void sncndn(real x, real& sn, real& cn, real& dn) const; 00583 00584 /** 00585 * The Δ amplitude function. 00586 * 00587 * @param[in] sn sinφ 00588 * @param[in] cn cosφ 00589 * @return Δ = sqrt(1 − <i>k</i><sup>2</sup> 00590 * sin<sup>2</sup>φ) 00591 **********************************************************************/ 00592 Math::real Delta(real sn, real cn) const { 00593 using std::sqrt; 00594 return sqrt(_k2 < 0 ? 1 - _k2 * sn*sn : _kp2 + _k2 * cn*cn); 00595 } 00596 ///@} 00597 00598 /** \name Symmetric elliptic integrals. 00599 **********************************************************************/ 00600 ///@{ 00601 /** 00602 * Symmetric integral of the first kind <i>R</i><sub><i>F</i></sub>. 00603 * 00604 * @param[in] x 00605 * @param[in] y 00606 * @param[in] z 00607 * @return <i>R</i><sub><i>F</i></sub>(\e x, \e y, \e z) 00608 * 00609 * <i>R</i><sub><i>F</i></sub> is defined in http://dlmf.nist.gov/19.16.E1 00610 * \f[ R_F(x, y, z) = \frac12 00611 * \int_0^\infty\frac1{\sqrt{(t + x) (t + y) (t + z)}}\, dt \f] 00612 * If one of the arguments is zero, it is more efficient to call the 00613 * two-argument version of this function with the non-zero arguments. 00614 **********************************************************************/ 00615 static real RF(real x, real y, real z); 00616 00617 /** 00618 * Complete symmetric integral of the first kind, 00619 * <i>R</i><sub><i>F</i></sub> with one argument zero. 00620 * 00621 * @param[in] x 00622 * @param[in] y 00623 * @return <i>R</i><sub><i>F</i></sub>(\e x, \e y, 0) 00624 **********************************************************************/ 00625 static real RF(real x, real y); 00626 00627 /** 00628 * Degenerate symmetric integral of the first kind 00629 * <i>R</i><sub><i>C</i></sub>. 00630 * 00631 * @param[in] x 00632 * @param[in] y 00633 * @return <i>R</i><sub><i>C</i></sub>(\e x, \e y) = 00634 * <i>R</i><sub><i>F</i></sub>(\e x, \e y, \e y) 00635 * 00636 * <i>R</i><sub><i>C</i></sub> is defined in http://dlmf.nist.gov/19.2.E17 00637 * \f[ R_C(x, y) = \frac12 00638 * \int_0^\infty\frac1{\sqrt{t + x}(t + y)}\,dt \f] 00639 **********************************************************************/ 00640 static real RC(real x, real y); 00641 00642 /** 00643 * Symmetric integral of the second kind <i>R</i><sub><i>G</i></sub>. 00644 * 00645 * @param[in] x 00646 * @param[in] y 00647 * @param[in] z 00648 * @return <i>R</i><sub><i>G</i></sub>(\e x, \e y, \e z) 00649 * 00650 * <i>R</i><sub><i>G</i></sub> is defined in Carlson, eq 1.5 00651 * \f[ R_G(x, y, z) = \frac14 00652 * \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2} 00653 * \biggl( 00654 * \frac x{t + x} + \frac y{t + y} + \frac z{t + z} 00655 * \biggr)t\,dt \f] 00656 * See also http://dlmf.nist.gov/19.16.E3. 00657 * If one of the arguments is zero, it is more efficient to call the 00658 * two-argument version of this function with the non-zero arguments. 00659 **********************************************************************/ 00660 static real RG(real x, real y, real z); 00661 00662 /** 00663 * Complete symmetric integral of the second kind, 00664 * <i>R</i><sub><i>G</i></sub> with one argument zero. 00665 * 00666 * @param[in] x 00667 * @param[in] y 00668 * @return <i>R</i><sub><i>G</i></sub>(\e x, \e y, 0) 00669 **********************************************************************/ 00670 static real RG(real x, real y); 00671 00672 /** 00673 * Symmetric integral of the third kind <i>R</i><sub><i>J</i></sub>. 00674 * 00675 * @param[in] x 00676 * @param[in] y 00677 * @param[in] z 00678 * @param[in] p 00679 * @return <i>R</i><sub><i>J</i></sub>(\e x, \e y, \e z, \e p) 00680 * 00681 * <i>R</i><sub><i>J</i></sub> is defined in http://dlmf.nist.gov/19.16.E2 00682 * \f[ R_J(x, y, z, p) = \frac32 00683 * \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2} (t + p)^{-1}\, dt \f] 00684 **********************************************************************/ 00685 static real RJ(real x, real y, real z, real p); 00686 00687 /** 00688 * Degenerate symmetric integral of the third kind 00689 * <i>R</i><sub><i>D</i></sub>. 00690 * 00691 * @param[in] x 00692 * @param[in] y 00693 * @param[in] z 00694 * @return <i>R</i><sub><i>D</i></sub>(\e x, \e y, \e z) = 00695 * <i>R</i><sub><i>J</i></sub>(\e x, \e y, \e z, \e z) 00696 * 00697 * <i>R</i><sub><i>D</i></sub> is defined in http://dlmf.nist.gov/19.16.E5 00698 * \f[ R_D(x, y, z) = \frac32 00699 * \int_0^\infty[(t + x) (t + y)]^{-1/2} (t + z)^{-3/2}\, dt \f] 00700 **********************************************************************/ 00701 static real RD(real x, real y, real z); 00702 ///@} 00703 00704 }; 00705 00706 } // namespace GeographicLib 00707 00708 #endif // GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP