[−][src]Enum symbolics_core::expr::Expr
Variants
Num(f64)
Symbol(String)
Add(Box<Expr>, Box<Expr>)
Mul(Box<Expr>, Box<Expr>)
Pow(Box<Expr>, Box<Expr>)
Log(Box<Expr>, Box<Expr>)
Sin(Box<Expr>)
Cos(Box<Expr>)
Arcsin(Box<Expr>)
Arccos(Box<Expr>)
Arctan(Box<Expr>)
Methods
impl Expr
[src]
pub fn is_num(self) -> bool
[src]
Return whether the expression represents a literal number,
i.e. whether it is of variant Num
.
pub fn val(self) -> Option<f64>
[src]
Return the numeric value of the expression, if all symbols have been applied.
If there are unapplied symbols, returns None
.
impl Expr
[src]
pub fn apply1<T, S: AsRef<str>>(self, name_raw: S, value: T) -> Expr where
T: Clone + Into<Expr>,
[src]
T: Clone + Into<Expr>,
Apply a single substitution, then simplify purely numeric sub-expressions. The substitution can be anything that can be converted to an expression.
Examples
let y = 3*s!(x).squared() + 2; let y_2 = y.apply1("x", 2); assert_eq!(y_2.val().unwrap(), 14.);
let y = 3*s!(x) + 2; let y_t = y.apply1("x", s!(t).squared()); assert_eq!(format!("{:?}", y_t), "Add(Mul(Num(3.0), Pow(Symbol(\"t\"), Num(2.0))), Num(2.0))")
impl Expr
[src]
pub fn log<T>(self, base: T) -> Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
Logarithm of arbitrary base.
pub fn log2(self) -> Expr
[src]
Logarithm with base 2.
pub fn log10(self) -> Expr
[src]
Logarithm with base 10.
pub fn ln(self) -> Expr
[src]
Natural logarithm, i.e. log base e, where e is Euler's number.
impl Expr
[src]
pub fn sqrt(self) -> Expr
[src]
Square root.
Provided as a convenience; expr.sqrt()
is equivalent to expr ^ 0.5
.
pub fn squared(self) -> Expr
[src]
Raise to the second power.
Provided as a convenience; expr.squared()
is equivalent to expr ^ 2
.
pub fn cubed(self) -> Expr
[src]
Raise to the third power.
Provided as a convenience; expr.cubed()
is equivalent to expr ^ 3
.
impl Expr
[src]
pub fn sin(self) -> Expr
[src]
pub fn cos(self) -> Expr
[src]
pub fn tan(self) -> Expr
[src]
pub fn csc(self) -> Expr
[src]
pub fn sec(self) -> Expr
[src]
pub fn cot(self) -> Expr
[src]
pub fn asin(self) -> Expr
[src]
pub fn acos(self) -> Expr
[src]
pub fn atan(self) -> Expr
[src]
Trait Implementations
impl Clone for Expr
[src]
fn clone(&self) -> Expr
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<f64> for Expr
[src]
impl From<i64> for Expr
[src]
impl<T> Add<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
type Output = Expr
The resulting type after applying the +
operator.
fn add(self, rhs: T) -> Expr
[src]
impl Add<Expr> for f64
[src]
type Output = Expr
The resulting type after applying the +
operator.
fn add(self, rhs: Expr) -> Expr
[src]
impl Add<Expr> for i64
[src]
type Output = Expr
The resulting type after applying the +
operator.
fn add(self, rhs: Expr) -> Expr
[src]
impl<T> Sub<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
type Output = Expr
The resulting type after applying the -
operator.
fn sub(self, rhs: T) -> Expr
[src]
impl Sub<Expr> for f64
[src]
type Output = Expr
The resulting type after applying the -
operator.
fn sub(self, rhs: Expr) -> Expr
[src]
impl Sub<Expr> for i64
[src]
type Output = Expr
The resulting type after applying the -
operator.
fn sub(self, rhs: Expr) -> Expr
[src]
impl<T> Mul<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
type Output = Expr
The resulting type after applying the *
operator.
fn mul(self, rhs: T) -> Expr
[src]
impl Mul<Expr> for f64
[src]
type Output = Expr
The resulting type after applying the *
operator.
fn mul(self, rhs: Expr) -> Expr
[src]
impl Mul<Expr> for i64
[src]
type Output = Expr
The resulting type after applying the *
operator.
fn mul(self, rhs: Expr) -> Expr
[src]
impl<T> Div<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
type Output = Expr
The resulting type after applying the /
operator.
fn div(self, rhs: T) -> Expr
[src]
impl Div<Expr> for f64
[src]
type Output = Expr
The resulting type after applying the /
operator.
fn div(self, rhs: Expr) -> Expr
[src]
impl Div<Expr> for i64
[src]
type Output = Expr
The resulting type after applying the /
operator.
fn div(self, rhs: Expr) -> Expr
[src]
impl Neg for Expr
[src]
impl<T> AddAssign<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
fn add_assign(&mut self, rhs: T)
[src]
impl<T> SubAssign<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
fn sub_assign(&mut self, rhs: T)
[src]
impl<T> MulAssign<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
fn mul_assign(&mut self, rhs: T)
[src]
impl<T> DivAssign<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
fn div_assign(&mut self, rhs: T)
[src]
impl<'a> Not for &'a Expr
[src]
impl<T> BitXor<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
type Output = Expr
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: T) -> Expr
[src]
impl BitXor<Expr> for f64
[src]
type Output = Expr
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: Expr) -> Expr
[src]
impl BitXor<Expr> for i64
[src]
type Output = Expr
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: Expr) -> Expr
[src]
impl<T> BitXorAssign<T> for Expr where
T: Into<Expr>,
[src]
T: Into<Expr>,
fn bitxor_assign(&mut self, rhs: T)
[src]
impl Debug for Expr
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,