Program:	APOLYNOM
Author:	Dave Gaebler
February 19, 1999

This is a combination of programs LAGRANGE, LAGRANG2, ALLROOTS, SYNTHDIV, PARFRAC, 
POLYMULT, and POLYDIV.  In case you didn't get them separately, I'll reproduce the 
descriptions for each of them:

LAGRANGE
Variables used:A,B,C,D,E,F,G,N,X,Y1,L1,L2,L3,L4,L5,L6,LP
Given n points with different x-coordinates, the Lagrange Interpolation Formula 
finds a polynomial of degree n-1 or less that passes through all the points.  
However, this polynomial is the sum of several polynomials, each of which is 
factored, e.g. (x-1)(x-3)(x+2)/(4-1)(4-3)(4+2).  Finding the actual coefficients 
is rather complicated.  This program finds the coefficients, displaying them in 
fractional form if possible, for reasonably small numbers of points (less than 
15 or so.)  It's painfully slow, though, for more than 4 or 5.  If you have a 
few points fairly close to the origin, use my other Lagrange program!

LAGRANG2
Variables used:A,B,N,X,Y,[A],L1,L2,L3
This program does not actually use the Lagrange Interpolation Formula, but it does find 
the coefficients of a polynomial (again, in fractional form if possible).  Given n points,
each x-coordinate must be raised to the power of n-1.  If one of the x-coordinates is 
really big, or there are a lot of points, you will probably get either an overflow error 
or a totally bogus answer.  But for (reasonably) small numbers of points with (reasonably)
small x-coordinates, it's accurate and quite fast.

In both Lagrange programs, you will be asked whether to "redimension" or not.  If you
choose yes, the graphing window will be adjusted to fit the points you entered.  If you 
choose no, the polynomial will be graphed in the current window.

ALLROOTS
Variables used: A,B,C,D,E,F,G,H,I,J,L1,L2,L3,Str1,Y1
The program starts with a menu allowing you to choose one of four 
things to do.  (1) Find the solutions of a quadratic equation using 
the quadratic formula.  (2) Find all the solutions of a cubic equation 
with the cubic formula.  (Yes, there is one!)  (3) Find all the 
solutions of a quartic equation using the quartic formula.  (Yes, 
there's one of those, too...but none for higher degrees.  Abel proved 
that in 1827.)  (4) Find all the rational roots of a polynomial 
(of any degree) with integer coefficients.  You enter the factors of 
the first and last coefficients (check out my brother's cool factoring 
program ABIGSIV if you need something factored).  (Don't just enter 
PRIME factors, though.  For twelve, enter {1,2,3,4,6,12}.  And you don't
have to enter negative factors for negative numbers.)  Then, 
using the Rational Roots Theorem, all the possible rational roots are 
checked to see if they actually are roots.  You will be given either a 
list of the rational roots or the message "NO RATIONAL ROOTS."

Note: The Rational Roots Theorem does not apply if the constant term
is zero.  If it is, factor out the highest power of x possible, then
use the Rational Roots Theorem on what's left.  

SYNTHDIV
Variables used:[A],A,C,D,X,L1,L2
Synthetic division is a method for dividing a polynomial f(x) by a linear factor of the
form x-a. The result is a polynomial (called the "depressed polynomial") and a constant
remainder equal to f(a).  This program prompts you for a list of the coefficients of the
polynomial (for example, x^2-3x+5 would be {1,-3,5}) and a list of the divisors (to divide
by x-2 and x+3, enter {2,-3}).  The results are displayed in a matrix.  The upper left 
entry is always zero.  Across the top are the coefficients of the polynomial you started 
with.  Each row below that consists of the divisor (-5 for x+5, etc.) followed by the 
depressed polynomial and the remainder.  For example, if you said to divide x^2-3x+5 by 
x-2, x+3, and x+5, the result would be the following matrix:
				[[0  1 -3 5 ]
				 [2  1 -1 3 ]
				 [-3 1 -6 23]
				 [-5 1 -8 45]]
