The goal of this project is to get acquainted with handling elementary math tools that may be helpful for other 42 projects. You will not “do math for doing math”, but to develop a progressive and relaxed approach to projects where these tools are needed.
computorv1
is a polynomial equation solver that efficiently handles linear and quadratic equations. It utilizes the Logos Lexer for lexical analysis and Clap for command-line argument parsing, ensuring a seamless and user-friendly experience.
To install computorv1
, follow these steps:
- Ensure that you have Rust installed on your system. If not, install Rust from the official website.
- Clone the
computorv1
repository: - Navigate to the cloned directory:
- Build the project using Cargo, Rust's package manager and build system:
- Navigate to the binary:
git clone https://github.com/0xSpyC/computorv1.git cd computorv1 cargo build --release cd target/release
To solve a polynomial equation using computorv1
, use the following command syntax:
./computorv1 "<polynomial>"
A polynomial is an equation with the Following Form :
Replace with the equation you want to solve. For example:
./computorv1 "2 * X^2 + 4 * X + 1 = 0"
This command will output the solution to the specified quadratic equation.
computorv1
comes with a suite of tests to ensure its reliability and accuracy. To run these tests, use the following command:
cargo test
cargo test --test <specific_test>
This will execute all tests defined in the project, verifying the functionality of various components including the polynomial solver, Logos Lexer, polynomial parser. Specific tests are : polynomial, tokenize, parsing
- • The equation in its reduced form.
- • The degree of the equation.
- • Its solution(s) and the polarity of the discriminant if it makes sense.
- • Manage entry mistakes (vocabulary and syntax).
- • Manage free form entrie.
- • Display solution(s) as an irreducible fraction if it’s interesting.
- • Display the intermediate steps.
For further information or if you encounter any issues submit an issue on the GitHub repository.