BASIC CALCULATOR WITH POLYNOMIALS Several years ago I wanted a version of bc to run on my dos computer, and there were none to be found, so I wrote one. If you're performing arithmetic operations on integers, it works just like bc. This version is called pbc, for public domain bc or polynomial bc. As the last apalation implies, this bc can manipulate polynomials. (Matrices would be nice too, but I never had the time to implement them.) On the other hand, pbc doesn't have function syntax or floating point. Thus neither program is a subset of the other. On Unix, I can invoke either pbc or bc, depending on the features I need at the time. The features I included in pbc are those I found useful when doing graduate work in mathematics at U.C. Berkeley. These include modular mathematics, factoring, polynomials, and base conversion. Here are a few examples that illustrate the additional features. Although pbc does not normally issue an interactive prompt, I include one below for clarity. Lines starting with '<' represent user input. < prime 23 /* strong pseudoprime test */ prime < prime 23^2 composite < factor 54 /* pollard rho */ 2*3*3*3 < "x+3"^2 x^2 + 6*x + 9 < p = . /* store last output in p */ < x = 7 < p(x) /* evaluate polynomial */ 100 < y@4 = "-1-y-y^2-y^3" /*5th cyclotomic root*/ < y^5 1 < i@2 = -1 /* complex numbers */ < (4+i) * (3-i) -i + 13 < mod 23 /* perform all calculations mod 23 */ < 1/7 /* inverse of 7 mod 23 */ 10 < mod /* return to normal arithmetic */ < 1/7 0 < mod 3 < "a+b"^3 /* frabinious */ a^3 + b^3 < mod < 10! /* factorial */ 3628800 < mod 11 < 10! /* verify wilson's theorem */ 10 < 7^10 /* verify Fermat's little theorem */ 1 < mod < 7//4 /* binomial coefficient */ 35 < ibase 16 /* input redix */ < 0ff /* lower case hex digits are ok */ 255 < ibase /* back to decimal */ < obase 16 < 255 FF < obase < p'x /* formal derivative with respect to x */ 2*x + 6 < p'x'x 2 < mod 109 /* factor polynomials over a finite field */ < p="x^7+3*x+1" < factor p x + 38 x^6 + 71*x^5 + 27*x^4 + 64*x^3 + 75*x^2 + 93*x + 66 < nextprime 100 /* find the next prime */ 101 < csplit 173 /* find the gaussian prime over this prime */ 13+2 < "x+1"/"x-1" /* rational expressions */ x + 1 / x - 1 < r = . < top r x + 1 < bottom r x - 1 < sqrt 24 /* square root */ 4 < sqrt 25 5* < cbrt 500 /* cube root */ 7 < qt /* exit the program */ Sorry - that's all the documentation you get! This program behaves horribly at the slightest syntax error. sometimes it just crashes. Send any questions or comments to the author, Karl Dahlke, at eklhad@comcast.net