This is a tool to calculate rational roots of a polynomial equation. This tool does its job by applying the Rational root theorem. This program is developed entirely in C99. There are no dynamic allocations; everything is static and the program memory is completely predictable. Documentation of each function, macro and struct can be read in the header files inside the folder include/.
If the polynomial equation
$a_{n} x^{n} + a_{n - 1} x^{n - 1} + ... + a_{0} = 0$ with integer coefficients$a_{i} \in \Z$ and$a_{0}, a_{n} \neq 0$ has a rational solution$x = \frac{p}{q}$ ($p$ and$q$ are relative prime), then the solution satisfies:
$p$ is an integer factor of$a_{0}$ , and$q$ is an integer factor of$a_{n}$ .
For example, looking at the equation
After testing for all possible values of
Compile the program with make (gcc is required):
makeThe program would be compiled in seconds; the standalone executable file would be created at build/bin/rrcal.
The exhaustive list of pre-defined settings are presented in include/macros.h. See the documentation in that file for more.
Before running anything, make sure you have the executable
rrcal(orrrcal.exe) in the current working directory, or in the PATH variable. Nonetheless, you can access the executable with its absolute path. The executable is "standalone", which means you can move or copy it to anywhere you want.
To calculate rational roots of a polynomial equation (under the condition specified in the theorem), for instance,
rrcal -6 -1 1All rational roots of the polynomial specified by coefficients (sequentially from
Another example:
rrcal 30 23 -29 6- Implement simple factorization.
- Implement rational root hunter.
- Parse arguments.
- Write unit tests.
- Write a simple UI.