The PCalc Polynomial Calculator
Users' Guide and Reference
P. N. Hilfinger
The Polynomial Calculator (pcalc) provides a simple interface for
inputting multivariable polynomials, for adding, subtracting, and
multiplying them, for performing substitutions of their variables, and
for simplifying them to a canonical form.
Input is free format. A polynomial is written according to the
following BNF:
::= 
::= "+"  ""
::= "" 
::= 
::=  "^"
::=   "(" ")"

::= "(" ")"  "(" ")"
::= nonnegative decimal numeral
::= single lowercase letter
::= single uppercase letter
::=  ","
The s in a are multipled. The "^" syntax denotes
exponentiation.
All integer constants and all coefficients in computed polynomials
must be in the range 2**63 .. 2**631, or the results are undefined.
All exponents must be in the range 0 .. 2**311.
The possible input commands are as follows:
# Arbitrary text
A oneline comment.
;
Simplifies and prints .
DEF ( ) = ;
Defines the function call (p1,...pn) to be
with p1,...,pn substituted for the variables in
(which is a commaseparated list of 0 or more s).
Only the variables in may appear in .
QUIT
EXIT
Exit the program.
Command input is freeformat; commands (other than comments)
may cross line boundaries, and multiple commands are allowed on a line.
EXAMPLE:
In the following, input from the terminal is marked with a "> " prompt.
Pcalc, version 1.0
> # Computation of aX^3 + bX^2 + cX + d
> DEF P(x,a,b,c,d) = d+x(c+x(b+ax));
> P(y,1,2,3,4);
= y^32y^2+3y+4
> P(z,0,0,1,2)P(y,1,2,3,4);
= y^3z+2y^32y^2z4y^2+3yz+6y+4
> (y2)(z+1);
= yz+y2z2
> P(z,0,0,1,2)P(z,1,2,1,4);
= z^3+2z^22
> QUIT