Elliptic

Trait Elliptic 

Source
pub trait Elliptic: Sized {
Show 22 methods // Required methods fn elliptic_k(self) -> Self; fn elliptic_e(self) -> Self; fn elliptic_pi(self, n: Self) -> Self; fn elliptic_d(self) -> Self; fn inc_elliptic_f(self, phi: Self) -> Self; fn inc_elliptic_e(self, phi: Self) -> Self; fn inc_elliptic_pi(self, phi: Self, n: Self) -> Self; fn inc_elliptic_pi_bulirsch(self, phi: Self, n: Self) -> Self; fn inc_elliptic_d(self, phi: Self) -> Self; fn elliptic_rf(self, y: Self, z: Self) -> Self; fn elliptic_rg(self, y: Self, z: Self) -> Self; fn elliptic_rj(self, y: Self, z: Self, p: Self) -> Self; fn elliptic_rc(self, y: Self) -> Self; fn elliptic_rd(self, y: Self, z: Self) -> Self; fn elliptic_bulirsch(self, p: Self, a: Self, b: Self) -> Self; fn elliptic_bulirsch_1(self) -> Self; fn elliptic_bulirsch_2(self, a: Self, b: Self) -> Self; fn inc_elliptic_bulirsch_1(self, x: Self) -> Self; fn inc_elliptic_bulirsch_2(self, x: Self, a: Self, b: Self) -> Self; fn inc_elliptic_bulirsch_3(self, x: Self, p: Self) -> Self; fn jacobi_zeta(self, phi: Self) -> Self; fn heuman_lambda(self, phi: Self) -> Self;
}
Expand description

Elliptic integrals.

Required Methods§

Source

fn elliptic_k(self) -> Self

Compute the complete elliptic integral in Legendre’s form of the first kind (K).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
§Examples
use special::Elliptic;

let m = 0.5;
assert::close(m.elliptic_k(), 1.8540746773013719, 1e-15)
§Panics

The function panics if m > 1.

Source

fn elliptic_e(self) -> Self

Compute the complete elliptic integral in Legendre’s form of the second kind (E).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
§Examples
use special::Elliptic;

let m = 0.5;
assert::close(m.elliptic_e(), 1.3506438810476755, 1e-15)
§Panics

The function panics if m > 1.

Source

fn elliptic_pi(self, n: Self) -> Self

Compute the complete elliptic integral in Legendre’s form of the third kind (Π).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
  • n: characteristic (n)
§Examples
use special::Elliptic;

let m = 0.5;
let n = 0.5;
assert::close(m.elliptic_pi(n), 2.7012877620953506, 1e-15)
§Panics

The function panics if m > 1.

Source

fn elliptic_d(self) -> Self

Compute the complete elliptic integral in Legendre’s form of Legendre’s type (D).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
§Examples
use special::Elliptic;

let m = 0.5;
assert::close(m.elliptic_d(), 1.0068615925073927, 1e-15)
§Panics

The function panics if m > 1.

Source

fn inc_elliptic_f(self, phi: Self) -> Self

Compute the incomplete elliptic integral in Legendre’s form of the first kind (F).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
  • phi: amplitude angle (φ)
§Examples
use special::Elliptic;

let m = 0.5;
let phi = std::f64::consts::FRAC_PI_4;
assert::close(m.inc_elliptic_f(phi), 0.826017876249245, 1e-15)
§Panics

The function panics if m sin²φ > 1.

Source

fn inc_elliptic_e(self, phi: Self) -> Self

Compute the incomplete elliptic integral in Legendre’s form of the second kind (E).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
  • phi: amplitude angle (φ)
§Examples
use special::Elliptic;

let m = 0.5;
let phi = std::f64::consts::FRAC_PI_4;
assert::close(m.inc_elliptic_e(phi), 0.7481865041776612, 1e-15)
§Panics

The function panics if m sin²φ > 1.

Source

fn inc_elliptic_pi(self, phi: Self, n: Self) -> Self

Compute the incomplete elliptic integral in Legendre’s form of the third kind (Π).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
  • phi: amplitude angle (φ)
  • n: characteristic
§Examples
use special::Elliptic;