This indicates that (x^2-3x+5)/(x-2)=x-1 with a remainder of 3, (x^2-3x+5)/(x+3)=x-6 with 
a remainder of 23, and (x^2-3x+5)/(x+5)=x-8 with a remainder of 45.  Each division is 
performed separately; the list is just a convenient way to do several and only have to 
run the program once.


PARFRAC
Variables used:A,B,C,D,E,F,G,[A],L1,L2,L3,listL,listN,listLPROD,listQPROD,listLP,listQP,
listQX,listQC (I know, too many lists)
This program breaks up a rational function into partial fractions (if you don't know what 
they are, consult a calculus textbook).  It assumes that the numerator is of lesser degree 
than the denominator (if not, use my POLYDIV program!) and that the denominator has already 
been factored into linear and irreducible (i.e. no real roots) quadratic factors.  It uses 
the method of comparing coefficients, in case you care.  You are asked to enter the 
numerator as a list of coefficients (e.g. x^3-3x+5 would be {1,0,-3,5}).  Then enter the 
constant terms of all the linear factors in the denominator.  (It assumes that the linear 
factors are in the form x-a.  If not, factor the x coefficient out of your entire rational 
function.)  If your linear factors are x-2 and x+3, enter {-2,3}.  Then list the power of 
each linear factor.  For example, if the (x-2) was squared but the (x+3) wasn't, enter 
{2,1}.  Then enter a list of the x terms of the quadratic factors (again, assumes a unity 
lead coefficient.)  Then a list of the constant terms of the quadratic factors.  For 
example, if (x^2+1) was a factor, you would enter {0} for the x coefficients and {1} for 
the constant terms.  Finally you are asked for the power list for the quadratic factors.  
After thinking a while, the decomposition will be displayed.  Our example, 
(x^3-3x+5)/((x-2)^2*(x+3)*(x^2+1)) decomposes into 
7/25(x-2)^2+2/25(x-2)-13/250(x+3)+(101-7x)/250(x^2+1).  Although big rational functions 
take a while (a 13th degree numerator over a 20th degree denominator took three minutes 
and 40 seconds), it should be able to do anything in your calculus textbook in 
ten seconds or less.


POLYMULT
Variables used:A,B,C,H,I,N,X,L1,L2,L3,[A]
This program allows you to multiply together any number of polynomials.  First it asks how 
many, then it asks for the length of the longest one.  Then you are asked for each 
polynomial.  Polynomials should all be entered as lists of coefficients with zeros filling 
in for missing powers.  For example, x^4-3x+1 would be {1,0,0,-3,1}.  After a (usually) 
brief think, the result will be a list which is paused so you can scroll if necessary.  
An example: Suppose you wanted to multiply x^2-3, x+2, and x-1.  Number of polys would be 3
and longest would be 3.  The polys would be {1,0,-3}, {1,2}, and {1,-1}.  The result would 
be {1,1,-5,-3,6}, i.e. x^4+x^3-5x^2-3x+6.

Note: This program uses prgmSUBPOLM, which multiplies together two polynomials.  If you 
want to multiply only two, the program goes to a special label designed for that purpose.  
You will not be asked the length of the longest one in this case.  Adding this special 
label made it about three times as fast when multiplying only two polynomials.


POLYDIV
Variables used:H,I,L1,L2,L3
This program divides polynomials.  First enter a list of coefficients for the numerator,
then a list for the denominator.  The result will be a polynomial (quotient) plus another
polynomial (remainder) over the original denominator.  To divide 2x^3+x^2+3x-6 by 3x^2+5,
enter {2,1,3,-6} for the numerator and {3,0,5} for the denominator.  The result will be 
2/3x+1/3 (i.e. {2/3,1/2} plus -1/3x-23/3 (i.e. {-1/3,-23/3}) over 3x^2+5.

