pub struct GeneralProductRule;Expand description
General product rule for multiple factors
For product f1 * f2 * … * fn: d/dx(f1f2…fn) = (df1/dx)f2…fn + f1(df2/dx)…fn + … + f1f2*…*(dfn/dx)
Order is preserved for noncommutative expressions (matrices, operators, quaternions).
Implementations§
Source§impl GeneralProductRule
impl GeneralProductRule
Sourcepub fn apply(factors: &[Expression], variable: &Symbol) -> Expression
pub fn apply(factors: &[Expression], variable: &Symbol) -> Expression
Apply product rule for multiple factors
Preserves factor order for noncommutative expressions.
§Examples
use mathhook_core::{Expression, symbol};
use mathhook_core::calculus::derivatives::GeneralProductRule;
let x = symbol!(x);
let factors = vec![
Expression::symbol(x.clone()),
Expression::function("sin", vec![Expression::symbol(x.clone())]),
Expression::function("cos", vec![Expression::symbol(x.clone())])
];
let result = GeneralProductRule::apply(&factors, &x);Auto Trait Implementations§
impl Freeze for GeneralProductRule
impl RefUnwindSafe for GeneralProductRule
impl Send for GeneralProductRule
impl Sync for GeneralProductRule
impl Unpin for GeneralProductRule
impl UnwindSafe for GeneralProductRule
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