examples/example-EllipticFunction.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::EllipticFunction class
2 
3 #include <iostream>
4 #include <iomanip>
5 #include <exception>
6 #include <cmath>
7 #include <GeographicLib/Math.hpp>
9 
10 using namespace std;
11 using namespace GeographicLib;
12 
13 int main() {
14  try {
15  EllipticFunction ell(0.1); // parameter m = 0.1
16  // See Abramowitz and Stegun, table 17.1
17  cout << ell.K() << " " << ell.E() << "\n";
18  double phi = 20, sn, cn;
19  Math::sincosd(phi, sn ,cn);
20  // See Abramowitz and Stegun, table 17.6 with
21  // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg
22  cout << ell.E(phi * Math::degree()) << " "
23  << ell.E(sn, cn, ell.Delta(sn, cn))
24  << "\n";
25  // See Carlson 1995, Sec 3.
26  cout << fixed << setprecision(16)
27  << "RF(1,2,0) = " << EllipticFunction::RF(1,2) << "\n"
28  << "RF(2,3,4) = " << EllipticFunction::RF(2,3,4) << "\n"
29  << "RC(0,1/4) = " << EllipticFunction::RC(0,0.25) << "\n"
30  << "RC(9/4,2) = " << EllipticFunction::RC(2.25,2) << "\n"
31  << "RC(1/4,-2) = " << EllipticFunction::RC(0.25,-2) << "\n"
32  << "RJ(0,1,2,3) = " << EllipticFunction::RJ(0,1,2,3) << "\n"
33  << "RJ(2,3,4,5) = " << EllipticFunction::RJ(2,3,4,5) << "\n"
34  << "RD(0,2,1) = " << EllipticFunction::RD(0,2,1) << "\n"
35  << "RD(2,3,4) = " << EllipticFunction::RD(2,3,4) << "\n"
36  << "RG(0,16,16) = " << EllipticFunction::RG(16,16) << "\n"
37  << "RG(2,3,4) = " << EllipticFunction::RG(2,3,4) << "\n"
38  << "RG(0,0.0796,4) = " << EllipticFunction::RG(0.0796,4) << "\n";
39  }
40  catch (const exception& e) {
41  cout << "Caught exception: " << e.what() << "\n";
42  }
43 }
Definition: Half.h:150
Elliptic integrals and functions.
Math::real Delta(real sn, real cn) const
const double degree
Header for GeographicLib::Math class.
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Header for GeographicLib::EllipticFunction class.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:02