16.5 ASSIST: Useful utilities for various applications

ASSIST contains a large number of additional general purpose functions that allow a user to better adapt REDUCE to various calculational strategies and to make the programming task more straightforward and more efficient.

Author: Hubert Caprasse.

16.5.1 Introduction

The package ASSIST contains an appreciable number of additional general purpose functions which allow one to better adapt REDUCE to various calculational strategies, to make the programming task more straightforward and, sometimes, more efficient.

In contrast with all other packages, ASSIST does not aim to provide either a new facility to compute a definite class of mathematical objects or to extend the base of mathematical knowledge of REDUCE . The functions it contains should be useful independently of the nature of the application which is considered. They were initially written while applying REDUCE to specific problems in theoretical physics. Most of them were designed in such a way that their applicability range is broad. Though it was not the primary goal, efficiency has been sought whenever possible.

The source code in ASSIST contains many comments concerning the meaning and use of the supplementary functions available in the algebraic mode. These comments, hopefully, make the code transparent and allow a thorough exploitation of the package. The present documentation contains a non–technical description of it and describes the various new facilities it provides.

16.5.2 Survey of the Available New Facilities

An elementary help facility is available both within the MS-DOS and Windows environments. It is independent of the help facility of REDUCE itself. It includes two functions:

ASSIST is a function which takes no argument. If entered, it returns the informations required for a proper use of ASSISTHELP.
ASSISTHELP takes one argument.

The package contains several modules. Their content reflects closely the various categories of facilities listed below. Some functions do already exist inside the KERNEL of REDUCE . However, their range of applicability is extended.

In the following all these functions are described.

16.5.3 Control of Switches

The two available functions i.e. SWITCHES, SWITCHORG have no argument and are called as if they were mere identifiers.

SWITCHES displays the actual status of the most frequently used switches when manipulating rational functions. The chosen switches are


The selection is somewhat arbitrary but it may be changed in a trivial fashion by the user.

The new switch DISTRIBUTE allows one to put polynomials in a distributed form (see the description below of the new functions for manipulating them. ).

Most of the symbolic variables !*EXP, !*DIV, which have either the value T or the value NIL are made available in the algebraic mode so that it becomes possible to write conditional statements of the kind

        IF !*EXP THEN DO ......  
        IF !*GCD THEN OFF GCD;  

SWITCHORG resets the switches enumerated above to the status they had when starting REDUCE .

16.5.4 Manipulation of the List Structure

Additional functions for list manipulations are provided and some already defined functions in the kernel of REDUCE are modified to properly generalize them to the available new structure BAG.

16.5.5 The Bag Structure and its Associated Functions

The LIST structure of REDUCE is very convenient for manipulating groups of objects which are, a priori, unknown. This structure is endowed with other properties such as “mapping” i.e. the fact that if OP is an operator one gets, by default,

        OP({x,y}); ==> {OP(x),OP(y)}  

It is not permitted to submit lists to the operations valid on rings so that, for example, lists cannot be indeterminates of polynomials.
Very frequently too, procedure arguments cannot be lists. At the other extreme, so to say, one has the KERNEL structure associated with the algebraic declaration operator . This structure behaves as an “unbreakable” one and, for that reason, behaves like an ordinary identifier. It may generally be bound to all non-numeric procedure parameters and it may appear as an ordinary indeterminate inside polynomials.
The BAG structure is intermediate between a list and an operator. From the operator it borrows the property of being a KERNEL and, therefore, may be an indeterminate of a polynomial. From the list structure it borrows the property of being a composite object.
A bag is an object endowed with the following properties:

  1. It is a KERNEL i.e. it is composed of an atomic prefix (its envelope) and its content (miscellaneous objects).
  2. Its content may be handled in an analogous way as the content of a list. The important difference is that during these manipulations the name of the bag is kept.
  3. Properties may be given to the envelope. For instance, one may declare it NONCOM or SYMMETRIC etc. 

Available Functions:

16.5.6 Sets and their Manipulation Functions

Functions for sets exist at the level of symbolic mode. The package makes them available in algebraic mode but also generalizes them so that they can be applied to bag-like objects as well.

16.5.7 General Purpose Utility Functions

Functions in this sections have various purposes. They have all been used many times in applications in some form or another. The form given to them in this package is adjusted to maximize their range of applications.

16.5.8 Properties and Flags

