pub struct PolynomialSolver;Expand description
Polynomial equation solver
Implementations§
Source§impl PolynomialSolver
impl PolynomialSolver
pub fn new() -> Self
Sourcepub fn find_polynomial_degree(expr: &Expression, variable: &Symbol) -> u32
pub fn find_polynomial_degree(expr: &Expression, variable: &Symbol) -> u32
Find the degree of polynomial in given variable Static helper function for recursive degree calculation. Does not require instance state, only performs expression traversal.
Sourcepub fn solve_cubic(
&self,
equation: &Expression,
variable: &Symbol,
) -> SolverResult
pub fn solve_cubic( &self, equation: &Expression, variable: &Symbol, ) -> SolverResult
Solve cubic equation (simplified implementation)
Sourcepub fn solve_cubic_rational_root_theorem(
&self,
equation: &Expression,
variable: &Symbol,
) -> SolverResult
pub fn solve_cubic_rational_root_theorem( &self, equation: &Expression, variable: &Symbol, ) -> SolverResult
Try to solve cubic using rational root theorem
Sourcepub fn solve_quartic(
&self,
equation: &Expression,
variable: &Symbol,
) -> SolverResult
pub fn solve_quartic( &self, equation: &Expression, variable: &Symbol, ) -> SolverResult
Solve quartic equation (simplified implementation)
Sourcepub fn solve_quartic_rational_root_theorem(
&self,
equation: &Expression,
variable: &Symbol,
) -> SolverResult
pub fn solve_quartic_rational_root_theorem( &self, equation: &Expression, variable: &Symbol, ) -> SolverResult
Try to solve quartic using rational root theorem
Sourcepub fn evaluate_polynomial_at(
&self,
poly: &Expression,
variable: &Symbol,
value: &Expression,
) -> Expression
pub fn evaluate_polynomial_at( &self, poly: &Expression, variable: &Symbol, value: &Expression, ) -> Expression
Evaluate polynomial at specific value
Sourcepub fn substitute_variable(
expr: &Expression,
variable: &Symbol,
value: &Expression,
) -> Expression
pub fn substitute_variable( expr: &Expression, variable: &Symbol, value: &Expression, ) -> Expression
Substitute variable with value in expression
Static helper function for recursive substitution. Does not require instance state, only performs expression traversal and replacement.
Sourcepub fn extract_constant_and_leading(
&self,
poly: &Expression,
_variable: &Symbol,
) -> (i64, i64)
pub fn extract_constant_and_leading( &self, poly: &Expression, _variable: &Symbol, ) -> (i64, i64)
Extract constant term and leading coefficient from polynomial
Sourcepub fn get_divisors(&self, n: i64) -> Vec<i64>
pub fn get_divisors(&self, n: i64) -> Vec<i64>
Get all divisors of a number
Trait Implementations§
Source§impl Clone for PolynomialSolver
impl Clone for PolynomialSolver
Source§fn clone(&self) -> PolynomialSolver
fn clone(&self) -> PolynomialSolver
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PolynomialSolver
impl Debug for PolynomialSolver
Source§impl Default for PolynomialSolver
impl Default for PolynomialSolver
Source§impl EquationSolver for PolynomialSolver
impl EquationSolver for PolynomialSolver
Source§fn solve(&self, equation: &Expression, variable: &Symbol) -> SolverResult
fn solve(&self, equation: &Expression, variable: &Symbol) -> SolverResult
Solve equation for given variable
Source§fn solve_with_explanation(
&self,
equation: &Expression,
variable: &Symbol,
) -> (SolverResult, StepByStepExplanation)
fn solve_with_explanation( &self, equation: &Expression, variable: &Symbol, ) -> (SolverResult, StepByStepExplanation)
Solve with step-by-step explanation
Source§fn can_solve(&self, equation: &Expression) -> bool
fn can_solve(&self, equation: &Expression) -> bool
Check if solver can handle this equation type
Auto Trait Implementations§
impl Freeze for PolynomialSolver
impl RefUnwindSafe for PolynomialSolver
impl Send for PolynomialSolver
impl Sync for PolynomialSolver
impl Unpin for PolynomialSolver
impl UnwindSafe for PolynomialSolver
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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