Add user interface
This commit is contained in:
parent
3089daf645
commit
d217a20c70
46
polimani.pl
46
polimani.pl
@ -29,6 +29,52 @@
|
|||||||
*/
|
*/
|
||||||
:- use_module(library(clpfd)).
|
:- use_module(library(clpfd)).
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
* USER INTERFACE *
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
poly2list/2 transforms a list representing a polynomial (second
|
||||||
|
argument) into a polynomial represented as an expression (first argu-
|
||||||
|
ment) and vice-versa.
|
||||||
|
*/
|
||||||
|
poly2list(P, L) :-
|
||||||
|
polynomial_to_list(P,L).
|
||||||
|
|
||||||
|
/*
|
||||||
|
simpolylist/2 simplifies a polynomial represented as a list into
|
||||||
|
another polynomial as a list.
|
||||||
|
*/
|
||||||
|
simpoly_list(L, S) :-
|
||||||
|
simplify_polynomial_list(L, S).
|
||||||
|
|
||||||
|
/*
|
||||||
|
simpoly/2 that simplifies a polynomial represented as an expression
|
||||||
|
as another polynomial as an expression.
|
||||||
|
*/
|
||||||
|
simpoly(P, S) :-
|
||||||
|
simplify_polynomial(P, S).
|
||||||
|
|
||||||
|
/*
|
||||||
|
scalepoly/3 that multiplies one polynomial as 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.
|
||||||
|
*/
|
||||||
|
scalepoly(P1, P2, S) :-
|
||||||
|
scale_polynomial(P1, P2, S).
|
||||||
|
|
||||||
|
/*
|
||||||
|
addpoly/3 that 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.
|
||||||
|
*/
|
||||||
|
addpoly(P1, P2, S) :-
|
||||||
|
add_polynomial(P1, P2, S).
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
* BACKEND *
|
||||||
|
*******************************/
|
||||||
|
|
||||||
%% polynomial_variable_list(-List) is det
|
%% polynomial_variable_list(-List) is det
|
||||||
%
|
%
|
||||||
% List of possible polynomial variables
|
% List of possible polynomial variables
|
||||||
|
Reference in New Issue
Block a user