pub struct Hyperreal { /* private fields */ }Expand description
A hyperreal number generated by the infinitesimal. See the module documentation.
Implementations§
Source§impl Hyperreal
impl Hyperreal
pub fn from_algebraic(a: Algebraic) -> Hyperreal
pub fn from_rational(r: Rational) -> Hyperreal
pub fn from_i64(n: i64) -> Hyperreal
Sourcepub fn from_reciprocal_powers(c: &[Rational]) -> Hyperreal
pub fn from_reciprocal_powers(c: &[Rational]) -> Hyperreal
Σ cᵢ·(1/dt)^i for rational c (little-endian), written directly as
(Σ cᵢ·dt^(d−i)) / dt^d: with the top coefficient nonzero the numerator has a nonzero
constant term, so the fraction is already in lowest terms and dt^d is comonic — no
polynomial gcd at any degree.
pub fn is_zero(&self) -> bool
pub fn add(&self, o: &Hyperreal) -> Hyperreal
pub fn neg(&self) -> Hyperreal
pub fn sub(&self, o: &Hyperreal) -> Hyperreal
pub fn mul(&self, o: &Hyperreal) -> Hyperreal
pub fn recip(&self) -> Option<Hyperreal>
pub fn div(&self, o: &Hyperreal) -> Option<Hyperreal>
Sourcepub fn as_reciprocal_powers(&self) -> Option<Vec<Rational>>
pub fn as_reciprocal_powers(&self) -> Option<Vec<Rational>>
The rational c with self = Σ cᵢ·(1/dt)^i, when the value is a polynomial in 1/dt
over the rationals; None for a positive power of dt, an irrational coefficient, or a
denominator that is not a power of dt. The inverse of
Hyperreal::from_reciprocal_powers.
Sourcepub fn principal_part(&self) -> (Vec<Algebraic>, Hyperreal)
pub fn principal_part(&self) -> (Vec<Algebraic>, Hyperreal)
The principal part of the Laurent expansion at dt = 0 and the limited rest: the
coefficient of (1/dt)^j at index j − 1 for each j up to the pole’s order, and
self − Σ c_j·(1/dt)^j exactly. Writing self = dt^(−k)·N/U with U(0) ≠ 0, the
coefficients are the first k terms of the power series N/U.
Sourcepub fn as_dt_polynomial(&self) -> Option<Vec<Algebraic>>
pub fn as_dt_polynomial(&self) -> Option<Vec<Algebraic>>
The coefficients of a polynomial in dt, lowest power first, when the value is one.
Sourcepub fn taylor_coefficient(&self, k: usize) -> Algebraic
pub fn taylor_coefficient(&self, k: usize) -> Algebraic
The coefficient of dt^k in the Taylor series of a limited value at dt = 0. A limited
value in lowest terms has den(0) = 1, so s_k = num_k − Σ_{j=1}^{k} den_j·s_{k−j}.
Sourcepub fn root_split(&self, n: u32) -> Option<(Hyperreal, Hyperreal)>
pub fn root_split(&self, n: u32) -> Option<(Hyperreal, Hyperreal)>
self = outside^n · inside, where every polynomial factor of inside’s numerator and
denominator appears fewer than n times (Yun’s squarefree decomposition takes the n-th powers
out) and inside’s constant is taken out only when it is an n-th power: with rational
coefficients the factors left inside are primitive integer polynomials with a positive
lowest-order coefficient and the constant is the rest, otherwise they are monic and the constant’s
n-th root — real, the positive one for even n — goes outside. None for zero, and for an even
n of a negative value.
Sourcepub fn numerator_is_constant(&self) -> bool
pub fn numerator_is_constant(&self) -> bool
Whether the numerator is a constant: the value is a constant over a polynomial.
Sourcepub fn degrees(&self) -> (usize, usize)
pub fn degrees(&self) -> (usize, usize)
The degrees of the reduced numerator and denominator; (0, 0) for zero.
Sourcepub fn pow(&self, k: i32) -> Result<Hyperreal, PowerError>
pub fn pow(&self, k: i32) -> Result<Hyperreal, PowerError>
self^k, refused for zero to a negative power or a degree past MAX_POWER_DEGREE.
Sourcepub fn signum(&self) -> i32
pub fn signum(&self) -> i32
−1, 0 or 1: the sign of the lowest-order coefficient of the numerator.
Sourcepub fn as_standard(&self) -> Option<Algebraic>
pub fn as_standard(&self) -> Option<Algebraic>
The standard value, when the value has no infinitesimal part at all.
Sourcepub fn leading_coefficient(&self) -> Option<Algebraic>
pub fn leading_coefficient(&self) -> Option<Algebraic>
The coefficient of the leading power of dt.
pub fn is_infinitesimal(&self) -> bool
pub fn is_limited(&self) -> bool
Sourcepub fn standard_part(&self) -> Option<Algebraic>
pub fn standard_part(&self) -> Option<Algebraic>
The standard real infinitely close to a limited value; None for an infinite one.
pub fn infinitely_close(&self, o: &Hyperreal) -> bool
Sourcepub fn eval_at(&self, t: &Rational) -> Option<Algebraic>
pub fn eval_at(&self, t: &Rational) -> Option<Algebraic>
The value at the standard point dt = t; None at a pole.
Sourcepub fn ramify(&self, m: u32) -> Hyperreal
pub fn ramify(&self, m: u32) -> Hyperreal
The same function of dt^m: dt replaced by dt^m, which keeps a reduced fraction reduced
and a comonic denominator comonic.
Sourcepub fn unramify(&self, m: u32) -> Option<Hyperreal>
pub fn unramify(&self, m: u32) -> Option<Hyperreal>
The function r with self = r(dt^m), when every power of dt the value holds is a
multiple of m; None otherwise.
Sourcepub fn laurent_coefficient(&self, k: i64) -> Algebraic
pub fn laurent_coefficient(&self, k: i64) -> Algebraic
The coefficient of dt^k in the Laurent expansion at dt = 0.
Sourcepub fn pade(series: &[Algebraic], l: usize, m: usize) -> Option<Hyperreal>
pub fn pade(series: &[Algebraic], l: usize, m: usize) -> Option<Hyperreal>
The rational function of numerator degree at most l and denominator degree at most m,
denominator nonzero at 0, whose expansion at 0 begins with series (its first l + m + 1
coefficients), by the extended Euclidean algorithm on dt^(l+m+1) and the truncated series;
None when no such function exists.
Trait Implementations§
Source§impl ExactCodec for Hyperreal
impl ExactCodec for Hyperreal
Source§fn write(&self, out: &mut Vec<u8>)
fn write(&self, out: &mut Vec<u8>)
The reduced numerator’s coefficients, then the comonic denominator’s, lowest power first.
fn read(buf: &[u8], pos: &mut usize) -> Option<Self>
fn to_bytes(&self) -> Vec<u8> ⓘ
Source§fn from_bytes(buf: &[u8]) -> Option<Self>
fn from_bytes(buf: &[u8]) -> Option<Self>
buf canonically encodes, with nothing left over.