pub struct PartialDerivatives;Expand description
Main partial derivatives interface
Implementations§
Source§impl PartialDerivatives
impl PartialDerivatives
Sourcepub fn mixed_partial(expr: &Expression, variables: Vec<Symbol>) -> Expression
pub fn mixed_partial(expr: &Expression, variables: Vec<Symbol>) -> Expression
Compute mixed partial derivative ∂ⁿf/∂x₁∂x₂…∂xₙ
§Examples
use mathhook_core::simplify::Simplify;
use mathhook_core::calculus::derivatives::Derivative;
use mathhook_core::{Expression};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::PartialDerivatives;
let x = symbol!(x);
let y = symbol!(y);
let expr = Expression::mul(vec![
Expression::pow(Expression::symbol(x.clone()), Expression::integer(2)),
Expression::pow(Expression::symbol(y.clone()), Expression::integer(3))
]);
let mixed = PartialDerivatives::mixed_partial(&expr, vec![x, y]);Sourcepub fn gradient(expr: &Expression, variables: Vec<Symbol>) -> Vec<Expression>
pub fn gradient(expr: &Expression, variables: Vec<Symbol>) -> Vec<Expression>
Compute gradient vector - delegates to specialized module
§Examples
use mathhook_core::{Expression};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::PartialDerivatives;
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 grad = PartialDerivatives::gradient(&expr, vec![x, y]);Sourcepub fn hessian(
expr: &Expression,
variables: Vec<Symbol>,
) -> Vec<Vec<Expression>>
pub fn hessian( expr: &Expression, variables: Vec<Symbol>, ) -> Vec<Vec<Expression>>
Compute Hessian matrix - delegates to specialized module
§Examples
use mathhook_core::{Expression};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::PartialDerivatives;
let x = symbol!(x);
let y = symbol!(y);
let expr = Expression::add(vec![
Expression::pow(Expression::symbol(x.clone()), Expression::integer(2)),
Expression::mul(vec![Expression::symbol(x.clone()), Expression::symbol(y.clone())]),
Expression::pow(Expression::symbol(y.clone()), Expression::integer(2))
]);
let hessian = PartialDerivatives::hessian(&expr, vec![x, y]);Sourcepub fn directional_derivative(
expr: &Expression,
variables: Vec<Symbol>,
direction: Vec<Expression>,
) -> Expression
pub fn directional_derivative( expr: &Expression, variables: Vec<Symbol>, direction: Vec<Expression>, ) -> Expression
Compute directional derivative - delegates to specialized module
§Examples
use mathhook_core::{Expression};
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::PartialDerivatives;
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 = PartialDerivatives::directional_derivative(&expr, vec![x, y], direction);Sourcepub fn jacobian(
functions: &[Expression],
variables: &[Symbol],
) -> Vec<Vec<Expression>>
pub fn jacobian( functions: &[Expression], variables: &[Symbol], ) -> Vec<Vec<Expression>>
Compute Jacobian matrix - delegates to specialized module
Sourcepub fn jacobian_determinant(
functions: &[Expression],
variables: &[Symbol],
) -> Expression
pub fn jacobian_determinant( functions: &[Expression], variables: &[Symbol], ) -> Expression
Compute Jacobian determinant - delegates to specialized module
Sourcepub fn divergence(
vector_field: &[Expression],
variables: Vec<Symbol>,
) -> Expression
pub fn divergence( vector_field: &[Expression], variables: Vec<Symbol>, ) -> Expression
Compute divergence - delegates to specialized module
Sourcepub fn curl(
vector_field: &[Expression],
variables: Vec<Symbol>,
) -> Vec<Expression>
pub fn curl( vector_field: &[Expression], variables: Vec<Symbol>, ) -> Vec<Expression>
Compute curl - delegates to specialized module
Sourcepub fn laplacian(expr: &Expression, variables: Vec<Symbol>) -> Expression
pub fn laplacian(expr: &Expression, variables: Vec<Symbol>) -> Expression
Compute Laplacian - delegates to specialized module
Sourcepub fn is_conservative(
vector_field: &[Expression],
variables: Vec<Symbol>,
) -> bool
pub fn is_conservative( vector_field: &[Expression], variables: Vec<Symbol>, ) -> bool
Check if vector field is conservative - delegates to specialized module
Sourcepub fn find_potential(
vector_field: &[Expression],
variables: Vec<Symbol>,
) -> Option<Expression>
pub fn find_potential( vector_field: &[Expression], variables: Vec<Symbol>, ) -> Option<Expression>
Find potential function - delegates to specialized module
Auto Trait Implementations§
impl Freeze for PartialDerivatives
impl RefUnwindSafe for PartialDerivatives
impl Send for PartialDerivatives
impl Sync for PartialDerivatives
impl Unpin for PartialDerivatives
impl UnwindSafe for PartialDerivatives
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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