Derivative

Trait Derivative 

Source
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§

Source

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);
Source

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);
Source

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);

Implementors§