The ALG directory

ALG is mainly a frontend to Mika Heiskanen's/Claude-Nicolas Fiechter's great
ALG48 library. ALG deals with solving algebraic equations.
ALG48 is required. I used ALG48v4.0, but earlier versions should do too.

ALG's Main Programs Fctr and SOLV are building blocks for solving algebraic
equations.

Fctr is similar to ALG48's FCTR - eventually it's FCTR that does the main
job. Fctr takes a polynomial with integer coefficients from the stack and
returns the factors having integer coefficients, each factor (possibly
raised to a power) as one position on the stack.
Polynomial input may be in algebraic form (as with ALG48's FCTR) or as an
array of the coefficients (for easier input).

So                                               [ 1 3 6 2 -3 -9 ] Fctr
yields the 2 factors on the stack
                                                 '(X^2+2*X+3)^2'
                                                 'X-1'

Now to each of the factors SOLV can be applied:
                                                 'X-1' SOLV
                                         yields
                                                 1

                                                 '(X^2+2*X+3)^2' SOLV
                                         yields
                                                 -1+\/2*i
                                                 -1-\/2*i

SOLV requires the variable in the input polynomial to be 'X'.

If applied to a power of a polynomial as in the example, SOLV first
eliminates the power. If the polynomial then has degree 1 or 2, the
solutions are calculated symbolically. For higher degrees SOLV uses
HP48G(X)'s PROOT function for an approximation of the roots. So an HP48G
is required in this case.


Of course SOLV can be used alone, without using Fctr in advance, for
instance for solving symbolically quadratic equations with integer
coefficients. For easy input SOLV's input polynomial may be given as an
array of the coefficients.


As for Fctr, Fctr can also be used for calculating the prime factors of an
integer, like FCTR does. However a real may be used as input.

So                                   86632 Fctr
                            yields
                                     { 2 2 2 7 7 13 17 }


The auxiliary programs SSQR, P2A and A2P may be of interest too.
SSQR symbolically computes the square root of a positive integer.

So                                   2925 SSQR
                            yields
                                     15*\/13

P2A transforms a polynomial, given as an array of integer coefficients, into
algebraic form.

So                                   [ 1 2 0 3 ] P2A
                            yields
                                     'X^3+2*X^2+3'

A2P transforms in the opposite direction.

So                                   'X^3+2*X^2+3' A2P
                            yields
                                     [ 1 2 0 3 ].


I hope you find these programs useful.
You are free to use and copy these programs.
However I am not responsible for any damage that results from using these
programs.

Horst Albrecht
Brahmsstrae 25

D-41541 Dormagen

