pub struct PowerRule;Expand description
Power rule implementation
Implementations§
Source§impl PowerRule
impl PowerRule
Sourcepub fn apply(
base: &Expression,
exponent: &Expression,
variable: Symbol,
) -> Expression
pub fn apply( base: &Expression, exponent: &Expression, variable: Symbol, ) -> Expression
Apply power rule and chain rule for power expressions
§Examples
use mathhook_core::simplify::Simplify;
use mathhook_core::calculus::derivatives::Derivative;
use mathhook_core::{Expression, PowerRule};
use mathhook_core::symbol;
let x = symbol!(x);
let base = Expression::symbol(x.clone());
let exponent = Expression::integer(2);
let result = PowerRule::apply(&base, &exponent, x);Sourcepub fn simple_power_rule(n: i64, variable: Symbol) -> Expression
pub fn simple_power_rule(n: i64, variable: Symbol) -> Expression
Handle simple power rule for symbol raised to integer power
§Examples
use mathhook_core::{Expression, PowerRule};
use mathhook_core::symbol;
let x = symbol!(x);
let result = PowerRule::simple_power_rule(3, x);Sourcepub fn logarithmic_differentiation(
base: &Expression,
exponent: &Expression,
variable: Symbol,
) -> Expression
pub fn logarithmic_differentiation( base: &Expression, exponent: &Expression, variable: Symbol, ) -> Expression
Handle general power using logarithmic differentiation
§Examples
use mathhook_core::{Expression, symbol};
use mathhook_core::calculus::derivatives::PowerRule;
let x = symbol!(x);
let base = Expression::function("sin", vec![Expression::symbol(x.clone())]);
let exponent = Expression::symbol(x.clone());
let result = PowerRule::logarithmic_differentiation(&base, &exponent, x.clone());Sourcepub fn div(numerator: Expression, denominator: Expression) -> Expression
pub fn div(numerator: Expression, denominator: Expression) -> Expression
Create division expression helper for derivatives
Uses the symbolic division constructor since derivatives are symbolic operations.
§Examples
use mathhook_core::{Expression, symbol};
use mathhook_core::calculus::derivatives::PowerRule;
let x = symbol!(x);
let numerator = Expression::integer(1);
let denominator = Expression::symbol(x);
let division = PowerRule::div(numerator, denominator);Auto Trait Implementations§
impl Freeze for PowerRule
impl RefUnwindSafe for PowerRule
impl Send for PowerRule
impl Sync for PowerRule
impl Unpin for PowerRule
impl UnsafeUnpin for PowerRule
impl UnwindSafe for PowerRule
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