pub struct SmartEquationSolver { /* private fields */ }Expand description
Master equation solver with smart dispatch
Implementations§
Source§impl SmartEquationSolver
impl SmartEquationSolver
pub fn new() -> Self
Sourcepub fn solve_with_equation(
&self,
equation: &Expression,
variable: &Symbol,
) -> (SolverResult, StepByStepExplanation)
pub fn solve_with_equation( &self, equation: &Expression, variable: &Symbol, ) -> (SolverResult, StepByStepExplanation)
Solve equation with educational explanation, including equation analysis
This is the primary entry point for solving equations with full educational integration. It automatically:
- Analyzes the equation type
- Explains the equation structure
- Selects the appropriate solver
- Provides step-by-step solution with explanations
§Arguments
equation- The equation expression to solvevariable- The variable to solve for
§Returns
A tuple containing:
- The solver result (solutions or error)
- Complete step-by-step explanation starting with equation analysis
Sourcepub fn solve(&self) -> (SolverResult, StepByStepExplanation)
pub fn solve(&self) -> (SolverResult, StepByStepExplanation)
Legacy solve method (deprecated, use solve_with_equation instead)
Sourcepub fn solve_system(
&self,
equations: &[Expression],
variables: &[Symbol],
) -> SolverResult
pub fn solve_system( &self, equations: &[Expression], variables: &[Symbol], ) -> SolverResult
Solve system of equations using the integrated system solver
This method exposes the system solving capability through SmartEquationSolver, allowing for solving both linear and polynomial systems (via Grobner basis).
§Arguments
equations- Array of equations to solvevariables- Array of variables to solve for
§Returns
SolverResult containing solutions, no solution, or partial solutions
§Examples
use mathhook_core::algebra::equation_analyzer::SmartEquationSolver;
use mathhook_core::{symbol, Expression};
let solver = SmartEquationSolver::new();
let x = symbol!(x);
let y = symbol!(y);
// Linear system: 2x + y = 5, x - y = 1
let eq1 = Expression::add(vec![
Expression::mul(vec![Expression::integer(2), Expression::symbol(x.clone())]),
Expression::symbol(y.clone()),
Expression::integer(-5),
]);
let eq2 = Expression::add(vec![
Expression::symbol(x.clone()),
Expression::mul(vec![Expression::integer(-1), Expression::symbol(y.clone())]),
Expression::integer(-1),
]);
let result = solver.solve_system(&[eq1, eq2], &[x, y]);Trait Implementations§
Auto Trait Implementations§
impl Freeze for SmartEquationSolver
impl !RefUnwindSafe for SmartEquationSolver
impl Send for SmartEquationSolver
impl Sync for SmartEquationSolver
impl Unpin for SmartEquationSolver
impl !UnwindSafe for SmartEquationSolver
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