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 }
GeographicLib::EllipticFunction::Delta
Math::real Delta(real sn, real cn) const
Definition: EllipticFunction.hpp:584
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
EllipticFunction.hpp
Header for GeographicLib::EllipticFunction class.
GeographicLib::EllipticFunction
Elliptic integrals and functions.
Definition: EllipticFunction.hpp:62
GeographicLib::EllipticFunction::K
Math::real K() const
Definition: EllipticFunction.hpp:190
cn
static double cn[6]
Definition: fresnl.c:83
degree
const double degree
Definition: SimpleRotation.cpp:59
Math.hpp
Header for GeographicLib::Math class.
sn
static double sn[6]
Definition: fresnl.c:63
std
Definition: BFloat16.h:88
main
int main()
Definition: examples/example-EllipticFunction.cpp:13
GeographicLib::EllipticFunction::E
Math::real E() const
Definition: EllipticFunction.hpp:202


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:16