Expanded README
This commit is contained in:
parent
ef57605b7a
commit
7ec833fa46
36
README.md
36
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
|
$ swipl
|
||||||
|
|
||||||
Inside the REPl, load the file
|
Inside the REPl, load the file
|
||||||
|
|
||||||
?- ["polimani.pl"].
|
?- ["polymani.pl"].
|
||||||
|
|
||||||
> Note: Don't forget the dot at the end of the line.
|
> Note: Don't forget the dot at the end of the line.
|
||||||
|
|
||||||
@ -18,13 +21,31 @@ The user available funtions are:
|
|||||||
4) scalepoly/3
|
4) scalepoly/3
|
||||||
5) addpoly/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.
|
These names are the ones requested in the assignment.
|
||||||
|
|
||||||
# Tests
|
## Tests
|
||||||
|
|
||||||
```
|
```
|
||||||
:- ["polimani.pl"].
|
:- ["polymani.pl"].
|
||||||
%@ true.
|
%@ true.
|
||||||
|
|
||||||
?- poly2list(2*x^2+3*x+5*x^17-7*x^21+3*x^3+25*x^5-4.3, S).
|
?- 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).
|
?- 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.
|
%@ S = 42*x^1337+25*x^5+5*x^17+3*x+2*x^2-1*x^4-9.3.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user