Console calculator with support of the Integer, Rational, Modular arithmetic, as well as the Polynomials over these types
- GCC 7.3.0 (C++ 11)
- CMake
To compile the project, run the following command in the root folder:
cmake --build build --config Release --target all -j
This should generate palgebra executable inside build
folder. Now you can run it and move to the next steps. Note that you can use exit()
command to close the application.
Usage is fairly intuitive, so I have decided to include some examples and that's it.
Notes:
p//q
stands for the rational number with numeratorp
and denominatorq
[a, N]
stands fora
moduloN
- Implicit type conversion between
INTEGER
andRATIONAL
data types is implemented
Notes:
- Variable type is deduced from the expression on the right side of the assignment operator
;
serves as the separator in complex sentencesprint
command is introduced here. It may seem unnecessary, yet it's possible to use it in complex sentences
Notes:
- Monomial is represented as
c.X^n
wherec
- coefficient (INTEGER
,RATIONAL
orMODULAR
) andX^n
means that monomial is of degreen
- Implicit type conversion between
POLYNOMIAL{INTEGER}
andPOLYNOMIAL{RATIONAL}
data types is implemented eval
command is introduced here: for polynomialpoly
of typePOLYNOMIAL{T}
,eval(poly, x)
, wherex
is of typeT
means evaluation in pointx
. In other words, this command allows us to treat polynomials as functions
Notes:
gcd
method is implemented for the following data types:INTEGER
,POLYNOMIAL{RATIONAL}
andPOLYNOMIAL{MODULAR}
, although for the non-prime modulus it cannot be guaranteed that the method will return the correct result