pub trait Derivative {
// Required methods
fn derivative(&self, variable: Symbol) -> Expression;
fn nth_derivative(&self, variable: Symbol, order: u32) -> Expression;
fn is_differentiable(&self, variable: Symbol) -> bool;
}Expand description
Trait for derivative operations
Required Methods§
Sourcefn derivative(&self, variable: Symbol) -> Expression
fn derivative(&self, variable: Symbol) -> Expression
Compute the derivative with respect to a variable
§Examples
use mathhook_core::{expr, symbol};
use mathhook_core::calculus::derivatives::Derivative;
let x = symbol!(x);
let expr = expr!(x ^ 2);
let result = expr.derivative(x);Sourcefn nth_derivative(&self, variable: Symbol, order: u32) -> Expression
fn nth_derivative(&self, variable: Symbol, order: u32) -> Expression
Compute higher-order derivatives
§Examples
use mathhook_core::{expr, symbol};
use mathhook_core::calculus::derivatives::Derivative;
let x = symbol!(x);
let expr = expr!(x ^ 4);
let second_derivative = expr.nth_derivative(x, 2);Sourcefn is_differentiable(&self, variable: Symbol) -> bool
fn is_differentiable(&self, variable: Symbol) -> bool
Check if expression is differentiable with respect to variable
§Examples
use mathhook_core::{expr, symbol};
use mathhook_core::calculus::derivatives::Derivative;
let x = symbol!(x);
let expr = expr!(sin(x));
let is_diff = expr.is_differentiable(x);