In spite of the fact that many facets of the handling of property lists is easily accessible in algebraic mode, it is useful to provide analogous functions genuine to the algebraic mode. The reason is that, altering property lists of objects, may easily destroy the integrity of the system. The functions, which are here described, do ignore the property list and flags already defined by the system itself. They generate and track the addtional properties and flags that the user issues using them. They offer him the possibility to work on property lists so that he can design a programming style of the “conceptual” type.

16.5.9 Control Functions

Here we describe additional functions which improve user control on the environment.

16.5.10 Handling of Polynomials

The module contains some utility functions to handle standard quotients and several new facilities to manipulate polynomials.

16.5.11 Handling of Transcendental Functions

The functions TRIGREDUCE and TRIGEXPAND and the equivalent ones for hyperbolic functions HYPREDUCE and HYPEXPAND make the transformations to multiple arguments and from multiple arguments to elementary arguments. Here is a simple example:

        TRIGEXPAND aa; ==> SIN(X)*COS(Y) + SIN(Y)*COS(X)  
        TRIGREDUCE ws; ==> SIN(Y + X)  

When a trigonometric or hyperbolic expression is symmetric with respect to the interchange of SIN (SINH) and COS (COSH), the application of TRIG(HYP)-REDUCE may often lead to great simplifications. However, if it is highly assymetric, the repeated application of TRIG(HYP)-REDUCE followed by the use of TRIG(HYP)-EXPAND will lead to more complicated but more symmetric expressions:

        TRIGREDUCE aa; ==> 1  

        TRIGREDUCE bb; ==>  
                - SIN(3*X) + 3*SIN(X) + 4  
         TRIGEXPAND ws; ==>  
                3                  2  
          SIN(X)  - 3*SIN(X)*COS(X)  + 3*SIN(X) + 4  

16.5.12 Handling of n–dimensional Vectors

Explicit vectors in EUCLIDEAN space may be represented by list-like or bag-like objects of depth 1. The components may be bags but may not be lists. Functions are provided to do the sum, the difference and the scalar product. When the space-dimension is three there are also functions for the cross and mixed products. SUMVECT, MINVECT, SCALVECT, CROSSVECT have two arguments. MPVECT has three arguments. The following example is sufficient to explain how they work:

       SUMVECT(l,ll); ==> {A + 1,B + 2,C + 3}  
       MINVECT(l,ll); ==> { - A + 1, - B + 2, - C + 3}  
       SCALVECT(l,ll); ==> A + 2*B + 3*C  
       CROSSVECT(l,ll); ==> { - 3*B + 2*C,3*A - C, - 2*A + B}  
       MPVECT(l,ll,l); ==> 0  

16.5.13 Handling of Grassmann Operators

Grassman variables are often used in physics. For them the multiplication operation is associative, distributive but anticommutative. The KERNEL of REDUCE does not provide it. However, implementing it in full generality would almost certainly decrease the overall efficiency of the system. This small module together with the declaration of antisymmetry for operators is enough to deal with most calculations. The reason is, that a product of similar anticommuting kernels can easily be transformed into an antisymmetric operator with as many indices as the number of these kernels. Moreover, one may also issue pattern matching rules to implement the anticommutativity of the product. The functions in this module represent the minimum functionality required to identify them and to handle their specific features.

PUTGRASS is a (nary) command which give identifiers the property of being the names of Grassmann kernels. REMGRASS removes this property.

GRASSP is a boolean function which detects grassmann kernels.

GRASSPARITY takes a monom as argument and gives its parity. If the monom is a simple grassmann kernel it returns 1.

GHOSTFACTOR has two arguments. Each one is a monom. It is equal to

        (-1)**(GRASSPARITY u * GRASSPARITY v)  

Here is an illustration to show how the above functions work:

        PUTGRASS eta; ==> t  
        if GRASSP eta(1) then ~grassmann kernel~; ==>  
                        grassmann kernel  
        aa:=eta(1)*eta(2)-eta(2)*eta(1); ==>  
                AA :=  - ETA(2)*ETA(1) + ETA(1)*ETA(2)  
        GRASSPARITY eta(1); ==> 1  
        GRASSPARITY (eta(1)*eta(2)); ==> 0  
        GHOSTFACTOR(eta(1),eta(2)); ==> -1  
          {eta(~x)*eta(~y) => -eta y * eta x when nordp(x,y),  
          (~x)*(~x) => 0 when grassp x};  
        exp where grasskernel; ==> 0  
        aa where grasskernel; ==>  - 2*ETA(2)*ETA(1)  

16.5.14 Handling of Matrices

This module provides functions for handling matrices more comfortably.