



                      ###    #      ####      #   ###
                     #   #   #     #         ##  #   #
                    #     #  #    #         # #  #   #
                    #######  #    #  ####  #  #   ###
                    #     #  #    #     #  ##### #   #
                    #     #  #     #    #     #  #   #
                    #     #  ####   ####      #   ###


                     AN ALGEBRA LIBRARY FOR THE HP48


                               Version 4.0


       (c) 1994-97 by Claude-Nicolas Fiechter & Mika Heiskanen




1. ACKNOWLEDGEMENTS, COPYRIGHT & DISCLAIMER OF WARRANTY
=======================================================

All the files of the ALG48 library are copyrighted (c) by 
Claude-Nicolas Fiechter and Mika Heiskanen. 

ALG48 is distributed in the hope that it will be useful, but the
COPYRIGHT HOLDERS PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE TO YOU FOR
DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM.

This version of ALG48 is a GiftWare release. You may use it as long as
you like, but only for non-commercial purposes and only as a private
person. Permission to copy the whole, unmodified, ALG48 library is
granted provided that the copies are not made or distributed for resale
(excepting nominal copying fees) and provided that you conspicuously and
appropriately include on each copy this copyright notice and disclaimer
of warranty.

Special thanks to Dominique Rodriguez for his LaTeX version of the
documentation for ALG48 v2.1, and to Joe Horn for his many useful
comments, suggestions and detailed bug reports. 


2. OVERVIEW
===========

ALG48 is a comprehensive symbolic math package for the HP48. It includes
commands for algebraic simplification, factorization, partial fraction
expansion, symbolic integration, symbolic matrices manipulation, and for
solving systems of nonlinear polynomial equations.

ALG48 differs from other math packages for the HP48 in two important
aspects:

1. ALG48 can manipulate, simplify, and factorize multivariate
   polynomials and functions, i.e., algebraic expressions with 
   several variables.

2. ALG48 only does exact calculation, using unlimited precision 
   integers and advanced computer algebra algorithms (as opposed to 
   doing approximate calculation using floating point numbers and 
   numerical algorithms). This not only means you will not get wrong 
   or approximate results ($2.00001$, $4.9999$ and the like), but 
   also that all and only exact simplifications are performed.


Here are some examples of ALG48 operations. The time taken for the 
commands on a HP48GX (with ~60K free) are given in brackets.

 * Simplification of multivariate polynomials 
   and rational functions:

                Y            
           1 - ---           
               X+Y           
       1 - -------           
                X            
           1 - ---           
               X+Y                              2          2
   -------------------------   = RSIM =>   INV(X  + X*Y + Y )
    2      X       [X*Y    ]    [1.8s]
   Y  - -------- * [--- - X] 
             X     [Y-X    ] 
        1 + ---              
            Y-X              


 * including polynomials and rational functions with 
   non-rational subexpressions:


   COS(A)*SIN(A)-COS(A)-SIN(A)+1               SIN(A)-1
   -----------------------------   = RSIM =>   --------
   COS(A)*SIN(A)+COS(A)-SIN(A)-1    [0.9s]     SIN(A)+1


 * Complete factorization of polynomials and rational functions:

      9     8     7     6     5      4      3      2 
   75X -435X +852X -576X -663X +3027X -4911X +3402X-735X

                                                               2
     = FCTR [4.9s] =>  3 * X * (X^2-3*X+1) * (X^4+X-5) * (5X-7)
       

 * including polynomials and rational functions in several variables:

      5      4 2   3 2    3    3  2 2   2    2    3           3   2
   3*X *Y+9*X Y -3X Y +21X Y-2X +X Y -6X Y+5X +3XY +17XY-14X-Y +7Y -5Y+35

    = FCTR [11.2s] => (X^2+3XY-Y+7) * (3X^3Y-2X+Y^2+5)


 * Simplification of non-rational expressions:


       SQRT(X^3+X^2-X-1)                  SQRT(X-1)
   -------------------------  = ASIM =>  -----------
   SQRT(12*SQRT(5)+49)*(X+1)   [4.3s]    3*SQRT(5)+2 

 
 * including exponential functions:


   X*EXP(3*LN(X)+LN(X^2)) - 1               4    2
   --------------------------  = ASIM => 2*X +2*X +2               
      LN(SQRT(EXP(X^2-1)))      [1.8s]


 * and trigonometric functions:


   COS(ASIN(SIN(X)-COS(X)))^2             SIN(X)*COS(X) 
   --------------------------  = ASIM =>  -------------
    LN(SIN(X)*COS(X)*TAN(X))    [8.6s]     LN(SIN(X))


 * Partial fraction expansion along one or several variables:

    X^3Y^2-3X^3Y+3X^3-X^2Y^2+2X^2Y-3X^2-XY^4+5XY^3-8XY^2+5XY-Y^3+3Y^2-2Y
    --------------------------------------------------------------------
            X^2Y^2-3X^2Y+2X^2-XY^3+2XY^2+XY-2X+Y^3-3Y^2+2Y
 
                      X     X     Y     Y
    = PF => Y + X +  --- - --- + --- + ---
    [8.3s]           Y-2   Y-1   X-Y   X-1


 * Rational function integration:

    27X^7-42X^6-106X^5-47X^4+224X^3-147X^2+313X+138
   -------------------------------------------------
   15x^8-15x^7+15x^6-60x^5+90x^4-105x^3+45x^2+60x-45

                  9X-11                      X+1       3
   = X RINT =>  ---------  + SQRT(2) ATAN( ------- ) + - LN(X^3+X+1)
      [8.8s]    3X^2-6X+3                  SQRT(2)     5 

 
 * Symbolic vector and matrix operations:

   Inverse

   {{   3   2*X^2   1   }            {{  2*X^4+1  (-4*X^4-1)/(2*X)   X^2  }
    {  4*X  2*X^3  2*X  }  = AINV =>  {  -2*X^2          2*X         -1   }
    { 2*X^2  -1   2*X^2 }}  [5.5s]    { -2*X^4-2   (4*X^4+3)/(2*X)  -X^2  }}


   Determinant

   {{ 1 T T T }
    { 1 K T T }              3   2     2  3                 3
    { 1 T K T }  = MDET =>  K -3K T+3KT -T   = FCTR => (K-T)
    { 1 T T K }}  [1.6s]                      [1.8s]


   Addition, Subtraction, Negation, Multiplication, 
   Division, Exponentiation, Transpose ...


 * Solution of systems of linear equations (Ax = b) 
   with symbolic coefficients

     b: { 1 2 3 }

     A: {{  1-T    2   -4 }
         { 3/2-T   3   -5 }
         { 5/2+T   5   -7 }}

        = ADIV [3.3s] =>
                    
     x: { INV(-2*T)  (7*T+1)/(4*T)  3/4 }


 * Solution of systems of nonlinear polynomial equations 
   using Groebner bases

   {          2X^2+XY-Y+1=0
            -3XY-X+2Y^2-2=0 
     2X^2-3XY^2+2Y^3-3Y+1=0 } 

   = { X Y } GSOLVE [4.9s] =>
             
   { X  Y-1 } ,  { 2X-6Y-5  14Y^2+21Y+9 }


Additional features include:

 * Provides arithmetic operations on unlimited-size integer numbers,
   including modular arithmetic, integer factorization, and primality
   testing.

 * Can be used to easily calculate with fractions.

 * Can perform algebraic operations over finite fields (modular 
   polynomials).

 * Can handle polynomials and rational functions of arbitrary degrees
   and with arbitrary many variables (limited only by your HP48's memory 
   and by your patience).

 * Entirely written in system-RPL and machine language.
