pub struct AdvancedDifferentiation;Expand description
Advanced differentiation methods with performance optimization
Implementations§
Source§impl AdvancedDifferentiation
impl AdvancedDifferentiation
Sourcepub fn implicit(
equation: &Expression,
x_var: Symbol,
y_var: Symbol,
) -> Expression
pub fn implicit( equation: &Expression, x_var: Symbol, y_var: Symbol, ) -> Expression
Compute implicit derivative dy/dx for F(x,y) = 0
Uses the formula: dy/dx = -∂F/∂x / ∂F/∂y
§Examples
use mathhook_core::Expression;
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::AdvancedDifferentiation;
let x = symbol!(x);
let y = symbol!(y);
let equation = Expression::add(vec![
Expression::pow(Expression::symbol(x.clone()), Expression::integer(2)),
Expression::pow(Expression::symbol(y.clone()), Expression::integer(2))
]);
let dy_dx = AdvancedDifferentiation::implicit(&equation, x, y);Sourcepub fn parametric(
x_param: &Expression,
y_param: &Expression,
parameter: Symbol,
) -> Expression
pub fn parametric( x_param: &Expression, y_param: &Expression, parameter: Symbol, ) -> Expression
Compute parametric derivative dy/dx for x = f(t), y = g(t)
Uses formula: dy/dx = (dy/dt) / (dx/dt)
§Examples
use mathhook_core::Expression;
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::AdvancedDifferentiation;
let t = symbol!(t);
let x_param = Expression::function("cos", vec![Expression::symbol(t.clone())]);
let y_param = Expression::function("sin", vec![Expression::symbol(t.clone())]);
let dy_dx = AdvancedDifferentiation::parametric(&x_param, &y_param, t);Sourcepub fn vector_valued(
components: &[Expression],
parameter: Symbol,
) -> Vec<Expression>
pub fn vector_valued( components: &[Expression], parameter: Symbol, ) -> Vec<Expression>
Compute derivative of vector-valued function r’(t)
Returns velocity vector for position vector r(t) = [x(t), y(t), z(t)]
§Examples
use mathhook_core::Expression;
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::AdvancedDifferentiation;
let t = symbol!(t);
let components = vec![
Expression::function("cos", vec![Expression::symbol(t.clone())]),
Expression::function("sin", vec![Expression::symbol(t.clone())]),
Expression::symbol(t.clone())
];
let velocity = AdvancedDifferentiation::vector_valued(&components, t);Sourcepub fn parametric_curvature(
x_param: &Expression,
y_param: &Expression,
parameter: Symbol,
) -> Expression
pub fn parametric_curvature( x_param: &Expression, y_param: &Expression, parameter: Symbol, ) -> Expression
Compute curvature for parametric curves
Uses formula: κ = |x’y’’ - y’x’’| / (x’² + y’²)^(3/2)
§Examples
use mathhook_core::Expression;
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::AdvancedDifferentiation;
let t = symbol!(t);
let x_param = Expression::function("cos", vec![Expression::symbol(t.clone())]);
let y_param = Expression::function("sin", vec![Expression::symbol(t.clone())]);
let curvature = AdvancedDifferentiation::parametric_curvature(&x_param, &y_param, t);Sourcepub fn vector_curvature(
components: &[Expression],
parameter: Symbol,
) -> Expression
pub fn vector_curvature( components: &[Expression], parameter: Symbol, ) -> Expression
Compute curvature for vector-valued functions (space curves)
Uses formula: κ = |r’ × r’‘| / |r’|³
§Examples
use mathhook_core::Expression;
use mathhook_core::symbol;
use mathhook_core::calculus::derivatives::AdvancedDifferentiation;
let t = symbol!(t);
let components = vec![
Expression::symbol(t.clone()),
Expression::pow(Expression::symbol(t.clone()), Expression::integer(2)),
Expression::pow(Expression::symbol(t.clone()), Expression::integer(3))
];
let curvature = AdvancedDifferentiation::vector_curvature(&components, t);Auto Trait Implementations§
impl Freeze for AdvancedDifferentiation
impl RefUnwindSafe for AdvancedDifferentiation
impl Send for AdvancedDifferentiation
impl Sync for AdvancedDifferentiation
impl Unpin for AdvancedDifferentiation
impl UnwindSafe for AdvancedDifferentiation
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