SymbolicExpression

Enum SymbolicExpression 

Source
pub enum SymbolicExpression<F: IntegrateFloat> {
Show 19 variants Constant(F), Var(Variable), Add(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>), Sub(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>), Mul(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>), Div(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>), Pow(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>), Neg(Box<SymbolicExpression<F>>), Sin(Box<SymbolicExpression<F>>), Cos(Box<SymbolicExpression<F>>), Exp(Box<SymbolicExpression<F>>), Ln(Box<SymbolicExpression<F>>), Sqrt(Box<SymbolicExpression<F>>), Tan(Box<SymbolicExpression<F>>), Atan(Box<SymbolicExpression<F>>), Sinh(Box<SymbolicExpression<F>>), Cosh(Box<SymbolicExpression<F>>), Tanh(Box<SymbolicExpression<F>>), Abs(Box<SymbolicExpression<F>>),
}
Expand description

Symbolic expression types

Variants§

§

Constant(F)

Constant value

§

Var(Variable)

Variable

§

Add(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>)

Addition

§

Sub(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>)

Subtraction

§

Mul(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>)

Multiplication

§

Div(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>)

Division

§

Pow(Box<SymbolicExpression<F>>, Box<SymbolicExpression<F>>)

Power

§

Neg(Box<SymbolicExpression<F>>)

Negation

§

Sin(Box<SymbolicExpression<F>>)

Sine

§

Cos(Box<SymbolicExpression<F>>)

Cosine

§

Exp(Box<SymbolicExpression<F>>)

Exponential

§

Ln(Box<SymbolicExpression<F>>)

Natural logarithm

§

Sqrt(Box<SymbolicExpression<F>>)

Square root

§

Tan(Box<SymbolicExpression<F>>)

Tangent

§

Atan(Box<SymbolicExpression<F>>)

Arctangent

§

Sinh(Box<SymbolicExpression<F>>)

Hyperbolic sine

§

Cosh(Box<SymbolicExpression<F>>)

Hyperbolic cosine

§

Tanh(Box<SymbolicExpression<F>>)

Hyperbolic tangent

§

Abs(Box<SymbolicExpression<F>>)

Absolute value

Implementations§

Source§

impl<F: IntegrateFloat> SymbolicExpression<F>

Source

pub fn constant(value: F) -> Self

Create a constant expression

Source

pub fn var(name: impl Into<String>) -> Self

Create a variable expression

Source

pub fn indexedvar(name: impl Into<String>, index: usize) -> Self

Create an indexed variable expression

Source

pub fn tan(expr: SymbolicExpression<F>) -> Self

Create a tangent expression

Source

pub fn atan(expr: SymbolicExpression<F>) -> Self

Create an arctangent expression

Source

pub fn sinh(expr: SymbolicExpression<F>) -> Self

Create a hyperbolic sine expression

Source

pub fn cosh(expr: SymbolicExpression<F>) -> Self

Create a hyperbolic cosine expression

Source

pub fn tanh(expr: SymbolicExpression<F>) -> Self

Create a hyperbolic tangent expression

Source

pub fn abs(expr: SymbolicExpression<F>) -> Self

Create an absolute value expression

Source

pub fn differentiate(&self, var: &Variable) -> SymbolicExpression<F>

Differentiate with respect to a variable

Source

pub fn evaluate(&self, values: &HashMap<Variable, F>) -> IntegrateResult<F>

Evaluate the expression with given variable values

Source

pub fn variables(&self) -> Vec<Variable>

Get all variables in the expression

Trait Implementations§

Source§

impl<F: IntegrateFloat> Add for SymbolicExpression<F>

Source§

type Output = SymbolicExpression<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<F: Clone + IntegrateFloat> Clone for SymbolicExpression<F>

Source§

fn clone(&self) -> SymbolicExpression<F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug + IntegrateFloat> Debug for SymbolicExpression<F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: IntegrateFloat> Display for SymbolicExpression<F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: IntegrateFloat> Div for SymbolicExpression<F>

Source§

type Output = SymbolicExpression<F>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<F: IntegrateFloat> Mul for SymbolicExpression<F>

Source§

type Output = SymbolicExpression<F>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<F: IntegrateFloat> Neg for SymbolicExpression<F>

Source§

type Output = SymbolicExpression<F>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<F: PartialEq + IntegrateFloat> PartialEq for SymbolicExpression<F>

Source§

fn eq(&self, other: &SymbolicExpression<F>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F: IntegrateFloat> Sub for SymbolicExpression<F>

Source§

type Output = SymbolicExpression<F>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<F: IntegrateFloat> StructuralPartialEq for SymbolicExpression<F>

Auto Trait Implementations§

§

impl<F> Freeze for SymbolicExpression<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for SymbolicExpression<F>
where F: RefUnwindSafe,

§

impl<F> Send for SymbolicExpression<F>
where F: Send,

§

impl<F> Sync for SymbolicExpression<F>
where F: Sync,

§

impl<F> Unpin for SymbolicExpression<F>
where F: Unpin,

§

impl<F> UnwindSafe for SymbolicExpression<F>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V