diff --git a/README.md b/README.md index e824e8e..a0ab741 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,16 @@ +# POLYnomial MANI.PuLation -# How to run +A symbolic polynomial calculator in Prolog -Run +## How to run + +In a terminal, run $ swipl Inside the REPl, load the file - ?- ["polimani.pl"]. + ?- ["polymani.pl"]. > Note: Don't forget the dot at the end of the line. @@ -18,13 +21,31 @@ The user available funtions are: 4) scalepoly/3 5) addpoly/3 -> Note: In the docs, `foo/N` means the funciton `foo` has `N` parameters. +`poly2list/2` - transforms a list representing a polynomial (second argument) +into a polynomial represented as an expression (first argument) +and vice-versa. + +`simpolylist/2` - simplifies a polynomial represented as a list into +another polynomial as a list. + +`simpoly/2` - simplifies a polynomial represented as an expression +as another polynomial as an expression. + +`scalepoly/3` - multiplies a polynomial represented as an expression by a scalar +resulting in a second polynomial. The two first arguments are assumed to +be ground. The polynomial resulting from the sum is in simplified form. + +`addpoly/3` - adds two polynomials as expressions resulting in a +third one. The two first arguments are assumed to be ground. +The polynomial resulting from the sum is in simplified form. + +> Note: `foo/N` means the funciton `foo` has `N` parameters. These names are the ones requested in the assignment. -# Tests +## Tests ``` -:- ["polimani.pl"]. +:- ["polymani.pl"]. %@ true. ?- poly2list(2*x^2+3*x+5*x^17-7*x^21+3*x^3+25*x^5-4.3, S). @@ -42,3 +63,6 @@ The user available funtions are: ?- addpoly(2*x^2+3*x+5*x^17-x^4+25*x^5-4.3, 42*x^1337+0-5, S). %@ S = 42*x^1337+25*x^5+5*x^17+3*x+2*x^2-1*x^4-9.3. ``` + +## License + diff --git a/polimani.pl b/polymani.pl similarity index 100% rename from polimani.pl rename to polymani.pl