Make as great again
This commit is contained in:
parent
2057d2b14f
commit
e48ededaa7
36
polymani.pl
36
polymani.pl
@ -198,6 +198,14 @@ do_process_input(show(void, T)) :-
|
||||
polynomial_tree_to_polynomial(T, Pl),
|
||||
write(Pl),
|
||||
nl.
|
||||
do_process_input(store_simplified(V,PTNS)) :-
|
||||
polynomial_tree_to_polynomial(PTNS, PNS),
|
||||
simpoly(PNS,P),
|
||||
assertz(polynomial_store(V, P)),
|
||||
write(V),
|
||||
write(" = "),
|
||||
write(P),
|
||||
nl.
|
||||
do_process_input(store(P, T)) :-
|
||||
assertz(polynomial_store(P, T)).
|
||||
do_process_input(forget(P)) :-
|
||||
@ -207,6 +215,22 @@ do_process_input(simplify(PT)) :-
|
||||
simpoly(P, SP),
|
||||
write(SP),
|
||||
nl.
|
||||
do_process_input(store_multiplication(TN, PT, V)) :-
|
||||
polynomial_tree_to_polynomial(TN, N),
|
||||
polynomial_tree_to_polynomial(PT, P),
|
||||
(
|
||||
not(number(N)),
|
||||
scalepoly(N, P, P2)
|
||||
;
|
||||
number(N),
|
||||
scalepoly(P, N, P2)
|
||||
),
|
||||
simpoly(P2, SP),
|
||||
assertz(polynomial_store(V, SP)),
|
||||
write(V),
|
||||
write(" = "),
|
||||
write(SP),
|
||||
nl.
|
||||
do_process_input(multiply(TN, PT)) :-
|
||||
polynomial_tree_to_polynomial(TN, N),
|
||||
polynomial_tree_to_polynomial(PT, P),
|
||||
@ -553,9 +577,21 @@ parse_command(store(P, T)) -->
|
||||
parse_polynomial(T),
|
||||
[as],
|
||||
parse_stored_variable(P).
|
||||
parse_command(store_simplified(V, P)) -->
|
||||
[simplify],
|
||||
parse_polynomial(P),
|
||||
[as],
|
||||
[V].
|
||||
parse_command(simplify(T)) -->
|
||||
[simplify],
|
||||
parse_polynomial(T).
|
||||
parse_command(store_multiplication(TN, TP, V)) -->
|
||||
[multiply],
|
||||
parse_polynomial(TN),
|
||||
[by],
|
||||
parse_polynomial(TP),
|
||||
[as],
|
||||
[V].
|
||||
parse_command(multiply(TN, TP)) -->
|
||||
[multiply],
|
||||
parse_polynomial(TN),
|
||||
|
Reference in New Issue
Block a user