let m = 0.5;
let phi = std::f64::consts::FRAC_PI_4;
let n = 0.5;
assert::close(m.inc_elliptic_pi(phi, n), 0.9190227391656969, 1e-15)
§Panics

The function panics if m sin²φ > 1, n sin²φ = 1, or m ≥ 1 and φ is not a multiple of π/2.

Source

fn inc_elliptic_pi_bulirsch(self, phi: Self, n: Self) -> Self

Compute the incomplete elliptic integral in Legendre’s form of the third kind (Π) using Bulirsch’s method.

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
  • phi: amplitude angle (φ)
  • n: characteristic
§Examples
use special::Elliptic;

let m = 0.5;
let phi = std::f64::consts::FRAC_PI_4;
let n = 0.5;
assert::close(m.inc_elliptic_pi_bulirsch(phi, n), 0.9190227391656969, 1e-15)
§Panics

The function panics if m sin²φ > 1, n sin²φ = 1, or m ≥ 1 and φ is not a multiple of π/2.

Source

fn inc_elliptic_d(self, phi: Self) -> Self

Compute the incomplete elliptic integral in Legendre’s form of Legendre’s type (D).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
  • phi: amplitude angle (φ)
§Examples
use special::Elliptic;

let m = 0.5;
let phi = std::f64::consts::FRAC_PI_4;
assert::close(m.inc_elliptic_d(phi), 0.15566274414316758, 1e-15)
§Panics

The function panics if m sin²φ > 1.

Source

fn elliptic_rf(self, y: Self, z: Self) -> Self

Compute the elliptic integral in Carlson’s form of the first kind (RF).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self, y, and z: symmetric arguments
§Examples
use special::Elliptic;

let x = 1.0;
let y = 0.5;
let z = 0.25;

assert::close(x.elliptic_rf(y, z), 1.370171633266872, 1e-15)
§Panics

The function panics if any of x, y, or z is negative, or more than one of them are zero.

Source

fn elliptic_rg(self, y: Self, z: Self) -> Self

Compute the elliptic integral in Carlson’s form of the second kind (RG).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self, y, and z: symmetric arguments
§Examples
use special::Elliptic;

let x = 1.0;
let y = 0.5;
let z = 0.25;

assert::close(x.elliptic_rg(y, z), 0.7526721491833781, 1e-15)
§Panics

The function panics if any of x, y, or z is negative or infinite.

Source

fn elliptic_rj(self, y: Self, z: Self, p: Self) -> Self

Compute the elliptic integral in Carlson’s form of the third kind (RJ).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self, y, and z: symmetric arguments
  • p: parameter
§Examples
use special::Elliptic;

let x = 1.0;
let y = 0.5;
let z = 0.25;
let p = 0.125;

assert::close(x.elliptic_rj(y, z, p), 5.680557292035963, 1e-15)
§Panics

The function panics if p = 0, any of x, y, or z is negative, or more than one of them are zero.

Source

fn elliptic_rc(self, y: Self) -> Self

Compute the degenerate elliptic integral in Carlson’s form (RC).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self and y: symmetric arguments
§Examples
use special::Elliptic;

let x = 1.0;
let y = 0.5;

assert::close(x.elliptic_rc(y), 1.2464504802804608, 1e-15)
§Panics

The function panics if x < 0, y = 0, or y < 0.

Source

fn elliptic_rd(self, y: Self, z: Self) -> Self

Compute the elliptic integral in Carlson’s form of the second kind (RD).

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self, y, and z: symmetric arguments
§Examples
use special::Elliptic;

let x = 1.0;
let y = 0.5;
let z = 0.25;

assert::close(x.elliptic_rd(y, z), 4.022594757168912, 1e-15)
§Panics

The function panics if x < 0, y < 0, z ≤ 0, or when both x and y are zero.

Source

fn elliptic_bulirsch(self, p: Self, a: Self, b: Self) -> Self

Compute the general complete elliptic integral in Bulirsch’s form.

The implementation is based on ellip by Sira Pornsiriprasert. Note that the original literature by Bulirsch used the complementary modulus kc where kc = √(1 - m).

