Skip to content

p-sira/ellip

Repository files navigation

License Crate Total Downloads Documentation

Elliptic integrals for Rust

Ellip is a pure-Rust implementation of elliptic integrals. Ellip also provides less common functions like Bulirsch's cel and el. Some applications of the elliptic integrals include computing the lengths of plane curves, magnetism, astrophysics, and string theory.

Quick Start

Start by installing Ellip.

>> cargo add ellip

Let's compute the circumference of an ellipse.

use ellip::*;

fn ellipse_length(a: f64, b: f64) -> Result<f64, StrErr> {
    Ok(8.0 * elliprg(0.0, a * a, b * b)?)
}

let ans = ellipse_length(5.0, 3.0).unwrap();
ellip::util::assert_close(ans, 25.526998863398124, 1e-15);

Learn more at doc.rs.

Features

  • Legendre's complete integrals
    • ellipk: Complete elliptic integral of the first kind (K).
    • ellipe: Complete elliptic integral of the second kind (E).
    • ellippi: Complete elliptic integral of the third kind (Π).
    • ellipd: Complete elliptic integral of Legendre's type (D).
  • Legendre's incomplete integrals
    • ellipf: Incomplete elliptic integral of the first kind (F).
    • ellipeinc: Incomplete elliptic integral of the second kind (E).
    • ellippiinc: Incomplete elliptic integral of the third kind (Π).
    • ellipdinc: Incomplete elliptic integral of Legendre's type (D).
  • Bulirsch's integrals
    • cel: General complete elliptic integral in Bulirsch's form.
    • cel1: Complete elliptic integral of the first kind in Bulirsch's form.
    • cel2: Complete elliptic integral of the second kind in Bulirsch's form.
    • el1: Incomplete elliptic integral of the first kind in Bulirsch's form.
    • el2: Incomplete elliptic integral of the second kind in Bulirsch's form.
    • el3: Incomplete elliptic integral of the third kind in Bulirsch's form.
  • Carlson's symmetric integrals
    • elliprf: Symmetric elliptic integral of the first kind (RF).
    • elliprg: Symmetric elliptic integral of the second kind (RG).
    • elliprj: Symmetric elliptic integral of the third kind (RJ).
    • elliprc: Degenerate elliptic integral of RF (RC).
    • elliprd: Degenerate elliptic integral of the third kind (RD).

Testing

The function results are compared with Boost Math test data and Wolfram Engine test data. The accuracy report and the test data along with the test generation scripts can be found here.


Learn more at docs.rs.

About

Elliptic integrals for Rust

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •