.NET wrapper for GeographicLib::EllipticFunction. More...
#include <NETGeographicLib/EllipticFunction.h>
Public Member Functions | |
Constructor | |
EllipticFunction (double k2, double alpha2) | |
EllipticFunction (double k2, double alpha2, double kp2, double alphap2) | |
~EllipticFunction () | |
void | Reset (double k2, double alpha2) |
void | Reset (double k2, double alpha2, double kp2, double alphap2) |
Complete elliptic integrals. | |
double | K () |
double | E () |
double | D () |
double | KE () |
double | Pi () |
double | G () |
double | H () |
Incomplete elliptic integrals. | |
double | F (double phi) |
double | E (double phi) |
double | Ed (double ang) |
double | Einv (double x) |
double | Pi (double phi) |
double | D (double phi) |
double | G (double phi) |
double | H (double phi) |
Incomplete integrals in terms of Jacobi elliptic functions. | |
double | F (double sn, double cn, double dn) |
double | E (double sn, double cn, double dn) |
double | Pi (double sn, double cn, double dn) |
double | D (double sn, double cn, double dn) |
double | G (double sn, double cn, double dn) |
double | H (double sn, double cn, double dn) |
Periodic versions of incomplete elliptic integrals. | |
double | deltaF (double sn, double cn, double dn) |
double | deltaE (double sn, double cn, double dn) |
double | deltaEinv (double stau, double ctau) |
double | deltaPi (double sn, double cn, double dn) |
double | deltaD (double sn, double cn, double dn) |
double | deltaG (double sn, double cn, double dn) |
double | deltaH (double sn, double cn, double dn) |
Elliptic functions. | |
void | sncndn (double x,[System::Runtime::InteropServices::Out] double% sn,[System::Runtime::InteropServices::Out] double% cn,[System::Runtime::InteropServices::Out] double% dn) |
double | Delta (double sn, double cn) |
Static Public Member Functions | |
Symmetric elliptic integrals. | |
static double | RF (double x, double y, double z) |
static double | RF (double x, double y) |
static double | RC (double x, double y) |
static double | RG (double x, double y, double z) |
static double | RG (double x, double y) |
static double | RJ (double x, double y, double z, double p) |
static double | RD (double x, double y, double z) |
Properties | |
Inspector functions. | |
double | k2 [get] |
double | kp2 [get] |
double | alpha2 [get] |
double | alphap2 [get] |
.NET wrapper for GeographicLib::EllipticFunction.
This class allows .NET applications to access GeographicLib::EllipticFunction.
This provides the elliptic functions and integrals needed for Ellipsoid, GeodesicExact, and TransverseMercatorExact. Two categories of function are provided:
In the latter case, an object is constructed giving the modulus k (and optionally the parameter 2). The modulus is always passed as its square k2 which allows k to be pure imaginary (k2 < 0). (Confusingly, Abramowitz and Stegun call m = k2 the "parameter" and n = 2 the "characteristic".)
In geodesic applications, it is convenient to separate the incomplete integrals into secular and periodic components, e.g.,
where E(, k) is an odd periodic function with period .
The computation of the elliptic integrals uses the algorithms given in
with the additional optimizations given in http://dlmf.nist.gov/19.36.i. The computation of the Jacobi elliptic functions uses the algorithm given in
The notation follows http://dlmf.nist.gov/19 and http://dlmf.nist.gov/22
C# Example:
using System; using NETGeographicLib; namespace example_EllipticFunction { class Program { static void Main(string[] args) { try { EllipticFunction ell = new EllipticFunction(0.1, 1.0); // parameter m = 0.1 // See Abramowitz and Stegun, table 17.1 Console.WriteLine( String.Format( "{0} {1}", ell.K(), ell.E())); double phi = 20 * Math.Acos(-1.0) / 180.0;; // See Abramowitz and Stegun, table 17.6 with // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg Console.WriteLine( String.Format("{0} {1}", ell.E(phi), ell.E(Math.Sin(phi), Math.Cos(phi), Math.Sqrt(1 - ell.k2 * Math.Sin(phi) * Math.Sin(phi))) ) ); // See Carlson 1995, Sec 3. Console.WriteLine(String.Format("RF(1,2,0) = {0}", EllipticFunction.RF(1,2))); Console.WriteLine(String.Format("RF(2,3,4) = {0}", EllipticFunction.RF(2,3,4))); Console.WriteLine(String.Format("RC(0,1/4) = {0}", EllipticFunction.RC(0,0.25))); Console.WriteLine(String.Format("RC(9/4,2) = {0}", EllipticFunction.RC(2.25,2))); Console.WriteLine(String.Format("RC(1/4,-2) = {0}", EllipticFunction.RC(0.25,-2))); Console.WriteLine(String.Format("RJ(0,1,2,3) = {0}", EllipticFunction.RJ(0,1,2,3))); Console.WriteLine(String.Format("RJ(2,3,4,5) = {0}", EllipticFunction.RJ(2,3,4,5))); Console.WriteLine(String.Format("RD(0,2,1) = {0}", EllipticFunction.RD(0,2,1))); Console.WriteLine(String.Format("RD(2,3,4) = {0}", EllipticFunction.RD(2,3,4))); Console.WriteLine(String.Format("RG(0,16,16) = {0}", EllipticFunction.RG(16,16))); Console.WriteLine(String.Format("RG(2,3,4) = {0}", EllipticFunction.RG(2,3,4))); Console.WriteLine(String.Format("RG(0,0.0796,4) = {0}", EllipticFunction.RG(0.0796, 4))); } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } }
Managed C++ Example:
using namespace System; using namespace NETGeographicLib; int main(array<System::String ^> ^/*args*/) { try { EllipticFunction^ ell = gcnew EllipticFunction(0.1, 1.0); // parameter m = 0.1 // See Abramowitz and Stegun, table 17.1 Console::WriteLine( String::Format( "{0} {1}", ell->K(), ell->E())); double phi = 20 * Math::Acos(-1.0) / 180.0;; // See Abramowitz and Stegun, table 17.6 with // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg Console::WriteLine( String::Format("{0} {1}", ell->E(phi), ell->E(Math::Sin(phi), Math::Cos(phi), Math::Sqrt(1 - ell->k2 * Math::Sin(phi) * Math::Sin(phi))) ) ); // See Carlson 1995, Sec 3. Console::WriteLine(String::Format("RF(1,2,0) = {0}", EllipticFunction::RF(1,2))); Console::WriteLine(String::Format("RF(2,3,4) = {0}", EllipticFunction::RF(2,3,4))); Console::WriteLine(String::Format("RC(0,1/4) = {0}", EllipticFunction::RC(0,0.25))); Console::WriteLine(String::Format("RC(9/4,2) = {0}", EllipticFunction::RC(2.25,2))); Console::WriteLine(String::Format("RC(1/4,-2) = {0}", EllipticFunction::RC(0.25,-2))); Console::WriteLine(String::Format("RJ(0,1,2,3) = {0}", EllipticFunction::RJ(0,1,2,3))); Console::WriteLine(String::Format("RJ(2,3,4,5) = {0}", EllipticFunction::RJ(2,3,4,5))); Console::WriteLine(String::Format("RD(0,2,1) = {0}", EllipticFunction::RD(0,2,1))); Console::WriteLine(String::Format("RD(2,3,4) = {0}", EllipticFunction::RD(2,3,4))); Console::WriteLine(String::Format("RG(0,16,16) = {0}", EllipticFunction::RG(16,16))); Console::WriteLine(String::Format("RG(2,3,4) = {0}", EllipticFunction::RG(2,3,4))); Console::WriteLine(String::Format("RG(0,0.0796,4) = {0}", EllipticFunction::RG(0.0796, 4))); } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; }
Visual Basic Example:
Imports NETGeographicLib Module example_EllipticFunction Sub Main() Try Dim ell As EllipticFunction = New EllipticFunction(0.1, 1.0) ' See Abramowitz and Stegun, table 17.1 Console.WriteLine(String.Format("{0} {1}", ell.K(), ell.E())) Dim phi As Double = 20 * Math.Acos(-1.0) / 180.0 ' See Abramowitz and Stegun, table 17.6 with ' alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg Console.WriteLine(String.Format("{0} {1}", ell.E(phi), ell.E(Math.Sin(phi), Math.Cos(phi), Math.Sqrt(1 - ell.k2 * Math.Sin(phi) * Math.Sin(phi))))) ' See Carlson 1995, Sec 3. Console.WriteLine(String.Format("RF(1,2,0) = {0}", EllipticFunction.RF(1, 2))) Console.WriteLine(String.Format("RF(2,3,4) = {0}", EllipticFunction.RF(2, 3, 4))) Console.WriteLine(String.Format("RC(0,1/4) = {0}", EllipticFunction.RC(0, 0.25))) Console.WriteLine(String.Format("RC(9/4,2) = {0}", EllipticFunction.RC(2.25, 2))) Console.WriteLine(String.Format("RC(1/4,-2) = {0}", EllipticFunction.RC(0.25, -2))) Console.WriteLine(String.Format("RJ(0,1,2,3) = {0}", EllipticFunction.RJ(0, 1, 2, 3))) Console.WriteLine(String.Format("RJ(2,3,4,5) = {0}", EllipticFunction.RJ(2, 3, 4, 5))) Console.WriteLine(String.Format("RD(0,2,1) = {0}", EllipticFunction.RD(0, 2, 1))) Console.WriteLine(String.Format("RD(2,3,4) = {0}", EllipticFunction.RD(2, 3, 4))) Console.WriteLine(String.Format("RG(0,16,16) = {0}", EllipticFunction.RG(16, 16))) Console.WriteLine(String.Format("RG(2,3,4) = {0}", EllipticFunction.RG(2, 3, 4))) Console.WriteLine(String.Format("RG(0,0.0796,4) = {0}", EllipticFunction.RG(0.0796, 4))) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module
INTERFACE DIFFERENCES:
The k2, kp2, alpha2, and alphap2 functions are implemented as properties.
Definition at line 69 of file EllipticFunction.h.
NETGeographicLib::EllipticFunction::EllipticFunction | ( | double | k2, | |
double | alpha2 | |||
) |
Constructor specifying the modulus and parameter.
[in] | k2 | the square of the modulus k2. k2 must lie in (-, 1). (No checking is done.) |
[in] | alpha2 | the parameter 2. 2 must lie in (-, 1). (No checking is done.) |
If only elliptic integrals of the first and second kinds are needed, then set 2 = 0 (the default value); in this case, we have (, 0, k) = F(, k), G(, 0, k) = E(, k), and H(, 0, k) = F(, k) - D(, k).
Referenced by ~EllipticFunction().
NETGeographicLib::EllipticFunction::EllipticFunction | ( | double | k2, | |
double | alpha2, | |||
double | kp2, | |||
double | alphap2 | |||
) |
Constructor specifying the modulus and parameter and their complements.
[in] | k2 | the square of the modulus k2. k2 must lie in (-, 1). (No checking is done.) |
[in] | alpha2 | the parameter 2. 2 must lie in (-, 1). (No checking is done.) |
[in] | kp2 | the complementary modulus squared k'2 = 1 k2. |
[in] | alphap2 | the complementary parameter '2 = 1 2. |
The arguments must satisfy k2 + kp2 = 1 and alpha2 + alphap2 = 1. (No checking is done that these conditions are met.) This constructor is provided to enable accuracy to be maintained, e.g., when k is very close to unity.
NETGeographicLib::EllipticFunction::~EllipticFunction | ( | ) | [inline] |
Destructor calls the finalizer.
Definition at line 121 of file EllipticFunction.h.
References EllipticFunction().
void NETGeographicLib::EllipticFunction::Reset | ( | double | k2, | |
double | alpha2 | |||
) |
Reset the modulus and parameter.
[in] | k2 | the new value of square of the modulus k2 which must lie in (-, 1). (No checking is done.) |
[in] | alpha2 | the new value of parameter 2. 2 must lie in (-, 1). (No checking is done.) |
void NETGeographicLib::EllipticFunction::Reset | ( | double | k2, | |
double | alpha2, | |||
double | kp2, | |||
double | alphap2 | |||
) |
Reset the modulus and parameter supplying also their complements.
[in] | k2 | the square of the modulus k2. k2 must lie in (-, 1). (No checking is done.) |
[in] | alpha2 | the parameter 2. 2 must lie in (-, 1). (No checking is done.) |
[in] | kp2 | the complementary modulus squared k'2 = 1 k2. |
[in] | alphap2 | the complementary parameter '2 = 1 2. |
The arguments must satisfy k2 + kp2 = 1 and alpha2 + alphap2 = 1. (No checking is done that these conditions are met.) This constructor is provided to enable accuracy to be maintained, e.g., when is very small.
double NETGeographicLib::EllipticFunction::K | ( | ) |
The complete integral of the first kind.
K(k) is defined in http://dlmf.nist.gov/19.2.E4
double NETGeographicLib::EllipticFunction::E | ( | ) |
The complete integral of the second kind.
E(k) is defined in http://dlmf.nist.gov/19.2.E5
double NETGeographicLib::EllipticFunction::D | ( | ) |
double NETGeographicLib::EllipticFunction::KE | ( | ) |
The difference between the complete integrals of the first and second kinds.
double NETGeographicLib::EllipticFunction::Pi | ( | ) |
The complete integral of the third kind.
(2, k) is defined in http://dlmf.nist.gov/19.2.E7
double NETGeographicLib::EllipticFunction::G | ( | ) |
Legendre's complete geodesic longitude integral.
G(2, k) is given by
double NETGeographicLib::EllipticFunction::H | ( | ) |
Cayley's complete geodesic longitude difference integral.
H(2, k) is given by
double NETGeographicLib::EllipticFunction::F | ( | double | phi | ) |
The incomplete integral of the first kind.
[in] | phi |
F(, k) is defined in http://dlmf.nist.gov/19.2.E4
double NETGeographicLib::EllipticFunction::E | ( | double | phi | ) |
The incomplete integral of the second kind.
[in] | phi |
E(, k) is defined in http://dlmf.nist.gov/19.2.E5
double NETGeographicLib::EllipticFunction::Ed | ( | double | ang | ) |
The incomplete integral of the second kind with the argument given in degrees.
[in] | ang | in degrees. |
double NETGeographicLib::EllipticFunction::Einv | ( | double | x | ) |
The inverse of the incomplete integral of the second kind.
[in] | x |
double NETGeographicLib::EllipticFunction::Pi | ( | double | phi | ) |
The incomplete integral of the third kind.
[in] | phi |
(, 2, k) is defined in http://dlmf.nist.gov/19.2.E7
double NETGeographicLib::EllipticFunction::D | ( | double | phi | ) |
Jahnke's incomplete elliptic integral.
[in] | phi |
D(, k) is defined in http://dlmf.nist.gov/19.2.E4
double NETGeographicLib::EllipticFunction::G | ( | double | phi | ) |
Legendre's geodesic longitude integral.
[in] | phi |
G(, 2, k) is defined by
Legendre expresses the longitude of a point on the geodesic in terms of this combination of elliptic integrals in Exercices de Calcul Intégral, Vol. 1 (1811), p. 181, http://books.google.com/books?id=riIOAAAAQAAJ&pg=PA181.
See geodellip for the expression for the longitude in terms of this function.
double NETGeographicLib::EllipticFunction::H | ( | double | phi | ) |
Cayley's geodesic longitude difference integral.
[in] | phi |
H(, 2, k) is defined by
Cayley expresses the longitude difference of a point on the geodesic in terms of this combination of elliptic integrals in Phil. Mag. 40 (1870), p. 333, http://books.google.com/books?id=Zk0wAAAAIAAJ&pg=PA333.
See geodellip for the expression for the longitude in terms of this function.
double NETGeographicLib::EllipticFunction::F | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
The incomplete integral of the first kind in terms of Jacobi elliptic functions.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::E | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
The incomplete integral of the second kind in terms of Jacobi elliptic functions.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::Pi | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
The incomplete integral of the third kind in terms of Jacobi elliptic functions.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::D | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
Jahnke's incomplete elliptic integral in terms of Jacobi elliptic functions.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::G | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
Legendre's geodesic longitude integral in terms of Jacobi elliptic functions.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::H | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
Cayley's geodesic longitude difference integral in terms of Jacobi elliptic functions.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::deltaF | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
The periodic incomplete integral of the first kind.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::deltaE | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
The periodic incomplete integral of the second kind.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::deltaEinv | ( | double | stau, | |
double | ctau | |||
) |
The periodic inverse of the incomplete integral of the second kind.
[in] | stau | = sin |
[in] | ctau | = sin |
double NETGeographicLib::EllipticFunction::deltaPi | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
The periodic incomplete integral of the third kind.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::deltaD | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
The periodic Jahnke's incomplete elliptic integral.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::deltaG | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
Legendre's periodic geodesic longitude integral.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
double NETGeographicLib::EllipticFunction::deltaH | ( | double | sn, | |
double | cn, | |||
double | dn | |||
) |
Cayley's periodic geodesic longitude difference integral.
[in] | sn | = sin |
[in] | cn | = cos |
[in] | dn | = sqrt(1 k2 sin2) |
void NETGeographicLib::EllipticFunction::sncndn | ( | double | x, | |
[System::Runtime::InteropServices::Out] double% | sn, | |||
[System::Runtime::InteropServices::Out] double% | cn, | |||
[System::Runtime::InteropServices::Out] double% | dn | |||
) |
The Jacobi elliptic functions.
[in] | x | the argument. |
[out] | sn | sn(x, k). |
[out] | cn | cn(x, k). |
[out] | dn | dn(x, k). |
double NETGeographicLib::EllipticFunction::Delta | ( | double | sn, | |
double | cn | |||
) |
The amplitude function.
[in] | sn | sin |
[in] | cn | cos |
static double NETGeographicLib::EllipticFunction::RF | ( | double | x, | |
double | y, | |||
double | z | |||
) | [static] |
Symmetric integral of the first kind RF.
[in] | x | |
[in] | y | |
[in] | z |
RF is defined in http://dlmf.nist.gov/19.16.E1
If one of the arguments is zero, it is more efficient to call the two-argument version of this function with the non-zero arguments.
static double NETGeographicLib::EllipticFunction::RF | ( | double | x, | |
double | y | |||
) | [static] |
Complete symmetric integral of the first kind, RF with one argument zero.
[in] | x | |
[in] | y |
static double NETGeographicLib::EllipticFunction::RC | ( | double | x, | |
double | y | |||
) | [static] |
Degenerate symmetric integral of the first kind RC.
[in] | x | |
[in] | y |
RC is defined in http://dlmf.nist.gov/19.2.E17
static double NETGeographicLib::EllipticFunction::RG | ( | double | x, | |
double | y, | |||
double | z | |||
) | [static] |
Symmetric integral of the second kind RG.
[in] | x | |
[in] | y | |
[in] | z |
RG is defined in Carlson, eq 1.5
See also http://dlmf.nist.gov/19.16.E3. If one of the arguments is zero, it is more efficient to call the two-argument version of this function with the non-zero arguments.
static double NETGeographicLib::EllipticFunction::RG | ( | double | x, | |
double | y | |||
) | [static] |
Complete symmetric integral of the second kind, RG with one argument zero.
[in] | x | |
[in] | y |
static double NETGeographicLib::EllipticFunction::RJ | ( | double | x, | |
double | y, | |||
double | z, | |||
double | p | |||
) | [static] |
Symmetric integral of the third kind RJ.
[in] | x | |
[in] | y | |
[in] | z | |
[in] | p |
RJ is defined in http://dlmf.nist.gov/19.16.E2
static double NETGeographicLib::EllipticFunction::RD | ( | double | x, | |
double | y, | |||
double | z | |||
) | [static] |
Degenerate symmetric integral of the third kind RD.
[in] | x | |
[in] | y | |
[in] | z |
RD is defined in http://dlmf.nist.gov/19.16.E5
double NETGeographicLib::EllipticFunction::k2 [get] |
Definition at line 163 of file EllipticFunction.h.
double NETGeographicLib::EllipticFunction::kp2 [get] |
Definition at line 169 of file EllipticFunction.h.
double NETGeographicLib::EllipticFunction::alpha2 [get] |
Definition at line 174 of file EllipticFunction.h.
double NETGeographicLib::EllipticFunction::alphap2 [get] |
Definition at line 180 of file EllipticFunction.h.