Trait polylog::Li2

source ·
pub trait Li2<T> {
    // Required method
    fn li2(&self) -> T;
}
Expand description

Provides the 2nd order polylogarithm (dilogarithm) function li2() of a number of type T.

Required Methods§

source

fn li2(&self) -> T

Implementations on Foreign Types§

source§

impl Li2<f32> for f32

source§

fn li2(&self) -> f32

Returns the real dilogarithm of a real number of type f32.

Implemented as rational function approximation.

§Example:
use polylog::Li2;

assert!((1.0_f32.li2() - 1.64493407_f32).abs() < 2.0_f32*std::f32::EPSILON);
source§

impl Li2<f64> for f64

source§

fn li2(&self) -> f64

Returns the real dilogarithm of a real number of type f64.

Implemented as rational function approximation with a maximum error of 5e-17 [arXiv:2201.01678].

§Example:
use polylog::Li2;

assert!((1.0_f64.li2() - 1.6449340668482264_f64).abs() < 2.0_f64*std::f64::EPSILON);
source§

impl Li2<Complex<f32>> for Complex<f32>

source§

fn li2(&self) -> Complex<f32>

Returns the dilogarithm of a complex number of type Complex<f32>.

§Example:
use num::complex::Complex;
use polylog::Li2;

assert!((Complex::new(1.0_f32, 1.0_f32).li2() - Complex::new(0.61685028_f32, 1.46036212_f32)).norm() < std::f32::EPSILON);
source§

impl Li2<Complex<f64>> for Complex<f64>

source§

fn li2(&self) -> Complex<f64>

Returns the dilogarithm of a complex number of type Complex<f64>.

This function has been translated from the SPheno package.

§Example:
use num::complex::Complex;
use polylog::Li2;

assert!((Complex::new(1.0_f64, 1.0_f64).li2() - Complex::new(0.6168502750680849_f64, 1.4603621167531195_f64)).norm() < 2.0_f64*std::f64::EPSILON);

Implementors§