pub struct ProductRule;Expand description
Product rule implementation for two factors
Implementations§
Source§impl ProductRule
impl ProductRule
Sourcepub fn handle_product(factors: &[Expression], variable: Symbol) -> Expression
pub fn handle_product(factors: &[Expression], variable: Symbol) -> Expression
Handle derivative of product expressions using product rule
§Examples
use mathhook_core::simplify::Simplify;
use mathhook_core::{Expression, ProductRule};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::Derivative;
let x = symbol!(x);
let expr = Expression::mul(vec![
Expression::symbol(x.clone()),
Expression::function("sin", vec![Expression::symbol(x.clone())])
]);
let result = expr.derivative(x);Sourcepub fn apply(u: &Expression, v: &Expression, variable: Symbol) -> Expression
pub fn apply(u: &Expression, v: &Expression, variable: Symbol) -> Expression
Apply product rule for two expressions
For commutative: d(uv)/dx = (du/dx)v + u(dv/dx) For noncommutative: d(AB)/dx = (dA/dx)B + A(dB/dx) - ORDER MATTERS
§Examples
use mathhook_core::{Expression, ProductRule};
use mathhook_core::symbol;
let x = symbol!(x);
let u = Expression::symbol(x.clone());
let v = Expression::function("sin", vec![Expression::symbol(x.clone())]);
let result = ProductRule::apply(&u, &v, x);Auto Trait Implementations§
impl Freeze for ProductRule
impl RefUnwindSafe for ProductRule
impl Send for ProductRule
impl Sync for ProductRule
impl Unpin for ProductRule
impl UnsafeUnpin for ProductRule
impl UnwindSafe for ProductRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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