A equation solver as an API or usable as a cli application. Written in Rust.
Enter equation ← Output
-6 + 9/x = 3x ← Input
Output Input
↓ ↓
Solve for x
x = {1, -3} ← Output
Clone the repository:
git clone https://github.com/AlphaCodingPilot/Equation-Solver.git
- Run the main.rs file in the src directory.
- Enter an equation in the terminal.
- Specify the variable you want to solve for after 'Solve for '
- Create an instance of equation_input::EquationInput using the equation_input::EquationInput::new(equation, variable_name) function, parsing the equation and the variable name you want to solve for as strings.
- Use the solve_equation::solve_equation(input) function parsing the previously created equation-input. This returns a Result<equation_result::EquationResult, equation_error::EquationError> type.
- Evaluate the result: the equation_result::EquationResult type has three variants: Solutions(Vec), Unsolvable, InfiniteSolutions { exceptions: Vec}. You can evaluate each of the equation_error::EquationError variants manually or get a log-message using the log_message() method.
Pull requests are welcome. Before doing major changes please open a pull request first to discus it.