pub struct DirectionalDerivatives;Expand description
Directional derivative operations
Implementations§
Source§impl DirectionalDerivatives
impl DirectionalDerivatives
Sourcepub fn compute(
expr: &Expression,
variables: Vec<Symbol>,
direction: Vec<Expression>,
) -> Expression
pub fn compute( expr: &Expression, variables: Vec<Symbol>, direction: Vec<Expression>, ) -> Expression
Compute directional derivative
§Examples
use mathhook_core::simplify::Simplify;
use mathhook_core::{Expression};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::DirectionalDerivatives;
let x = symbol!(x);
let y = symbol!(y);
let expr = Expression::add(vec![
Expression::pow(Expression::symbol(x.clone()), Expression::integer(2)),
Expression::pow(Expression::symbol(y.clone()), Expression::integer(2))
]);
let direction = vec![Expression::integer(1), Expression::integer(1)];
let dir_deriv = DirectionalDerivatives::compute(&expr, vec![x, y], direction);Sourcepub fn unit_directional(
expr: &Expression,
variables: Vec<Symbol>,
direction: Vec<Expression>,
) -> Expression
pub fn unit_directional( expr: &Expression, variables: Vec<Symbol>, direction: Vec<Expression>, ) -> Expression
Compute unit directional derivative (normalizes direction vector)
§Examples
use mathhook_core::{Expression, Symbol};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::DirectionalDerivatives;
let x = symbol!(x);
let y = symbol!(y);
let expr = Expression::add(vec![
Expression::pow(Expression::symbol(x.clone()), Expression::integer(2)),
Expression::pow(Expression::symbol(y.clone()), Expression::integer(2))
]);
let direction = vec![Expression::integer(3), Expression::integer(4)];
let unit_dir_deriv = DirectionalDerivatives::unit_directional(&expr, vec![x, y], direction);Auto Trait Implementations§
impl Freeze for DirectionalDerivatives
impl RefUnwindSafe for DirectionalDerivatives
impl Send for DirectionalDerivatives
impl Sync for DirectionalDerivatives
impl Unpin for DirectionalDerivatives
impl UnwindSafe for DirectionalDerivatives
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