§Parameters
  • self: elliptic parameter (m)
  • p: parameter
  • a and b: coefficients
§Examples
use special::Elliptic;

let m = 0.5;
let p = 1.0;
let a = 1.0;
let b = 1.0;

assert::close(m.elliptic_bulirsch(p, a, b), 1.8540746773013717, 1e-15)
§Panics

The function panics if m = 1, p = 0, or more than one arguments are infinite.

Source

fn elliptic_bulirsch_1(self) -> Self

Compute the complete elliptic integral in Bulirsch’s form of the first kind.

The implementation is based on ellip by Sira Pornsiriprasert. Note that the original literature by Bulirsch used the complementary modulus kc where kc = √(1 - m).

§Parameters
  • self: elliptic parameter (m)
§Examples
use special::Elliptic;

let m = 0.5;

assert::close(m.elliptic_bulirsch_1(), 1.8540746773013717, 1e-15)
§Panics

The function panics if m = 1.

Source

fn elliptic_bulirsch_2(self, a: Self, b: Self) -> Self

Compute the complete elliptic integral in Bulirsch’s form of the second kind.

The implementation is based on ellip by Sira Pornsiriprasert. Note that the original literature by Bulirsch used the complementary modulus kc where kc = √(1 - m).

§Parameters
  • self: elliptic parameter (m)
  • a and b: coefficients
§Examples
use special::Elliptic;

let m = 0.5;
let a = 1.0;
let b = 1.0;

assert::close(m.elliptic_bulirsch_2(a, b), 1.8540746773013717, 1e-15)
§Panics

The function panics if m = 1 or more than one arguments are infinite.

Source

fn inc_elliptic_bulirsch_1(self, x: Self) -> Self

Compute the incomplete elliptic integral Bulirsch’s form of the first kind.

The implementation is based on ellip by Sira Pornsiriprasert. Note that the original literature by Bulirsch used the complementary modulus kc where kc = √(1 - m).

§Parameters
  • self: elliptic parameter (m)
  • x: tangent of the amplitude angle
§Examples
use special::Elliptic;

let m = 0.5;
let x = std::f64::consts::FRAC_PI_4.tan();

assert::close(m.inc_elliptic_bulirsch_1(x), 0.826017876249245, 1e-15)
§Panics

The function panics if m = 1.

Source

fn inc_elliptic_bulirsch_2(self, x: Self, a: Self, b: Self) -> Self

Compute the incomplete elliptic integral in Bulirsch’s form of the second kind.

The implementation is based on ellip by Sira Pornsiriprasert. Note that the original literature by Bulirsch used the complementary modulus kc where kc = √(1 - m).

§Parameters
  • self: elliptic parameter (m)
  • x: tangent of the amplitude angle
  • a and b: coefficients
§Examples
use special::Elliptic;

let m = 0.5;
let x = std::f64::consts::FRAC_PI_4.tan();
let a = 1.0;
let b = 1.0;

assert::close(m.inc_elliptic_bulirsch_2(x, a, b), 0.826017876249245, 1e-15)
§Panics

The function panics if m = 1.

Source

fn inc_elliptic_bulirsch_3(self, x: Self, p: Self) -> Self

Compute the incomplete elliptic integral Bulirsch’s form of the third kind.

The implementation is based on ellip by Sira Pornsiriprasert. Note that the original literature by Bulirsch used the complementary modulus kc where kc = √(1 - m).

§Parameters
  • self: elliptic parameter (m)
  • x: tangent of the amplitude angle
  • p: a parameter
§Examples
use special::Elliptic;

let m = 0.5;
let x = std::f64::consts::FRAC_PI_4.tan();
let p = 1.0;

assert::close(m.inc_elliptic_bulirsch_3(x, p), 0.826017876249245, 1e-15)
§Panics

The function panics if m = 1, 1 + px² = 0, or m < 0 for p < 0.

Source

fn jacobi_zeta(self, phi: Self) -> Self

Compute Jacobi’s zeta function.

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
  • phi: amplitude angle (φ)
§Examples
use special::Elliptic;

let m = 0.5;
let phi = std::f64::consts::FRAC_PI_4;

