


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


                      The RSIM command from ALG48

                             Version 4.01


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




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

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

RSIM 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 RSIM 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, RSIM 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.


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

The RSIM library is a small subset of the symbolic math library ALG48
[(c) by Claude-Nicolas Fiechter and Mika Heiskanen] that only provides
the rational simplification command RSIM.  It takes approximately 13Kb
of memory and is intended primarily for the HP48G for which the full
ALG48 library is too large. It will, however, also work in any port of 
a HP48GX or SX. 
 
We briefly describe the RSIM library here. For more details and examples
the reader is referred to the ALG48 documentation.


3. INSTALLATION
===============

RSIM is a regular auto-attaching library and has the same library number
as ALG48 (library number 909). To install it on your HP48 download the
file 'rsim.lib' onto your calculator (in BINARY mode), put the content
of the created variable on the stack, store it the port of your choice
(e.g., 'RSIM.LIB' DUP RCL SWAP PURGE 0 STO) and power-cycle the
calculator.

     ********************************************************
     * DO NOT USE ANY OF THE LIBRARIES THAT USE ALG48 (like *
     * SpecFun or LongFloat) WITH THE RSIM LIBRARY. IT WILL *
     * PROBABLY CRASH YOUR CALCULATOR.                      *
     ******************************************************** 


4. USE
======

RSIM is a powerful command for simplifying multivariate polynomials 
and rational functions. The simplification consists of two main steps

  1. Multiplying out all products of polynomials and collecting the
     terms of same degree for the numerator and denominator 
     polynomials;

  2. Simplification of the rational function by the multivariate
     polynomial greatest common divisor (GCD) of the the numerator 
     and denominator. 

The command will work on any algebraic expression by treating it as the
quotient of two polynomials in several "variables", which can actually
be  non-rational subexpressions.  

Here a three examples, with their execution time in brackets.

a)
       12     12               11      9       7       5      3
   (X+1) -(X-1)  = RSIM => 24*X  +440*X +1584*X +1584*X +440*X +24*X
                  [0.9s]

b)
                 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              

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


Depending on the type of the simplified rational function, RSIM
returns it in one of the following forms:

  - If the denominator of the rational function is a constant, then
    the result is returned as a polynomial with possibly rational
    coefficients;

  - If the numerator of the rational function is a constant, then
    the result is returned as the inverse of a polynomial with
    possibly rational coefficients;

  - If both the numerator and the denominator of the rational function
    contain variables, then the result is returned as the ratio of
    two polynomial with integer coefficients. 

In the polynomials the terms are arranged into descending order of their
degrees, and the "variables" in the terms are arranged in lexicographic
order, with the true variables (global and local names) first, followed
by the non-rational subexpressions.  E.g., 

            'A*X^2*Y^3*EXP(X)*EXP(Y)+X*Y^2-2*EXP(X)+3'.   

The RSIM command produces a "Infinite Result" error if the denominator
of the simplified expression is zero.


5. NOTES
========

* To ensure exact results RSIM only works with integer and rational
numbers and produces a "Bad Argumnent Type" error if it finds a
fractional number in the input. If the expressions you have contain
fractional numbers, you must convert them first into rational numbers by
using the command ->Q or ->Qpi of the HP48. 

* RSIM will produce a "Bad Argument Type" error if it finds a complex
number in (x,y) form in the input. However, complex arguments in the
form 'x+y*i' are handled properly, with 'i' treated as any other
variable. 

* If it is given an equation as input RSIM will simplify both side of
the equation independenlty. 

* Even though RSIM internally uses unlimited precision integers for all
its computations, the HP48 can only handle real numbers inside
symbolics. Thus RSIM cannot input (output) unlimited precision integers
from (into) algebraic expressions, and will produce a "Bad Argument
Value" if a  number in the input is too big to be represented exactly by
a real. 


6. CONTACT
==========

Gifts :), bug reports, and constructive comments and suggestions 
can be addressed to

 Claude-Nicolas Fiechter
 Department of Computer Science
 University of Pittsburgh
 Pittsburgh, PA 15260, U.S.A.

 e-mail: fiechter@cs.pitt.edu

or to 

 Mika Heiskanen
 Jamerantaival 7 C 355
 02150 Espoo
 Finland

 e-mail: mheiskan@delta.hut.fi
