pub struct SummationMethods;Expand description
Summation methods and utilities
§Performance
All methods use closed-form formulas when applicable, providing O(1) time complexity for arithmetic/geometric series and power sums (k ≤ 3). General sums remain symbolic.
Implementations§
Source§impl SummationMethods
impl SummationMethods
Sourcepub fn arithmetic_series(
first_term: &Expression,
common_difference: &Expression,
num_terms: &Expression,
) -> Expression
pub fn arithmetic_series( first_term: &Expression, common_difference: &Expression, num_terms: &Expression, ) -> Expression
Sourcepub fn geometric_series(
first_term: &Expression,
common_ratio: &Expression,
num_terms: &Expression,
) -> Expression
pub fn geometric_series( first_term: &Expression, common_ratio: &Expression, num_terms: &Expression, ) -> Expression
Sourcepub fn infinite_geometric_series(
first_term: &Expression,
common_ratio: &Expression,
) -> Expression
pub fn infinite_geometric_series( first_term: &Expression, common_ratio: &Expression, ) -> Expression
Compute infinite geometric series sum: Σ(ar^(i-1)) from i=1 to ∞
§Formula
Sum = a / (1 - r) for |r| < 1
§Domain Restriction
Convergence requires |r| < 1. For |r| ≥ 1, series diverges.
§Performance
- Time Complexity: O(1) - uses closed-form formula
- Space Complexity: O(1) - constant expression construction
Sourcepub fn power_sum(power: &Expression, upper_limit: &Expression) -> Expression
pub fn power_sum(power: &Expression, upper_limit: &Expression) -> Expression
Compute power sum: Σ(i^k) from i=1 to n using Faulhaber’s formulas
§Formulas (SymPy Validated)
- k=0: Σ1 = n
- k=1: Σi = n(n+1)/2
- k=2: Σi² = n(n+1)(2n+1)/6
- k=3: Σi³ = [n(n+1)/2]²
§Performance
- Time Complexity: O(1) for k ∈ {0,1,2,3}, symbolic for k > 3
- Space Complexity: O(1) - constant expression construction
Sourcepub fn convergence_test(
expr: &Expression,
variable: &Symbol,
) -> ConvergenceResult
pub fn convergence_test( expr: &Expression, variable: &Symbol, ) -> ConvergenceResult
Check convergence of infinite series
Simplified p-series test: Σ(1/n^p) converges iff p > 1
§Performance
- Time Complexity: O(1) - pattern matching only
- Space Complexity: O(1) - returns enum variant
Auto Trait Implementations§
impl Freeze for SummationMethods
impl RefUnwindSafe for SummationMethods
impl Send for SummationMethods
impl Sync for SummationMethods
impl Unpin for SummationMethods
impl UnwindSafe for SummationMethods
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