assert::close(m.jacobi_zeta(phi), 0.146454543836188, 1e-15)
§Panics

The function panics if m > 1, φ is infinite, or m is infinite.

Source

fn heuman_lambda(self, phi: Self) -> Self

Compute Heuman’s lambda function.

The implementation is based on ellip by Sira Pornsiriprasert.

§Parameters
  • self: elliptic parameter (m)
  • phi: amplitude angle (φ)
§Examples
use special::Elliptic;

let m = 0.5;
let phi = std::f64::consts::FRAC_PI_4;

assert::close(m.heuman_lambda(phi), 0.6183811341833665, 1e-15)
§Panics

The function panics if m < 0, m ≥ 1, or phi is infinite.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Elliptic for f32

Source§

fn elliptic_k(self) -> Self

Source§

fn elliptic_e(self) -> Self

Source§

fn elliptic_pi(self, n: Self) -> Self

Source§

fn elliptic_d(self) -> Self

Source§

fn inc_elliptic_f(self, phi: Self) -> Self

Source§

fn inc_elliptic_e(self, phi: Self) -> Self

Source§

fn inc_elliptic_pi(self, phi: Self, n: Self) -> Self

Source§

fn inc_elliptic_pi_bulirsch(self, phi: Self, n: Self) -> Self

Source§

fn inc_elliptic_d(self, phi: Self) -> Self

Source§

fn elliptic_rf(self, y: Self, z: Self) -> Self

Source§

fn elliptic_rg(self, y: Self, z: Self) -> Self

Source§

fn elliptic_rj(self, y: Self, z: Self, p: Self) -> Self

Source§

fn elliptic_rc(self, y: Self) -> Self

Source§

fn elliptic_rd(self, y: Self, z: Self) -> Self

Source§

fn elliptic_bulirsch(self, p: Self, a: Self, b: Self) -> Self

Source§

fn elliptic_bulirsch_1(self) -> Self

Source§

fn elliptic_bulirsch_2(self, a: Self, b: Self) -> Self

Source§

fn inc_elliptic_bulirsch_1(self, x: Self) -> Self

Source§

fn inc_elliptic_bulirsch_2(self, x: Self, a: Self, b: Self) -> Self

Source§

fn inc_elliptic_bulirsch_3(self, x: Self, p: Self) -> Self

Source§

fn jacobi_zeta(self, phi: Self) -> Self

Source§

fn heuman_lambda(self, phi: Self) -> Self

Source§

impl Elliptic for f64

Source§

fn elliptic_k(self) -> Self

Source§

fn elliptic_e(self) -> Self

Source§

fn elliptic_pi(self, n: Self) -> Self

Source§

fn elliptic_d(self) -> Self

Source§

fn inc_elliptic_f(self, phi: Self) -> Self

Source§

fn inc_elliptic_e(self, phi: Self) -> Self

Source§

fn inc_elliptic_pi(self, phi: Self, n: Self) -> Self

Source§

fn inc_elliptic_pi_bulirsch(self, phi: Self, n: Self) -> Self

Source§

fn inc_elliptic_d(self, phi: Self) -> Self

Source§

fn elliptic_rf(self, y: Self, z: Self) -> Self

Source§

fn elliptic_rg(self, y: Self, z: Self) -> Self

Source§

fn elliptic_rj(self, y: Self, z: Self, p: Self) -> Self

Source§

fn elliptic_rc(self, y: Self) -> Self

Source§

fn elliptic_rd(self, y: Self, z: Self) -> Self

Source§

fn elliptic_bulirsch(self, p: Self, a: Self, b: Self) -> Self

Source§

fn elliptic_bulirsch_1(self) -> Self

Source§

fn elliptic_bulirsch_2(self, a: Self, b: Self) -> Self

Source§

fn inc_elliptic_bulirsch_1(self, x: Self) -> Self

Source§

fn inc_elliptic_bulirsch_2(self, x: Self, a: Self, b: Self) -> Self

Source§

fn inc_elliptic_bulirsch_3(self, x: Self, p: Self) -> Self

Source§

fn jacobi_zeta(self, phi: Self) -> Self

Source§

fn heuman_lambda(self, phi: Self) -> Self

Implementors§