[][src]Trait maths_traits::analysis::real::RealExponential

pub trait RealExponential: Exponential + UnitalRing + Divisibility {
    fn try_pow(self, power: Self) -> Option<Self> { ... }
fn try_root(self, index: Self) -> Option<Self> { ... }
fn try_log(self, base: Self) -> Option<Self> { ... }
fn ln(self) -> Self { ... }
fn log(self, base: Self) -> Self { ... }
fn pow(self, p: Self) -> Self { ... }
fn root(self, r: Self) -> Self { ... }
fn exp2(self) -> Self { ... }
fn exp10(self) -> Self { ... }
fn log2(self) -> Self { ... }
fn log10(self) -> Self { ... }
fn sqrt(self) -> Self { ... }
fn cbrt(self) -> Self { ... }
fn ln_1p(self) -> Self { ... }
fn exp_m1(self) -> Self { ... }
fn e() -> Self { ... }
fn ln_2() -> Self { ... }
fn ln_10() -> Self { ... }
fn log2_e() -> Self { ... }
fn log10_e() -> Self { ... }
fn log2_10() -> Self { ... }
fn log10_2() -> Self { ... }
fn sqrt_2() -> Self { ... }
fn frac_1_sqrt_2() -> Self { ... } }

An exponential ring with Real-like properties

Specifically, this trait should be implemented on any Exponential Ring where the natural logarithm exists for any positive integer and is continuous almost everywhere*, the purpose being that the above property guarantees a large number of Real-like behavior and functions for free utilizing only the exponential function.

In particular, this property can be used to prove that:

  • This ring contains a form of the positive Rationals: exp(-ln(x)) = 1/exp(ln(x)) = 1/x
  • The logarithm of any positive rational exists: ln(p/q) = ln(p) - ln(q)
  • We can take the nth-root of any rational with exp(ln(x)/n)
  • We can raise any rational to the power of any other rational using exp(ln(x)*y)
  • Any of the above can be extended to all reals using the continuity of the logarithm

Now, it is worth noting that this distinction between the "Real Exponential" and "Exponential" is necessarily since certain exponential rings are only possible if they do not fit this description. In particular, the integers have an exponential defined as (-1)^n which obviously does not output any naturals besides 1

Provided methods

fn try_pow(self, power: Self) -> Option<Self>

This element raised to the given power as defined by x^y = exp(ln(x)*y), if ln(x) exists

fn try_root(self, index: Self) -> Option<Self>

This element taken to the given root as defined as root(x, y) = x^(1/y), if ln(x) and 1/y exist

fn try_log(self, base: Self) -> Option<Self>

The inverse of pow(), if it exists

fn ln(self) -> Self

The natural logarithm of self

Do note that this function is allowed to panic or return an error value whenever the desired logarithm does not exist. This exception is specifically to allow primitive floats to implement this method as a wrapper for the intrinsic definition

fn log(self, base: Self) -> Self

The logarithm of self over a specific base

Do note that this function is allowed to panic or return an error value whenever the desired logarithm does not exist. This exception is specifically to allow primitive floats to implement this method as a wrapper for the intrinsic definition

fn pow(self, p: Self) -> Self

The power of self over a specific exponent

Do note that this function is allowed to panic or return an error value whenever the desired power does not exist. This exception is specifically to allow primitive floats to implement this method as a wrapper for the intrinsic definition

fn root(self, r: Self) -> Self

The root of self over a specific index

Do note that this function is allowed to panic or return an error value whenever the desired root does not exist. This exception is specifically to allow primitive floats to implement this method as a wrapper for the intrinsic definition

fn exp2(self) -> Self

Raises 2 to the power of self

fn exp10(self) -> Self

Raises 10 to the power of self

fn log2(self) -> Self

The logarithm of base 2

fn log10(self) -> Self

The logarithm of base 10

fn sqrt(self) -> Self

fn cbrt(self) -> Self

fn ln_1p(self) -> Self

The natural logarithm of self plus 1.

This is meant as a wrapper for f32::ln_1p and f64::ln_1p

fn exp_m1(self) -> Self

The exponential of self minus 1.

This is meant as a wrapper for f32::exp_m1 and f64::exp_m1

fn e() -> Self

The exponential of 1. Mirrors ::core::f32::consts::E

fn ln_2() -> Self

The natural logarithm of 2. Mirrors ::core::f32::consts::LN_2

fn ln_10() -> Self

The natural logarithm of 10. Mirrors ::core::f32::consts::LN_10

fn log2_e() -> Self

The logarithm base 2 of e. Mirrors ::core::f32::consts::LOG2_E

fn log10_e() -> Self

The logarithm base 10 of e. Mirrors ::core::f32::consts::LOG10_E

fn log2_10() -> Self

The logarithm base 2 of 10. Mirrors ::core::f32::consts::LOG2_10

fn log10_2() -> Self

The logarithm base 10 of 2. Mirrors ::core::f32::consts::LOG10_2

fn sqrt_2() -> Self

The square root of 2. Mirrors ::core::f32::consts::SQRT_2

fn frac_1_sqrt_2() -> Self

One over the square root of 2. Mirrors ::core::f32::consts::FRAC_1_SQRT_2

Loading content...

Implementations on Foreign Types

impl RealExponential for f32[src]

impl RealExponential for f64[src]

Loading content...

Implementors

Loading content...