pub struct BasicIntegrals;Expand description
Basic integration operations
Implementations§
Source§impl BasicIntegrals
impl BasicIntegrals
Sourcepub fn handle_calculus(
expr: &Expression,
data: &CalculusData,
variable: Symbol,
) -> Expression
pub fn handle_calculus( expr: &Expression, data: &CalculusData, variable: Symbol, ) -> Expression
Handle integration of calculus expressions
§Examples
use mathhook_core::calculus::integrals::{BasicIntegrals, Integration};
use mathhook_core::{Expression, symbol};
let x = symbol!(x);
let expr = Expression::integral(Expression::symbol(x.clone()), x.clone());
let result = expr.integrate(x, 0);Sourcepub fn handle_constant(expr: &Expression, variable: Symbol) -> Expression
pub fn handle_constant(expr: &Expression, variable: Symbol) -> Expression
Handle integration of constant expressions
§Examples
use mathhook_core::{Expression, BasicIntegrals};
use mathhook_core::symbol;
let x = symbol!(x);
let expr = Expression::integer(5);
let result = BasicIntegrals::handle_constant(&expr, x);Sourcepub fn handle_symbol(sym: &Symbol, variable: &Symbol) -> Expression
pub fn handle_symbol(sym: &Symbol, variable: &Symbol) -> Expression
Handle integration of symbol expressions
§Examples
use mathhook_core::{Expression, BasicIntegrals};
use mathhook_core::symbol;
let x = symbol!(x);
let y = symbol!(y);
let dx = BasicIntegrals::handle_symbol(&x, &x);
let dy = BasicIntegrals::handle_symbol(&x, &y);Sourcepub fn handle_sum(
terms: &[Expression],
variable: &Symbol,
depth: usize,
) -> Expression
pub fn handle_sum( terms: &[Expression], variable: &Symbol, depth: usize, ) -> Expression
Handle integration of sum expressions using linearity
§Arguments
terms- Terms in the sumvariable- Variable to integrate with respect todepth- Current recursion depth
§Examples
use mathhook_core::{Expression, BasicIntegrals};
use mathhook_core::symbol;
use mathhook_core::calculus::integrals::Integration;
let x = symbol!(x);
let terms = vec![Expression::symbol(x.clone()), Expression::integer(5)];
let result = BasicIntegrals::handle_sum(&terms, &x, 0);Sourcepub fn handle_product(
factors: &[Expression],
variable: Symbol,
depth: usize,
) -> Expression
pub fn handle_product( factors: &[Expression], variable: Symbol, depth: usize, ) -> Expression
Handle integration of product expressions
Preserves factor order for noncommutative expressions (matrices, operators, quaternions).
§Arguments
factors- Factors in the productvariable- Variable to integrate with respect todepth- Current recursion depth
§Examples
use mathhook_core::{Expression, BasicIntegrals};
use mathhook_core::symbol;
let x = symbol!(x);
let factors = vec![Expression::integer(3), Expression::symbol(x.clone())];
let result = BasicIntegrals::handle_product(&factors, x, 0);Sourcepub fn handle_power(
base: &Expression,
exp: &Expression,
variable: Symbol,
) -> Expression
pub fn handle_power( base: &Expression, exp: &Expression, variable: Symbol, ) -> Expression
Handle integration of power expressions using power rule
Power rule for integer exponents: ∫x^n dx = x^(n+1)/(n+1) + C (n ≠ -1) Power rule for rational exponents: ∫x^(p/q) dx = (q/(p+q))·x^((p+q)/q) + C (p+q ≠ 0) Special case: ∫x^(-1) dx = ln|x| + C
For expressions like x^2, uses the standard power rule. For more complex expressions, defers to by-parts or other methods.
§Arguments
base- Base of the power expressionexponent- Exponent of the power expressionvariable- Variable to integrate with respect to
§Examples
use mathhook_core::{Expression, BasicIntegrals};
use mathhook_core::symbol;
let x = symbol!(x);
let base = Expression::symbol(x.clone());
let exp = Expression::integer(2);
let result = BasicIntegrals::handle_power(&base, &exp, x);Auto Trait Implementations§
impl Freeze for BasicIntegrals
impl RefUnwindSafe for BasicIntegrals
impl Send for BasicIntegrals
impl Sync for BasicIntegrals
impl Unpin for BasicIntegrals
impl UnsafeUnpin for BasicIntegrals
impl UnwindSafe for BasicIntegrals
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