REDUCE

20.2 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.

20.2.1 Introduction

The package ASSIST contains an appreciable number of additional general purpose operators 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 operators 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 operators 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.

20.2.2 Survey of the Available New Facilities

An elementary help facility is available, independent of the help facility of REDUCE itself. It includes two operators:

assist is a operator 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 operators do already exist inside the Core of REDUCE. However, their range of applicability is extended.

In the following all these operators are described.

20.2.3 Control of Switches

The two available operators 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 operators. The chosen switches are

exp, allfac, ezgcd, gcd, mcd, lcm, div, rat,
intstr, rational, precise, reduced, rationalize,
combineexpt, complex, revpri, distribute.

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 operators 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.

20.2.4 Manipulation of the List Structure

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

20.2.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.

Definition:

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:

20.2.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.

20.2.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.

20.2.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.

20.2.9 Control Functions

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

20.2.10 Handling of Polynomials

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

20.2.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:

    aa:=sin(x+y)$

    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 trigreduce (hypreduce) may often lead to great simplifications. However, if it is highly asymmetric, the repeated application of trigreduce (hypreduce) followed by the use of trigexpand (hypexpand) will lead to more complicated but more symmetric expressions:

    aa:=(sin(x)^2+cos(x)^2)^3$

    trigreduce aa; ==> 1

    bb:=1+sin(x)^3$

    trigreduce bb; ==>

            - sin(3*x) + 3*sin(x) + 4
           ---------------------------
                       4

    trigexpand ws; ==>

            3                  2
      sin(x)  - 3*sin(x)*cos(x)  + 3*sin(x) + 4
     -------------------------------------------
                         4

20.2.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, and crossvect have two arguments. mpvect has three arguments. The following example is sufficient to explain how they work:

   l:={1,2,3}$

   ll:=list(a,b,c)$

   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

20.2.13 Handling of Grassmann Operators

Grassman variables are often used in physics. For them the multiplication operation is associative, distributive but anticommutative. The core 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

    grasskernel:=
      {eta(~x)*eta(~y)
           => -eta y * eta x when nordp(x,y),
      (~x)*(~x) => 0 when grassp x};

    exp:=eta(1)^2$

    exp where grasskernel; ==> 0

    aa where grasskernel; ==>  - 2*eta(2)*eta(1)

20.2.14 Handling of Matrices

This module provides functions for handling matrices more comfortably.


Hosted by Download REDUCE Powered by MathJax