Professional Documents
Culture Documents
Thomas Lee
Editor
Maple V:
Mathematics and its Application
Robert J. Lopez
Editor
ISBN 978-0-8176-3791-0
987654321
Contents
Preface vii
Implementation of a Mapping Procedure for the Domain Decomposition for PDEs in Maple
Peiyuan Li and Richard L Peskin 46
II A. Maple in Education . . . 55
The Influence of Maple on a Linear Algebra Course at the Delft University of Technology
Harry A. W:M. Kneppers 57
Can Maple Help in Teaching Calculus with Limited Time and Staff?
Scott R. Fulton 63
II B. Maple in Science 81
Kramers and Wannier V-Matrices for the Partition Functions of the Ising Model
P. Frempong-Mireku and K. J. K. Moriarty 97
III A. Maple in Abstract Algebra 105
FRAC: A Maple Package for Computing in the Rational Function Field K (X)
Cesar Alonso, Jaime Gutierrez, and Tomas Recio . . . . . . . . . . . . 107
Maple V Analytically Calculating Plane Strain FE-Matrices with Rotational Degrees of Freedom
G. Zirwas 141
The Maple Summer Workshop and Symposium, MSWS '94, reflects the growing commu-
nity of Maple users around the world. This volume contains the contributed papers. A
careful inspection of author affiliations will reveal that they come from North America,
Europe, and Australia. In fact, fifteen come from the United States, two from Canada,
one from Australia, and nine come from Europe. Of European papers, two are from Ger-
many, two are from the Netherlands, two are from Spain, and one each is from Switzerland,
Denmark, and the United Kingdom.
More important than the geographical diversity is the intellectual range of the contributions.
We begin to see in this collection of works papers in which Maple is used in an increasingly
flexible way. For example, there is an application in computer science that uses Maple as
a tool to create a new utility. There is an application in abstract algebra where Maple has
been used to create new functionalities for computing in a rational function field. There are
applications to geometrical optics, digital signal processing, and experimental design.
We begin, I believe, to see that Maple is understood as more than just a new tool for
accomplishing specific tasks within a world of traditional practice. There are hints that
users have begun to see Maple as a new working environment wherein whole segments of
professional activity are carried out. The paper by Taylor and Atherley suggests that the
chemical engineering student should be functioning in a Maple envelope, and the paper by
Monagan points to a similar direction in mathematics.
The philosopher and theologian Thomas of Aquinas points out that all things are known
according to the mode of the knower. It is entirely possible that as Editor, I am simply finding
evidence of my own perspective on Maple. That is why forums like the Maple Summer
Workshop and Symposium are so essential to the development of change in teaching,
learning, and practice. It is by the sharing and exchanges which characterize a conference
that insights will be appraised, and their implications nurtured. The final judgments are up
to the conference participants, the readers of this volume, and history.
The organization of this volume is programmatic. The sections in the text correspond to
the sessions scheduled on the program. This layout was adopted for the convenience of the
conference attendees. We apologize to readers who would have preferred a stricter thematic
organization.
Finally, we have included brief abstracts of the talks by the invited speakers. For readers
who were not able to attend MSWS '94 these abstracts might help delineate the experience
of those who did attend. And for those who did attend, they might serve as a reminder of
all the good ideas the conference generated.
The only fitting conclusion to this preface is an acknowledgment of the efforts of all those
who helped make the MSWS '94, and this volume, a success. Lest I omit anyone's name, I
will issue a blanket sigh of gratitude for the help from the folks at Waterloo Maple Software,
and at Birkhauser, the publishers, and from the referees whom I cajoled into reviewing the
contributed papers. Finally, I thank the authors themselves for their efforts at writing and
formatting these papers, and for their promptness and patience in meeting all the deadlines.
Robert 1. Lopez
Rose-Hulman Institute of Technology
Terre Haute, Indiana
viii
Abstracts of Invited Presentations
Jonathan Borwein
Shrum Professor of Science
Centre for Experimental and Constructive Mathematics
Simon Fraser University
The use of sophisticated symbolic, graphic and other packages allows mathematicians (applied or
pure) to do mathematics from an experimental perspective until recently far from the experience of
most of us. I will present case studies (from linear algebra, analysis and combinatorics) that attempt
to illuminate the enormous possibilities and the potential pitfalls of doing empirical mathematics.
I will also discuss some of the related projects being undertaken at the Simon Fraser Centre for
Experimental and Constructive Mathematics.
Goddard Space Flight Center has been pursuing robotics to help the next service flight for the Hubble
Space Telescope. To do this requires dexterity of the robot, kinematically and dynamically. A seven
degree of freedom RRC arm provides a model of kinematic dexterity, and the new GSFC-invented
capaciflector sensor provides control systems with the data to gain dynamic dexterity. The talk
will cover the computer architecture at the Intelligent Robotics Laboratory used to support robotics,
some kinematics, and control problems involving use of the capaciflector: virtual force, imaging,
and 6-DOF pre-contact alignment.
Theorist in the Classroom
James V. Herod
School of Mathematics
Georgia Institute of Technology
Atlanta, GA 30332-0160
Mathematical biology, resource modeling, and population dynamics are rich sources of problems
in mathematics. Undergraduates in biology often finish their studies with only limited exposure to
the richness of these three areas. This happens in part because of a lack of training that biology
students have in mathematics. Their introduction to a tool such as Maple allows them to understand
more deeply some of the issues in these research areas and to examine current work, even with a
limited mathematical background. On the other hand, mathematically sophisticated students may
find a fascination in their introduction to the problems of biology. Mathematical biology may use
mathematics that the students already know, but in ways that they had not imagined. We present
some mathematical models that are accessible to undergraduate biology students.
x
Advanced Control and Engineering Computations Using Maple V
In recent years, considerable interest has been generated in the areas of symbolic computation for
advanced control and engineering computations. The driving force for this interest is the poten-
tial for solving complex problems which were hitherto impossible or difficult to undertake. The
analysis and design of control systems for multivariable processes described by polynomial ma-
trices were practically non-existent before the advent of symbolic computation. Manipulation of
polynomial matrices by hand-calculations is very complex and not amenable to computer imple-
mentation. Consequently, the numerical methods developed to perform the necessary manipulations
are computationally intensive and often suffer from numerical instability. The numerical solution
of differential equations modeling physical phenomena such as diffusion, reaction, heat transfer and
fluid flow processes are of paramount importance. One of the established methodologies for this
class of problems involves the use of polynomial approximations using orthogonal collocation, finite
elements, etc. In this talk, we describe the use of Maple V for solving the above mentioned prob-
lems. The advantages of error-free symbolic manipulations and numerically stable results, obtained
quickly and efficiently, with a tremendous gain in time and minimal effort, are demonstrated.
Computer algebra software represents a mature technology that has already made significant con-
tributions to physics research. It is only just beginning to impact physics education. And we have
a long way to go before that impact will be significant. I will discuss some of the problems we face
in incorporating this software into the curriculum and suggest some of the solutions.
xi
I A. MAPLE IN COMPUTER SCIENCE
"TURTLE GRAPHICS" IN MAPLE V.2
We think the "Turtle Geometry" [1J is a Below there is a list of procedures and accessi-
useful and convenient way of doing graph- ble variables (global variables). We shall classify
ics programming. Recently, we have devel- the procedures according to their purpose.
oped brand new implementations of the ''Tur-
tle Geometry" in Turbo Pascal [12J and in Primitives that change the position of the turtle:
Maple V [14]. Our implementations include the
usual primitives with Turbo-Pascal-like syntax: Forwd(n:algebraic): Moves the turtle forward
Forwd(dist), TurnLeft(ang) , SetPenColor( color), the number of steps given.
SetPosition(xl,x2), etc. We shall begin with a Back(n:algebraic): Moves the turtle forward
brief resume of the implementation developed in (-1)·n.
Maple V. SetPosition(xl :algebraic,x2:algebraic):
Takes the turtle to the specified position.
Further on we shall show how using an imple- SetX(xl:algebraic): As SetPosition, but only
mentation that is based upon floating point arith- changing the x coordinate.
metic , can be unsuitable even for dealing with SetY(x2:algebraic): As SetPosition, but only
problems in elementary Geometry. Details con- changing the y coordinate.
cerning how exact arithmetic is treated in our HomeO: We implement it as a SetHeading(O)
implementation are given. Clarifying examples followed by a SetPosition(O,O).
are also included. ClearScreenO: As Home, plus clearing the pre-
vious drawings.
Other primitives:
3
· PenDownO: Upon command, the turtle leaves >RIGHT 135
a trail behind. >FORWD 100*SQRT 2
SetPenColor(color): Lets the user choose the >RIGHT 135
pen color. The usual Maple inputs COLOUR- >END
(HUE(a» and COLOUR(RGB,a,b,c) are admit-
ted. The turtle should have returned to the center of
the screen. But, surprisingly, if we ask for the
Dot(x1:algebraic, x2:algebraic): The com-
puter draws the given point. position now, it is not (0,0)
FullScreenO: Changes to the Graphics Screen. ?PRINT POS
The computer makes a "PLOT" of the 0.002 0.002
"CURVES" stored in the list "dib".
Global variables:
Observation.- In this section the examples are ?IF AND XCOR = 0 AND YCOR = 0
implemented in IBM LOGO, because of the sim- [PR "YES][PR "NO]
ilarity of syntax. Nevertheless, the kind of prob- NO
lems that we present have nothing to do with The answer would have been completely wrong,
the kind of language or the version. They are a not "approximately" right.
consequence of the assumptions made when rep-
resenting numbers in floating point arithmetic.
4
>RIGHT 90 >MAKE "AI HEADING
>REPEAT 5 [FORWARD 80 LEFT >SETH TOWARDS SE :Ql :Q2
72] >MAKE " A2 HEADING
>LEFT 36 >MAKE "A COMPL(ABS(:Al-:A2»
>REPEAT 5 [FORWARD 80* >PRINT :A
(1+2*SIN 18) LEFT 144] >END
>PR POS
>END ?TO ABS :AN
>IF :AN > 0 [OP :AN] [OP -:AN]
draws a regular pentagon with sides 80 steps long >END
and its diagonals. So we could expect that the
same error as in 2.1 would take place. Surpris-
?TO COMPL :AN
ingly, in this case, the turtle returns safely to >IF :AN > 180 [OP 360 - :AN]
point (0,0). As all depends on the "luck" of the [OP :AN]
roundings, the behaviour of the floating point >END
arithmetic is unpredictable. ABS calculates the absolute value and COMPL
calculates, if necessary, (360 - angle).
= =
If the points are P (0,10), Q (10 * y'3, 10)
and R = (0,0), the angle obtained is 60.001 0 . It
is a close approximation.
5
2.5 Small numbers and periodic (old.xCor, old_YCor)(new.xCor, new_YCor)
numbers
is also added to the list "dib".
If the turtle moves 1~ of a step forwards 30 times
(in floating point arithmetic) it is not the same For instance, if a Forwd(distance) is typed, the
as moving forward 100 steps. new XCor is the previous one plus the distance
we want the turtle to move multiplied by the co-
?REPEAT 30 [FORWARD (10/3)] sine of the angle (gOO-Heading). The new YCor
?PRINT POS is calculated similarly.
099.999
In this case it is clear that the reason of the in- All the procedures involving changes of the tur-
accuracy is the truncation of 3.3333. tle's position are implemented in a similar way.
Those which involve changes of the turtle's orien-
Very small numbers are not handled correctly tation produce only changes in the value stored
either. in the variable Heading. We have tried to avoid
similar code been written in different places. The
?FORWARD 0.0001 whole file occupies about 5k in its readable form.
?PRINT POS
00
The reason in this case is that very close numbers
4 The arithmetic in our im-
are represented the same way. This also occurs, plementation
for instance, if we type
In the first version "dib" was a list of numbers
?PRINT 30000000001 - 30000000000 in exact arithmetic. The disadvantage is that,
o in exact arithmetic, the length of the expressions
Both numbers have been represented as 3 x 10 10 . grows very quickly (the length of the represen-
And to increase the number of significant digits is tations of the numbers is not fixed and not even
not the right solution. It is clear how, given any related to the size of the numbers). The reason
number of significant digits, a similar example for this growth is that turns generally involv~ir
can be found such that the result is not correct. rational numbers. Compare, for instance
6
• The speed of the plotting is increased. >XCor;
100 2 1 / 2
>XCor;
4.1 The Pythagorean theorem (in 100 2 1/ 2
Maple) Numbers in floating point arithmetic usually
include a decimal point. Those in exact arith-
We shall represent by">" the Maple prompt. metic never do. It is clear how 100 x 2 1 / 2 has
Let's consider again the example of the right an- been approximated by 141.4213562.
gled isosceles triangle of section 2.1. In Maple we
could type
7
See [9] for a clear and sensible introduction to
the importance of exact arithmetic.
- The sides of the first one are 1 steps long - Draw an interpolation of a spiral. The first
side is 1 steps long, the ratio of one side to the
- The vertices of 8 n are the midpoints of the next one is inc and the number of sides is numl.
sides of 8n - l We have chosen to turn an angle of 20 degrees
from one side to the next one. Sides 1 to 18 be-
long to the border of the embryonic chamber.
>polycuad:=proc(l:algebraic,niv:integer)j
> PenUpOj - From vertex 18 onwards we draw the segment
that connects the nth vertex to the (n - 18)th.
> Forwd(I/2)j
> TurnRight (90)j
> Forwd(I/2)j To draw a new chamber, all we have to do is
> PenDownOj draw another side of the spiral and the segment
> for i to 4 do whose endpoints are the (n + 1)th vertex and the
> TurnRight(90)j (n + 1 - 18)th vertex.
> Forwd(l)j
> odj >nautiloid:=proc(l:algebraic,
> PenUpOj inc:algebraic,numl:integer)
> TurnRight(IS0)j
> Back(I/2)j
> TurnLeft(90)j > Ipun:=[[evalf(XCor),evalf(YCor)]]j
> nautiloid...recurs(l,inc,numl)j
> Back(I/2)j
> TurnRight (45)j > endj #nautiloid
> PenDownOj
>nautiloid...recurs:=proc(l:algebraic,
> if niv > 1 then
inc:algebraic,numl:integer)
> polycuad(l/sqrt(2),niv-l)j
> local x,yj
> fl.j
> Forwd(l)j
> endj #polycuad
> TurnRight (20) j
A nice example can be obtained, for instance, > Ipun:=[[evalf(XCor),evalf(YCor»),
typing op(lpun»);
> x:=XCorj
>ClearScreenOj > y:=YCorj
>polycuad(300,15 )j > if nops(lpun) > 17 then
>FullScreenOj > SetPosition(op(l,op(IS,lpun»,
8
Example 2: Longitudinal section of a nautiloid
9
o 0 0 0 0 0 000 0 0 0 0 0 0 0 0 0 0 0 000 0 0 0 0
00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0
o 0 0 0 0 0 000 0 0 0 0 0 0 0 0 0 0 0 000 0 000
0 0
00 0 00 00 0 0 00
00 0 0 00 0
o 0 00 0 0 0 0 00 0 0 000 0 0
0 0
10
op(2,op(18,Ipun)) ); [4] A. Heck: Introduction to Maple. Springer-
> PenUpO; Verlag, 1993.
> SetPosition(x,y)
> PenDownO; [5] B.W. Char, K.O. Geddes, G.H. Gonnet,
> fl·, B.L. Leong, M.B. Monagan, S.M. Watt:
> if numi > 0 then Maple V Language Reference Manual. Springer-
> nautiloid-recurs(I*inc,inc,numI-1) ; Verlag, 1991.
> fl·,
> end; #nautiloid-recurs [6] B.W. Char, K.O. Geddes, G.H. Gonnet,
B.L. Leong, M.B. Monagan, S.M. Watt:
An example of a realistic nautiloid can be ob- Maple V Library Reference Manual. Springer-
= =
tained for I 1 and ratio inc ~~~. Verlag, 1991.
>CIearScreenO;
>nautiIoid(1,108/100,55 ); [7] B.W. Char, K.O. Geddes, G.H. Gonnet,
>FullScreenO; B.L. Leong, M.B. Monagan, S.M. Watt:
First Leaves: A Tutorial Introduction to Maple.
3) Another typical example of recursion are Springer-Verlag, 1991.
sponges. In this case the program is not as short
as the previous ones, so we shall not include the [8] A. Montes, M. Noguera, A. Grau:
code. The plotting of the third step in the con- Apuntes de Maple V. Universitat Politecnica de
struction of a 2-D Sierpinski sponge is included Catalunya, 1994.
above (side = 300).
[9] R. Pavelle, M. Rothstein, J. Fitch: Alge-
bra por ordenador. Investigaci6n y Ciencia, Feb.
6 Conclusions 1982 (spanish version of the article in Scientific
American num. 245, Die. 1981).
Firstly, our implementation allows us to plot tur-
tle drawings in Maple. Additionally, it permits
[10] E. Roanes Lozano: Automatizacion e im-
us to do the plottings in exact arithmetic, which
plementacion de algunos problemas algebraicos y
can be extremely important when dealing with
geometricos. (Ph.D. Thesis). Univ. Politecnica
many problems.
de Madrid, 1993.
[3] C.B. Boyer: A History of Mathematics. [15] -: LOGO Reference Manual. IBM/LCSI,
John Wiley, 1968. 1984.
11
[16] -; Manual de Referencia y del Usuario Eugenio Roanes Lozano (eroanes@fi.upm.es)
ACTI-LOGO. Idealogic, 1984. studied Mathematics at the Universidad Com-
plutense de Madrid (UCM), received his Ph.D.
[17] -: Guia de Referencia y Manual del usuario in Mathematics from the Universidad de Sevilla
WIN-LOGO. Idea, Investigaci6n y Desarrollo in 1991 and received a second Ph.D. (in Com-
S.A., 1991. puter Science) from the Universidad Politecnica
de Madrid in 1993. His research interests in-
[18] -; Turbo Pascal v.6.0 User's Guide, Pro- clude Computer Algebra, Computational Geom-
grammer's Guide £3 Library Reference. Borland etry and Algebraic aspects of A.I. He is presently
International, 1990. a Lecturer at the Faculty of Education (Sec. Dep.
Algebra) of the UCM.
[19] -: Turbo Pascal v.3.0 Reference Manual
(Cap. 19 PC-Goodies). Borland International. Eugenio Roanes Macias (roanes@mat.ucm.es),
father of the former author, received his Ph.D.
in Mathematics from the UCM in 1973. His
research interests include Algebraic Geometry,
Computer Algebra and Computation in Math-
ematics Teaching. He is presently a Professor at
the Faculty of Education (Sec. Dep. Algebra) of
the UCM.
12
A DISTRIBUTED APPROACH TO
PROBLEM SOLVING IN MAPLE
13
puter on the network. CPU and memory usage tries are computed faster by distribution. We note
of participating compute nodes is estimated by that all of the needed computer algebra technol-
having a resident daemon process probe them ogy, such as finding prime numbers, computing
in 10 minute intervals and communicate the matrix determinants modulo prime numbers, and
CPU and memory load to the DSC server dae- the Chinese remainder algorithm, is provided by
mons. If no computer meets certain threshold Maple. There are more sophisticated coarse grain
requirements, the parallel subtask gets queued parallel algorithms, such as root finding or sparse
for later distribution under presumably better interpolation (Char 1990), which would require
load conditions on the network. The scheduler more custom-made Maple programming. In our
makes DSC a truly heterogeneous parallel sys- opinion, an important application of the DSC in-
tem. terface is the parallelization of our Maple code for
- The progress of a distributed computation can the solution of sparse linear systems. This code
be monitored by an independently run con- was developed as a prototype for our superfast
troller program. This controller also initializes C++ implementation (Kaltofen and Lobo 1994).
the DSC environment by establishing server Nonetheless, the distributed version of our proto-
daemons on the participating computers. type code would make parallel sparse linear system
solving available to the entire Maple world.
- It is possible to run several distributing Maple
We hope to add several new features to DSC
programs simultaneously by specifying distinct
and the Maple interface in the future. First, we are
UDP port numbers on start-up. DSC and the
planning to build a graphical user interface to the
Maple interface do not require any changes
control program which monitors all DSC processes
to existing Unix or Maple setups. Security
and computers. Second, we are planning to imple-
is guaranteed because DSC tags the messages
ment some form of process migration. Although
which it sends through unprotected ports with
our scheduler attempts to find the best compute
a secret key.
node for a given parallel subtask, often the choice
Note that the design of the features discussed is not optimal because unexpected load levels ap-
above has been extensively tested in our sym- pear later at the selected computer. In that case, it
bolic applications, which are: the parallel Can- would be very helpful if a partially completed task
torjZassenhaus polynomial factorization algorithm could be moved to another node. And finally, the
(Diaz et al. 1991), the Goldwasser-KilianjAtkin Maple interface could be enhanced by high level
primality prover for titanic primes, i.e., prime data types that hide the actual explicit DSC calls,
numbers with more than 1000 decimal digits (Va- such as the "bags of incomplete futures" that we
lente 1992), and the block Wiedemann algorithm have implemented in our Lisp interface (Diaz et
for the solution of sparse linear systems over finite al. 1991).
fields (Diaz et al. 1993).
The main design goal for the DSCjMapie in- 2. System Layers
terface was that it had to be completely portable. In Diaz et al. 1991 we described how concep-
Therefore, we chose a mechanism by which the tually the DSC system itself is organized in a
DSC library functions are called through a system multi-layered fashion, each layer drawing from
call. That call executes an interface program that its predecessor. Referring to Figure 1, the bot-
sends a signal to a concurrent daemon process. It tom layer consists of the interprocess communi-
is that single daemon process which calls the C cation using DARPA Internet standard protocols
language DSC user library function which in turn IPJTCP jUDP. Built on this layer lies the first
communicates with the server process via a user DSC level which includes the internal DSC rou-
datagram. Thus we avoid any dependence on calls tines, the daemons, and the C library functions.
to functions written in C from within Maple, a fea- The second layer consists of the LispjC interface,
ture that is lacking in older Maple installations. the controller program, the new MaplejC inter-
We demonstrate the usage of our interface by face and C user programs that use only the seven
a standard example, namely the computation of basic C library functions. The third layer draws
the determinant of an integer matrix by homo- on the LispjC interface and the MaplejC inter-
morphic imaging and Chinese remaindering (Mc- face. This layer contains the Lisp library, basic
Clellan 1973). We can report that determinants Lisp functions and basic Maple functions. At the
of 100 x 100 integer matrices with single digit en- topmost layer lies the implementation of high level
14
4
High level
L1spuserpgm
3
Basic Maple User pgm Basic Lisp User pgm Lisp library
2
ControllerlSetup
Basic C usr pgm MlplelC library LlspiC library
Utilities
Lisp functions which utilize the support routines and DSC server daemons have to be started. The
contained in the Lisp library. Such a Library is DSC Controller program supports the user in con-
being developed for Maple. figuring the network and in the monitoring of com-
putational tasks (Diaz et al. 1991).
3. Maple Interface
Figure 2 portrays the Scenario of a distributed
The Maple User Interface Library contains ten Maple determinant computation. After starting
functions that can be invoked from a user's Maple the controller program on compute node 1, and
program or session. The standard example of com- DSC servers on compute nodes 1, 2, and 3, the
puting the determinant of an integer matrix in main Maple task distdet. mpl is initiated. It
parallel (by homomorphic imaging and Chinese first reads in an integer matrix from distdet. i
remaindering) illustrates the interaction between and selects appropriate moduli. For each modu-
DSC and Maple. lar image, distdet .mpl calls the DSC Maple li-
brary function dscpr _sub, passing Maple code in
a file det 1. mpl and the residue matrix in det 1. i
to DSC for distribution. The function dscpr _sub
communicates the distribution request to the lo-
cal server running on compute node 1. The lo-
diatdet . mpl
cal server locates a suitable processor, in this case
diatdet.i compute node 3, and sends both files to the cor-
responding remote server. The server on com-
pute node 3 starts a Maple session for det 1 . mpl.
That program then reads its data from the remote
copy of det 1. i and writes its output to the re-
mote file det 1. d. When the parallel subtask com-
pletes the file, det 1. d is copied back to compute
node 1. In the meantime, the application pro-
gram has initiated distribution of another parallel
subtask, det2, for which the local server selected
compute node 2. A call to the DSC Maple library
detl.mpl
det1.i---
function dscpr_wait or dscpr_next can be used
detl.d--- to block the main task distdet .mpl on the com-
Figure 2: Simple Distribution Scenario pletion of its children.
Before a Maple application can distribute par- The source code of distdet . mpl found in Fig-
allel subtasks over the network, the database of ures 3 through 9 illustrates the usage of the DSC
available compute nodes needs to be initialized Maple library functions.
15
with(linalg) ;
#################################################
## distdet(subprobsf,solfile,A,iprod)
## input -
## subprobsf - source file (without path information)
## of the subproblems
## solfile - the file name that will contain the determinant
## of the matrix A
## A - square matrix
## iprob - starting point for prime moduli
## description -
## compute the determinant of the integer matrix A by
## homomorphic imaging and Chinese remaindering
distdet := proc(subprobsf,solfile,A,iprod)
local LOW_CPU, MEM, PWD, SOURCE_FILE,INDEX,fid,build,exec,y,
NUMPROBS ,moduli ,residue ,tmod,ubound,prod,inc,u;
## LOW_CPU - estimated CPU usage
## MEM - estimated memory usage in megabytes
## PWD - real path
## SOURCE_FILE - source file with real path information
## INDEX - subproblem index file
## NUMPROBS - the number of primes needed given the initial value
## fid - temporary file id
## build - Maple build command
## exec - Maple execute command
## y - loop counter
## moduli - the array of moduli
## residue - the array of determinant residues
## tmod - moduli for each subroblem (save can only save names)
## ubound - the upper bound for the product of the moduli
## prod - the product of the moduli
## inc - the next starting point for the moduli search
## u - determinant
# Read in DSC Maple User Functions
read('dsc_maple.mpl');
# Set problem parameters
sUbprobsf:= subprobsf;
LOW_CPU:= 240;
MEM:= 5;
# Start dsc_maple daemon
system('dsc_maple commandfile messagepid dscmaplepid t');
# Wait a while for startup
system('sleep 2');
# Get real path information
PWD := dscpr_pwd('commandfile','messagepid','dscmaplepid','answerfile');
SOURCE_FILE:= cat(PWD,'/' ,subprobsf);
# Log problem in local server problem database
INDEX := dscdbg_start('commandfile' ,'messagepid','dscmaplepid',PWD,
, answerf ile' ) ;
Figure 3: Interface Start-Up
Figure 3 displays the initialization steps that the dsc_maple .mpl interface library has been load-
are needed when distributing Maple code. Once ed, a dsc_maple daemon can be started via a
16
system call to the host operating system from # Prepare corresponding input files
the Maple environment. After startup of the for y from 1 to NUMPROBS do
dscmaple daemon, calls to the functions in the fid:=cat(SOURCE_FILE,y,'. ',lie);
Maple User Interface Library can be made. In or- tmod := moduli[y];
der to assure distinct file names when running mul- save A , tmod, fid;
tiple distributed Maple applications, the dsc_maple od;
daemon program must receive three command line
arguments, which are file names representing a # Make copies of the subproblem
dsc_maple command file, a dscmaple_message copyfiles(NUMPROBS,SOURCE_FILE,'mpl');
temporary daemon process id file, and a dsc_maple
Figure 5: Prepare Parallel Subtasks
daemon process id file. These files, along with a
fourth string denoting the dsc_maple_message an- After the moduli have been computed, the par-
swer file, are passed as parameters to all ofthe sub- allel subtasks can be prepared for distribution.
sequent Maple User Interface Library functions. Figure 5 details how the parallel subtask input
These four files are only used by the different lay- files and copies of the parallel subtasks are created.
ers of the Maple Interface and are never accessed The copyfiles function is provided in the Maple
directly from the user's Maple application. The User Functions Library. Eventually, we hope to
function dscpr_pwd is used to determine the cur- provide additional high level library functions.
rent path of the local Maple session. This informa- Figure 6 demonstrates the use of the function
tion is used later as a parameter to all remaining dscpr_sub to start a parallel subtask within the
Maple User Interface Library functions. The func- DSC environment. Additional arguments to this
tion dscdbg_start in Figure 3 is the first maple function are four strings denoting, respectively,
interface call that communicates a request to the the path to the local files, the types of the local
local DSC server. This function can be used to files to be sent, the build (compile, for instance)
track a problem and is useful when one wishes to command, and the exec (load and run) command
debug distributed tasks using Maple interactively. required for the parallel subtasks; two additional
Arguments to this function include the four inter- integer arguments represent the CPU and memory
face specific file names and the current path of the requirements of the parallel subtasks. It is possible
local Maple session. to use default build/exec commands by supplying
ubound := evalf(2*hadamard(A»j null strings for the corresponding arguments. It is
also possible to bypass C and L.isp compilation by
# Compute the Moduli supplying dsc_c. build or dsc_lisp. build as the
print('Compute_the_Moduli')j build command. The shell script dsc_maple. int
prod := 1j NUMPROBS:= 0; applies the source and input files to a Maple ses-
inc :=iprod; SIon.
After the determinant parallel subtasks have
while prod < ubound do been spawned Figure 7, shows the Maple code
NUMPROBS := NUMPROBS+1; necessary for blocking the execution of the main
moduli[NUMPROBS] := nextprime(inc); task and after synchonization the code required for
inc := moduli[NUMPROBS]+1j performing the shutdown of the DSC Maple inter-
prod := prod * moduli[NUMPROBS]j face. The functions dscpr_wait and dscpr_kill
odj are used, respectively, to wait on and to kill spe-
cific subtasks. In both cases, the additional ar-
Figure 4: Compute Necessary Moduli gument is the index of the subtask in question.
One way of computing the determinant of a The dscpr_wait function is also used to wait on
matrix in a distributed fashion is to first com- the completion of all outstanding subtasks when a
pute the determinant of the input matrix modulo value of -1 is supplied for the index. The function
n relatively prime numbers in parallel and then to dscpr_next is used to wait for the completion of
construct the corresponding true integer value by the next parallel subtask. Its additional argument
Chinese remaindering. Figure 4 shows the com- is filled with the name of the solution file corre-
putation of the moduli by using the Hadamard sponding to the completed subtask. The function
inequality to get an upper bound for the determi- dscpr_maple_kill, will terminate the dsc_maple
nant. daemon in an orderly fashion.
17
for y from 1 to NUMPROBS do
# Prepare arguments
fid:= cat(SOURCE_FILE,y);
build:= cat('dsc_maple.build');
exec:= cat('dsc_maple.int ',subprobsf,y,'.mpl ',subprobsf,y,'.d',
, ',subprobsf,y,'.i');
print('one_Ievel_driver: fid = '.fid);
print('one_Ievel_driver: build = '.build);
print('one_Ievel_driver: exec = '.exec);
print('one_Ievel_driver: cpu requirement = '.LOW_CPU);
print('one_Ievel_driver: mem requirement = '.MEM);
# Spawn subproblems
rval:= dscpr_sub('commandfile' ,'messagepid','dscmaplepid',
PWD,fid,'pi' ,build,exec,LOW_CPU,MEM,
'answerfile');
od;
Figure 6: Distribute Parallel Subtasks
# Wait on all subproblems
rval := dscpr_wait('commandfile' ,'messagepid','dscmaplepid',
PWD,-l,'answerfile');
dscpr_maple_kill('commandfile' ,'messagepid','dscmaplepid' ,PWD);
Figure 7: Wait On All Parallel Subtasks
18
with(linalg) ;
#################################################
## ddet(one_input,one_output)
## input -
## one_input - input file for subproblem
## one_output - output file for subproblem
ddet .- proc(one_input,one_output)
local commandfile,messagepid,dscmaplepid,answerfile,msgstr,PWD;
## commandfile _ dsc_maple DSC command file
## messagepid - dsc_maple_message process id file
## dscmaplepid - dsc_maple process id file
## answerfile - subtask solution file
## msgstr - temporary string
## PWD - real path
# Read in DSC Maple User Functions
read('dsc_maple.mpl');
# Start dsc_maple daemon
commandfile cat (one_input , '.cmd');
messagepid .- cat (one_input , '.mpid');
dscmaplepid cat(one_input,'.ppid');
answerfile .- cat (one_input , '.ans');
msgstr := cat('dsc_maple ',commandfile,' ',messagepid,' ',dscmaplepid,' &');
print(msgstr);
system(msgstr) ;
# Wait a while for startup
system('sleep 2');
# Get real path information
PWD := dscpr_pwd(commandfile,messagepid,dscmaplepid,answerfile);
# Kill dsc_maple_daemon
dscpr_maple_kill(commandfile,messagepid,dscmaplepid,PWD);
# Wait a while for shut down
system('sleep 2');
# Remove files
msgstr 'rm -f '; msgstr .- cat(msgstr,commandfile); system(msgstr);
msgstr .- 'rm -f '; msgstr .- cat(msgstr,messagepid); system(msgstr);
msgstr 'rm -f '; msgstr .- cat(msgstr,dscmaplepid); system(msgstr);
msgstr .- 'rm -f '; msgstr cat(msgstr,answerfile); system(msgstr);
# Read in matrix and modulo
msgstr PWD;
msgstr .- cat(msgstr,'I' ,one_input);
read(msgstr);
# compute the determinant of A modulo tmod
ddet := Det(A) mod tmod;
save ddet , one_output;
end;
ddet(DSC_IFILE,DSC_OFILE);
quit;
Figure 10: Parallel Subtask
significant with larger problems. must be called at the beginning of any parallel
The Maple interface library also allows the user subtask that is to be treated as a co-routine. Its
to implement co-routines. To distribute Maple co- only arguments are the four interface specific file
routine applications, the function dscpr_cosetup names and the current path of the local Maple ses-
19
PRO B L E M D A TAB A S E
sion. When the Maple parallel subtask calls the turned from the spawning call to dscpr_sub) and
dscpr30wait function with an additional integer a string identifying which input file, if any, should
argument, it enters a sleep state and optionally be sent to the co-routine before the parallel sub-
transmits a data file back to its parent. A parent task is to be resumed.
task can send a wake up call to a sleeping parallel
subtask via the dscpr_coresume function. Addi- This material is based on work supported in
tional arguments to this function are an integer part by the National Science Foundation under
which uniquely identifies a parallel subtask (re- Grant No. CCR-90-06077 and Grant No. CCR-93-
20
19776, Research Experiences for an Undergradu- King Choi Chan currently is an undergradu-
ate supplement (first author), and by GTE under ate student in Computer Systems Engineering at
a Graduate Computer Science Fellowship (second Rensselaer Polytechnic Institute.
author).
The software described in this paper is freely Angel Diaz received both his B.S. degree in
available by anonymous ftp from ftp.cs.rpi.edu in Computer in 1991 and his M.S. degree in Com-
directory dsc. puter Science in 1993 from Rensselaer Polytechnic
Institute. He is currently pursuing the Ph.D. de-
Literature Cited gree at Rensselaer under the direction of Professor
Erich Kaltofen. His special fields of interest in-
Char, B. W., "Progress report on a system for general- clude parallel methods in symbolic computation.
purpose parallel symbolic algebraic computation," He was a Rensselaer Polytechnic Institute Gradu-
in PlOC. 1990 Internat. Symp. Symbolic Algebraic ate Fellow from 1991-1992, received support from
Comput., edited by S. Watanabe and M. Nagata; the National Science Foundation Fellowship Pro-
ACM Press, pp. 96-103, 1990. gram in 1992, and is currently the recipient of the
Diaz, A., "DSC Users Manual (2nd ed.)," Tech. Rep. GTE Fellowship Program. He is also a member
93-11, Dept. Comput. Sci., Rensselaer Polytech. of Upsilon Pi Epsilon national computer science
Inst., Troy, New York, May 1993. 197 pp. honor society.
Diaz, A., Hitz, M., Kaltofen, E., Lobo, A., and Va-
lente, T., "Process scheduling in DSC and the Erich Kaltofen received both his M.S. degree
large sparse linear systems challenge," in Proc.
in Computer Science in 1979 and his Ph.D. de-
DISCO '93, Springer Lect. Notes Comput. Sci.
gree in Computer Science in 1982 from Rensse-
722, edited by A. Miola; pp. 66-80, 1993. Avail-
able from anonymousGftp. cs. rpi. edu in directory
laer Polytechnic Institute. He was an Assistant
kaltofen. Professor of Computer Science at the University
of Toronto and an Assistant and Associate Pro-
Diaz, A., Kaltofen, E., Schmitz, K., and Valente, T.,
"DSC A System for Distributed Symbolic Compu- fessor at Rensselaer Polytechnic Institute, where
tation," in PlOC. 1991 Internat. Symp. Symbolic he is now a Professor. His current interests are
Algebraic Comput., edited by S. M. Watt; ACM in computational algebra and number theory, de-
Press, pp. 323-332, 1991. Available from anony- sign and analysis of sequential and parallel algo-
mousGftp.cs.rpLedu in directory kaltofen. rithms, and symbolic manipulation systems and
Kaltofen, E. and Lobo, A., "Factoring high-degree languages. Professor Kaltofen currently is the
polynomials by the black box Berlekamp algo- Chair of ACM's Special Interest Group on Sym-
rithm," Manuscript, January 1994. Available from bolic & Algebraic Manipulation and serves as as-
anonymousGftp. cs. rpi. edu in directory kaltof- sociate editor on several journals on symbolic com-
en. putation. From 1985-87 he held an IBM Faculty
McClellan, M. T., "The exact solution of systems of Development Award. From 1990-91 he was an
linear equations with polynomial coefficients," J. ACM National Lecturer.
ACM 20, pp. 563-588 (1973).
Valente, T., "A distributed approach to proving large Department of Computer Science
numbers prime," Ph.D. Thesis, Dept. Comput. Rensselaer Polytechnic Institute
Sci., Rensselaer Polytech. Instit., Troy, New York, Troy, New York 12180-3590
December 1992. Available from anonymousGftp.
cs. rpL edu in directory valente. Internet: {diaza,kaltofen }lllcs. rpi. edu
21
DENOTATIONAL SEMANTICS APPLIED TO THE
TYPESETTING OF MAPLE EXPRESSIONS
Reid M. Pinchback
Academic Computing Services, MIT, Cambridge, MA
1. Specify an abstract syntax capable of representing where A, B, and C are semantic functions defined over
a useful subset of Maple expressions. the appropriate syntactic constructs.
2. Specify the meaning of each grammatical produc- While generally denotations are specified in terms
tion in terms of Maple-coded 'denotations'. of a lambda calculus, such is by no means a require-
ment of the method. We will specify our denotations
3. Use the grammatical and denotational design in terms of Maple constructs.
information to implement a meta-evaluator in
Maple. The resulting program will behave as a
Abstract versus Concrete Syntax
transducer for converting Maple expressions into a
MIF document. Since likely more people are familiar with gram-
mars for concrete syntax than ones for abstract syntax,
Denotational Semantics and since at a glance they are similar in appearance, to
avoid later confusion we will briefly contrast the two
This is a method useful for specifying the meaning kinds[2]:
of formal languages in an abstract way, using mathe-
matical constructs called 'denotations'. The theoreti- 1. Concrete syntaxes are those typically encountered
cal underpinnings of the method are in domain theory, in introductory compiler courses. Their grammars
which we will not need to explore here. This is in part contain many productions useful for resolving pre-
because of relative simplicity of our application, and in cedence relationships and for specifying important
part because we are not attempting to create a fully syntactic keywords like 'if and 'then'. All of this is
abstract implementation-independent specification of necessary for parsing languages with sentences
that are written as character strings.
2. Abstract syntaxes have grammars that are compact
and represent the inherent structure of sentences in
the language, as represented by tree structures
(such as parse trees) instead of character strings.
With neither the need to resolve precedence nor to
22
indicate the syntactic keywords that parsers use for operands, which are themselves Maple expressions. In
pattern recognition in matching productions, the final implementation we will be using the Maple
abstract syntax grammars have much simpler and commands 'whattype' and 'op' to parse expressions,
many fewer productions than is the case for con- instead of using something like the 'hackware' pack-
crete syntax grammars. age. This relatively indirect access to the structure of
Maple expressions will make the implementation
A particularly useful property of abstract syntax 1 is
more readable at the cost of having to deal with some
that it allows us to collapse operator productions. For
special-case situations where 'op' and 'whattype' don't
example, contrast the following concrete and abstract
provide us exactly the information we need.
syntaxes for specifying simple arithmetic expressions:
We will restrict consideration to Maple expressions
and ignore command constructs like 'iLthen', and thus
Concrete Syntax Abstract Syntax
will also ignore the Maple 'procedure' and 'uneval' types.
E ::=E+T IT E ::=EOE For simplicity of the discussion we will also not include
the more complicated aggregate expression types
T ::=T *pIp 0::=+ 1* 'series', 'array', and 'table', but by the end of this paper it
should become apparent how they can be incorporated. 2
P ::= (E)
We first present an over-simplified abstract syntax
Table 1: Example of Concrete vs. Abstract Syntax just to get us started, allowing us discuss some impor-
tant features before we present a more complete ver-
The reduced complexity of abstract syntax makes sion. The start symbol for this syntax is 'P', and a
it even easier to utilize compositional approaches for description of the intended interpretation is included
dealing with the meaning of a language. Here is an beneath each production:
example of a semantic specification for the above syn-
P::=Q
tax, where the first production indicates that we apply
P (a Maple program) is an expression sequence.
the meaning of the binary operator to the meanings of
its two operands: Q::=E*
Q (an expression sequence) is a sequence of
E[E 0 E) ::= 0[0]( E[E], E[E] ) expressions.
0[+] ::= integer addition E ::= I I N I T(X*)
O[*] ::= integer multiplication E (an expression) is either an integer, a name, or a
To use this approach all you need to have (or be type construction over a sequt!nce of operands.
able to simulate) is a tree-oriented representation of the X ::=Q E N I I
language structure for a sentence. When the nodes of X (an operand) is either an expression sequence or
the tree contain tag information to indicate the type of an expression or a name.
each component phrase, it becomes a simple process I I
N ::= S function N(Q) indexed N[Q]
when traversing the tree to find matching productions N (a name) is either a string, a function, or an
of the abstract syntax. Since Maple expressions have indexed reference.
this kind of structure[3] and the structure is relatively
T ::= + I * I 1\ I list I set I ...
accessible to us, this is an approach that we can use.
T is a Maple aggregate type specifier.
An Abstract Syntax for Maple Expressions One important distinction to make in how Maple
represents expressions internally is the difference
There are very few productions in an abstract syn- between an expression sequence (an expression of sur-
tax describing Maple expressions. We will focus on face type 'exprseq') versus the sequence of operands
creating a syntax that does reasonable justice to how for a type. An 'exprseq' internally is a single object,
Maple types are represented internally. This will allow tagged with type EXPSEQ, having a sequence of com-
us to view surface types as different as "+" and 'list' as ponent objects, each of which in turn is some kind of
type construction operators over their component an expression. Some types (like 'function' and 'array')
I From this point on we will simply use the term 2 The results of adding support for these types,
·syntax'. and cease to make the distinction between syn· excluding indexfcn semantics, can be viewed in the
tax and gram mar. 'm aple2m if' code subm illed to the Maple share library.
23
have a sequence of operands, some of which may be 06 ::= fraction I float
expression sequences, but the sequence of operands 07 ::= integer
for the particular type is not itself an 'exprseq'. Such 08 ::= string
distinctions are important both syntactically and 09 ::= function I indexed
semantically - for parsing expressions properly, for
implementing the design cleanly, and for generating Semantic Functions for Maple Expressions
the MIF output code correctly.
Now that we have a relatively complete and use-
Another feature of the syntax to notice is the provi- able syntax for Maple expressions, we need some
sion for names. These are not quite the same types for semantic functions for mapping the syntax into deno-
which 'type(expr,name)' is true. Maple internal data tations that will represent the MIF code to be gener-
structures have a different internal concept for a name ated[4]. These semantic functions, when implemented
that has more in common with the concept of Lvalues in Maple, will have the following general structure:
found in other languages like 'C'. Since 'name' is not
P : maple programs -t MIF programs
actually a surface type in Maple, this is not really a
point of confusion for creating an expression parser, P[Q] ::= ... Q[Q] ...
but can be confusing to the reader. Q : expression sequences -t a comma-separated
As we have stated, the above syntax is over-simpli- sequence of MIF MathFullForm components
fied. Some of the types encompased by the T produc- Q[E*] ::= ... map(E,E*) ...
tions (for example "=" and "N') are binary operators E : expressions -t meaning of expressions
over expressions. Others (such as "+" and "*") are E[N] ::= N[N]
n-ary operators. In other words, we need to deal with E[T] ::= T[T]
the fact that different types have different signatures
describing their operands. The solution used here is to T : non-name expressions -t meaning of non-
add productions to the syntax to deal with grouping name expressions
operators according to their signature. From the view- T[OI(E,E)) ::= 0[01] ( E[E], E[E] )
point of later specifying the semantics, we would be T[02(E)] ::= 0[02] ( E[E] )
partitioning the types into equivalence classes of sig- T[03(E*)] ::= 0[03] ( map(E,E*) )
natures, determine the meaning of the operands based T[04(Q)] ::= 0[04] ( Q[Q] )
on the signature for the class, and then passing the T[05(N,E)] ::= 0[05] (N[N], E[E] )
result to the function that denotes the meaning of the T[06(1,1)] ::= 0[06] ( 1[1], 1[1] )
particular type. In fact, for consistency, we will do this T[07(1)] ::= 0[07] ( 1[1] )
with the N productions for names as well, since these N : name expressions -t meaning of name expressions
are also expressions constructed from Maple types and N[08(S)] ::= 0[08] ( 8[5] )
thus generalize to the same treatment. The reason for
N[09(N,Q)) ::= 0[09] (N[N],Q[Q])
the N productions is that we use names in circum-
stances where we don't use non-name expressions, but o : type operators -t meaning of type operators as
the productions still describe Maple internal expres- a MIF MathFullForm component
sion types. Integers and strings will also be treated in 0[+] ::= function to map the denotation of the
this type-operator expressive way: operand sequence to a MIF 'plus[...]' code fragment
(etc.)
P ::=Q
Q ::=E* I : integers -t meaning of integers (implemented as
E ::=T N I the identity operator)
T I I
::= 01 (E,E) 02(E) 03(E*) 04(Q) I 8 : strings -t meaning of strings (implemented as
I I
05(N,E) 06(1,1) 07(1) I the identity operator)
I
N ::= 08(S) 09(N,Q) In the above specifications, '.. .' indicates surrounding
01 ::=" = I I .. I I I
<> < <= and or I I denotational information. Most of the added material
02 ::= not in the denotations comes in dealing with programs,
03 ::= + * I expression sequences, and type operators. For this
04 ::= set listI application the other productions add negligible deno-
05::=. tational information beyond retrieval of the denota-
tions of their subphrases.
24
Implementing the Meta-Evaluator Figure I shows a portion of the actual implementa-
tion code for 'maple2mif, to give readers a sense of the
Four objectives were set for the Maple implemen-
final result. The routine is easily used by invoking it to
tation of the semantics of the meta-evaluator3:
construct a procedure to do the conversion, converting
1. It must work (obviously!). an expression to a string, and then writing the results
to a file:
2. It must closely follow the notation of the design.
> read 'maple2mif. txt' :
3. It must be easy to modify when implementing sim- >M := maple2mif():
ple and obvious extensions. >X := sin(a+b)Af(pi):
> interface (echo=O) ;writeto(foo);
4. It must be possible to have different instantiations > print (printf (' %s' ,M(X) ) ) ;
of the meta-evaluator without global naming con- > writeto (terminal) ; interface (echo=l) ;
flicts.
Objective I needs no discussion. Objectives 2 and Limitations
3 go hand-in-hand. The desired way to modify the pro- The 'maple2mif converter works quite well when
gram will be by first determining changes to the considered purely as a typesetting tool, with only a few
abstract syntax, following with changes to the denota- minor caveats:
tional specifications, and then finally by making (pre-
sumably manageable) changes to the implementation. • Since Maple is an 'eager evaluator' of arguments,
the expression you pass to the evaluator may not be
Objective 4 is important if we want to have differ- the expression that gets typeset. For example,
ent MIF converters available to us at the same time. 'maple2mifOO +2)' would generate MIF code for
For example we might want different converters for typesetting '3' in FrameMaker, while for commuta-
different font sizes, or different converters that typeset tive situtations like 'x+y', 'maple2mifO(x+Y), may
rational numbers (type 'fraction') either vertically or typeset either 'x+y' or 'y+x', varying between
horizontally, ie: Maple sessions. No good solution to this is known
(D versus (112)
at this time, other than perhaps to allow support for
some kind of neutralized expression form like that
returned by 'procbody'.
To allow for these situations the meta-evaluators can-
not share, by name, a single global object (like a sub- While some support for mapping special symbol
routine) that might need to be modified for differing names (like 'aleph' and 'pi') to their typeset sym-
semantics. The solution is implemented by giving bolic has been provided, there is no support for
each meta-evaluator its own protected environment of mapping special function names (like 'int') to their
local variable names for internal subroutines. The typeset equivalent. This should be addressed in the
entire collection of local names is in turn given to the future by modifying the syntax and semantics of
subroutines by such tricky methods as: 4 the 'function' type, handling it in a method similar
to how type operator syntax is treated now.
>M := proc ()
> local f,g; There are some Maple expressions that do not have
> env: = {' G ' =g, ' F' =f } ; close FrameMaker equation equivalents. The solu-
> g:= subs (env, x -> F(x+l»;
tion used here is to provide MIF code for some-
> f:= subs (env, y -> sin(y)+G(2));
> thing that is similar in appearance, for example by
> end; using the 'times' specification and character
This way the functions 'f and 'g' are only accessible to strings. This is not a limitation in 'maple2mif, but
other subroutines contained within the procedure 'M'. in the FrameMaker equation format. It does not
have a convenient method for formatting an
expression with an arbitrary binary operator.
3Terms like 'meta-evaluator' and 'meta-interpreter' When we view 'maple2mif as an exposition of denota-
may sound esoteric, but simply signify language evalua- tional methods, there are real limitations that need
tors implemented in lerms of an exisling inlerpreter,
addressing:
oflen used to modify the defaull interprelive behaviour.
4 This technique was found in - and gratefully bor- • While the use of 'whattype' and 'op' allows us rea-
rowed from - Michael M onagan's implemenlation of lhe sonable access to the internal structure of Maple
Gauss package.
25
expressions, they are not the perfect tools for the I. Support domain-oriented structuring of denota-
job. The result is a slight proliferation of special- tions. This is important as a structural design
case code, for example to distinguish between tool, as it serves in the role of a data-type for
'exprseq' and sequences of operands, or to retrieve denotational methods.
the occasional zero-th operand that 'op' doesn't
2. Support specification of states and environ-
return unless specifically asked for. The situation
ments. This is important for modelling mem-
is even less satisfactory for eventually supporting
ory and I/O. For example, this could be used to
the 'procedure' type, where we would need to use
handle treatment of last-name evaluation and
'procbody' and manipulate neutralized procedure
'assume' properties in Maple.
statements. The 'hackware' package provides bet-
ter access to the internal structures, but at the cost 3. Implementation of continuations. This is
of increased visual complexity, combined with the important for dealing with flow-of-control and
need to distinguish continually between objects error-handling issues, both of which become
and pointers to objects. What is really needed is a important when moving beyond evaluation of
front-end to hackware that would make it more Maple expressions to include Maple command
convenient for implementing traversals of arbitrary structures and the 'procedure' type.
Maple expressions.
The methods of denotational semantics have a
Conclusion
great deal more muscle than has been explored The methodology of denotational semantics can be
here[5]. For constructing more complicated meta- useful for designing programs. For structured pro-
evaluators, such methods are necessary for gener- gramming approaches to problems that can be charac-
alizing the implementation to encompass a broader terized in terms of formal languages, the composition-
range of possible meanings. The three most impor- ality property of denotational semantics allows us to
tant steps to take in the future are: create concise top-down solution methods. We hope
>maple2mif := proc()
> local env,sfP,sfQ,sfE,sfN,sfT,sfO,sfS,sfI,MIFargs,MIFsymbol;
>
> env:= {'P'=sfP, 'Q'=sfQ, 'E'=sfE, 'N'=sfN, 'T'=sfT, 'O'=sfO, 'S'=sfS, 'I'=sfI,
> 'MIFARGS'=MIFargs, 'MIFSYMBOL'=MIFsymbol};
>
> # semantic function P
> # defined over the syntactic domain of programs
> sfP:= subs (env, proc()
> cat('<MIFFile 3.00> # generated by maple2mif\n',
> '<Math\n',
> '<MathFullForm " ' , Q(args) , '\' >\n' ,
> '<MathOrigin 2.0" 2.0">\n',
> '<MathSize MathMedium>\n',
> '>\n' ) ;
> end); # proc sfP
>
> # semantic function Q
> # defined over the syntactic domain of expression sequences
> sfQ:= subs (env, proc()
> if nargs=O then
> # NULL exprseq
> E(");
> elif nargs=l then
> # single expression
> E(args[lj);
> else # nargs > 1
> # multiple expressions
> cat ( , comma [ , , MI FARGS (op (map (E, [args I ) ) ) , ' I ' ) ;
> fi;
> end); # proc sfQ
Figure 1
26
> # semantic function N
> # defined over the syntactic domain of typed name expressions
> # where allowable name operators={string,function,indexed}
> sfN: = subs (env, proc ()
> local 0;
> 0 :=whattype(args[1]);
> i f member (0, ( , s tr ing' }) then
> 0(0) (S(args[1]));
> elif member (0, ('function', 'indexed'}) then
> 0 (0) (N (op ( 0 , a rgs [ 1 ] ) ) , Q ( op (arg s [1] ) ) ) ;
> else
> ERROR (cat ('unsupported expression type, ,0,', detected'));
> fi
> end); # proc sfN
27
I B. MAPLE IN APPLIED MATHEMATICS
A SYMBOLIC ENGINEERING MECHANICS SYSTEM
BUILT ON OEM MAPLE
31
Component (i) is written in C, component (ii) To perform a kinematic analysis, the user specifies
contains C code and Maple code, component (iii) is the velocities and accelerations of any constraints
entirely Maple code. which are in motion. (In the example of the four bar
linkage (figure 1), all constraints would have 0
velocity and acceleration except the driving angle.
(i) Analytix If the crank is being driven at constant angular
velocity v the angle would be given a velocity v and
an acceleration 0.) The user also must specify a
To create a model of a mechanism in the Analytix fixed point and a fixed line.
package, the user first sketches the mechanism.
Typically the sketch contains a simplified With the constraint velocities and accelerations
representation of the mechanism's geometry. Links given, the model is able to output on demand the
are usually represented by straight lines between position, velocity, and acceleration of any point of
joints or points of force application. Centers of the mechanism and the angular velocity and angular
gravity of any links with non-negligible mass are acceleration of any line.
explicitly sketched.
Static analysis of a mechanism may be performed in
The user then specifies the exact geometry by a very natural way in a Variational Geometry system
adding constraints to the drawing. The constraints by assuming that constraints carry reactions. Hence
specify angles or distances on the drawing. For a not only the motion, but also the statics of the model
kinematic analysis, the constraints should represent are defined by the constraints. If loads are applied
quantities whose motion is known. In practice, for a to a mechanism in Analytix, reaction forces are
single degree of freedom mechanism, all the generated in the constraints. The system will sum
constraints but one represent quantities which stay the constraint forces which impinge on a point to
fixed throughout the motion of the mechanism. The give the reaction force at that point. The system will
final constraint represents the driver, whose motion integrate the forces on a single line segment to give
is known. The Analytix system aids the constraint shear force and bending moment.
specification process by giving continuous feedback
on whether the model is underconstrained, Analytix allows external forces to be applied to any
overconstrained, or consistently constrained. The point on a mechanism and external torques to be
constraint values may be numbers or expressions. applied to any line. These forces may be constant or
Figure 1 shows an Analytix model for a four bar they may vary with geometry, time or some other
linkage. parameter. Analytix also provides conformal force
elements: translational and rotational spring-damper-
actuators.
32
specifies the fixed constraints and the input drivers problems of arbitrary complexity, it was necessary
in the same way as for kinematic analysis. Free to maintain a symbolic representation as a nested
constraints are given initial values and initial sequence of expressions with intermediate variables
velocities and marked as being free to accelerate. introduced by the system. This eliminated the
exponential growth in individual expression
complexity. However, as Maple is designed to
(ii) Creating Symbolic Analytix Models manipulate single expressions rather than sequences
of expressions with collective meaning, this
necessitated a layer of code to allow the
In a previous paper [4] a method was described for manipulation of our symbolic representations.
performing a symbolic analysis of dimensioned
engineering drawings. Analysis of the constraint Table I shows the system output for the location of
graph associated with the drawing led to its point P9. For comparison, table 2 shows the same
description as a sequence of elementary Euclidean expressions without intermediate variables.
constructions, each of which was responsible for
constructing a single point or line from its specified
relation to known (already constructed) points and
lines.
33
FullySubstitute(P9x);
I ()+lb+1 (acos(e)-b)2+a2sin(e)2+c2-d2)(acos(e)-b) I(
2 a cos 41 2 4 2 2 +
a cos(e) -2acos(e)b+b 2 +a 2 sin(4?)2 4
2c 2 a 2 cos(e)2- 4 c2 a cos(e)b+2c 2 b 2 +2c 2 a 2 sin(e)2 _a 4 cos(e)4
+ 4 a 3 cos(e)3 b - 6 a 2 cos(e)2 b 2 - 2 a 4 cos(e)2 sin(e)2 + 4 a cos(e) b 3
+ 4 a 3 cos(e) b sin(e)2 - b 4 - 2 b 2 a 2 sin(e)2 - a 4 sin(e)4 + 2 d 2 a 2 cos(e)2
112
- 4 d 2 a cos(e) b + 2 d 2 b 2 + 2 d 2 a 2 sin(e)2 - c 4 + 2 c 2 d 2 - d 4 ) a sin(e)j(
a 2 cos(e)2 - 2 a cos(e) b + b 2 + a 2 sin(e)2)
Table 2: Equation for P9x with all the intermediate variables eliminated.
The Intermediate Variable Table (IVT) and the Equations(expr,style) - for each variable v in expr
routines to support and manipulate this structure which is in the Intermediate Variable Table, returns
were written in the Maple symbolic programming the equation defining v. Style specifies whether
language and coexist as a package running within implicit or explicit equations are desired.
Maple. We describe in the following the functions
which constitute this library. grouped according to FullEquations(expr.style) - A recursive version of
their use. the above
34
(d) Geometric and mechanics functions 2, one angle is given a value t, while a second angle
is given a value r*t+s, where r is the gear ratio and s
represents the offset between the gear angles in an
Angle(line1,line2) - returns the angle between two
initial configuration.
lines
P8y=dsin(rt+s)
(0 Eliminating Intermediate Variables
L10B=cos(rt+s)
35
(ii) Torque in a Crank / Piston to the reaction in parameter a. The system returns
an expression for the torque which involves the
intermediate variable P8a and its derivative with
In our second example, we derive an equation for respect to a. To express torque as a single equation
the torque generated by piston force F in a in the input parameters, we can apply the function
piston/crank mechanism. The Analytix model is FullySubstituteO.
parametrized by the crank length c, the length of the
connecting rod L, and the crank angle a. Assuming
a force of F (depicted as 1 in figure 3) applied at the
(iii) Dynamics of a Double Pendulum
piston, we require the torque in the crank.
Install(torque,torque=Reaction(a»;
36
A_a:: - G V_a 2 sin(2 b)- 4 cos(b) cos(a +b)g- V_a 2 sin(b) +8 cos(a)g
A_b:: - (3 V_a 2 sin(b)- 8 cos(a +b) g- V_a 2 sin(2b)+4 cos(b)g cos(a +b)
y = 2 a sin(t)
In order to ensure that all the equations in our output
sequence are preserved we use the undocumented
Maple function 'optimize/statseq()' with as its first
37
parameter the list of equations to be optimized and Authors
as its second parameter the list of output variables.
This ensures these outputs are preserved.
Philip Todd has an M.A. in Mathematics from
'optimize/statseq' ([r=2*a,x=r,y=r*sin(t)],[x,y]); Cambridge University, an M.S. in Applied
Mathematics from Georgia Tech and a Ph.D. in
Mathematical Biology from Dundee University. He
[r = 2 a, x = r, y = r sine t ) ] is the founder and V.P. of Research and
Development of Saltire Software. He is currently
the principal investigator of an NSF SBIR grant
4. Conclusions researching automatic mathematical modelling of
geometric and mechanical problems.
We have presented a system which allows
engineering mechanics problems to be specified in Robin McLeod received his Ph.D. in Mathematics
an extremely intuitive and graphical manner through from Dundee University in 1972. His research
the medium of a variational geometry system while interests lie in numerical analysis and applied
a mathematical formulation of the problem within geometry. He is a Senior Scientist at Saltire
Maple is made available to the user. We have thus, Software. His current research involves human
for this problem domain, automated the error prone readability of symbolic mathematics, and
process of mathematical modeling which generally readability-directed simplification.
precedes mathematical analysis. The maintenance
of an intermediate variable table enabled us to keep Marcia Harris received her B.S. in Mathematics
the complexity of this mathematical model under from UCLA, and her M.S. in Computer Science
control. from Oregon State University. Her research
interests include the symbolic representation of
robot paths.
5. References
Todd & McLeod can be contacted at SaItire
Software, PO Box 1565, Beaverton OR 97075, tel.
1. Light R., Gossard D., (1982) "Modification of 503-622-4055
geometric models through variational geometry",
CAD 14:209:214 Harris can be contacted at 1334 SE 52nd Street,
Portland, OR
2. Fuller N. & Prusinkiewicz P. (1989) "Applications
of Euclidean constructions to computer graphics",
Visual Computer 5:53-67 Acknowledgement
3. Todd P. (1986) "An algorithm for determining
consistency and manufacturability of dimensioned This research was partially funded by the National
drawings" CAD86 pp 36 - 41, Butterworths, London Science Foundation under grant number ISI-
9223482
4. Todd P. and Cherry G., (1989) "Symbolic
Analysis of Planar Drawings", Lecture Notes in
Computer Science Vol 358 (p. Gianni ed.) 344-355
38
SIGNAL PROCESSING USING MAPLE V
John I. Molinder
Department of Engineering, Harvey Mudd College, Claremont, California
39
spectrum is ploffed and the result is stored in
Special Commands
vectors xrf and xif.
Initialization
zfilter(dtf)
Before using the special commands listed below
their files must be read and numerical values Analogous to the previous command, the effect
must be assigned to the variables sf (sampling of processing the signal with a discrete-time
frequency) and p2 (length of the FFT as a power system specified by its z-plane transfer function
of 2). In the example that follows sf is set to 64 is determined by using this command. Again,
samples per second and p2 to a value of 8 the magnitude of the output spectrum is ploffed
(corresponding to a FFT of length n=28=256 and the result is stored in vectors xrf and xif.
points).
FourierO
ffourier(et)
This command uses Maple's iFFT command to
This command computes a vector of length n compute the inverse Fourier transform of the
whose components are the values of the output spectrum and plots the output in the time
samples of a continuous-time signal domain. It accesses xrf and xif for its input.
(represented by the expression et), determines
vecprod(n,x,y,z)
its spectrum (using Maple's FFT command) and
plots the magnitude of the spectrum as a
This command computes a vector z of length n
function of frequency in Hertz (corresponding to
with components that are the products of the
the sampling frequency). The result is stored in
corresponding components of vectors x and y.
vectors xr and xi (the real and imaginary parts of
It is used as part of the Ipfilter(fh) command.
the spectrum) where it can be accessed by the
filtering commands listed below. Thus this
Example
command must be executed before using any of
the filtering commands.
Consider the response of a system to a pulse.
The first step is to create an expression xt that
Ipfilter(fh)
represents the pulse:
p2:=8;
afilter(ff)
sf:=64;
This command determines the effect of
processing the signal with a continuous-time
ffourier(xt);
system specified by its s-plane transfer function
tf (ff must be an expression with independent
This will compute the DFT (using Maple's FFT
variable s). The magnitude of the output
command) with n=2 8=256 points and a sampling
40
frequency of 64 samples per second (covering a This will set all the components of the OFT
total time duration of 256/64=4 seconds. The corresponding to frequencies higher than 10Hz
resulting plot of the magnitude spectrum is equal to zero. The resulting spectrum is shown
shown in Figure 2. Note that the points of the in Figure 3. A plot of the waveform in the time
OFT have been connected for clarity but the domain is shown in Figure 4 and is obtained by
actual frequency resolution is 64/256=0.25 Hz. giving the following command.
iffourierO;
".'e Plo~
'.8
..
'.6
.. ..
'.2
,.
.
Figure 1 " '" " ...
Figure 3
M.aplePlo1
5ll
...
PI Ie Plot
'"
'"
" "
"
Figure 2 .
e.;:
Ipfilter(10);
41
Now suppose we want to determine the I1ipl9 Ptct
afilter(H1 s);
,.,
iffourierO;
H2s:=900/(sI\2-6*s+900);
afilter(H2s); "
iffourierO;
05
Notice that the output is not causal (response
starts prior to the input). This is to be expected
since use of the Fourier transform forces the
region of convergence to be to the left of the
poles in the right half of the s-plane (to include
the imaginary axis) resulting in an anticausal
response. The magnitude spectrum is the same Figure 7
as that shown in Figure 5.
42
Similar sequences of commands produce the Finally, consider a first-order discrete-time
outputs shown in Figures 8 and 9 corresponding system with the transfer function given below.
to the transfer functions listed below.
H1(z) = __1 __
1-0.875 Z·1
H3 (s) = 10
s + 10 Issuing the commands below produces the
output waveform shown in Figure 10.
H4 (s) = 10
s - 10
H1 z:=1/(1-.875/z);
iffourierO;
"
(
Figure 8
Figure 10
t1aptePlot
-0.2 Conclusions
-0.'
The special commands described in this paper
provide a convenient method for determining the
properties of signals and systems using MapleV.
-0.6
43
Appendix # NOTE: REQUIRES THAT FOURIER.MPL BE
# READ BEFORE USING
Ipfilter:=proc(fh)
Listings tor several of the special commands are
npts:=2Ap2;
given below.
mx: =vector(npts, 1);
np:=nptsl2;
for k from 2 to np+1 do
fourier.mpl
if xax[k) > fh then
mx[k):=O;
# Set up MapleV to handle FFT and unit step
mx[npts+2-k):=0;
# functions
fi;
cd;
readlib(FFT):
vecprod(npts,xr,mx,xrf);
readlib(Heaviside):
vecprod(npts,xi,mx,xif);
alias(u=Heaviside):
mf:=vector(npts,O);
# Load vector manipulation routine for k to npts do
mf[k]:=sqrt(xrt[k)1\2+xif[k]1\2) ;
# read ·vecprod.mpr; od;
44
for k to npts do # sf=sampling frequency
xrf[k]:=evalc(Re(xf[k]));
xif[k]:=evalc(lm(xf[k])); iffourier:=procO
mf[k]:=sqrt(xrf[k]"2+xif[k]"2) ; npts:=2"p2;
00', iFFT(p2,xrf,xif);
dt:=1/sf;
p:=eoncat(xax,mf); gt:=n->dt*(n-1 );
p1 :=convert(p,listlist); xaxt:=vector(npts,gt);
plot(p1);
end: p:=concat(xaxt,xrf);
p1 :=convert(p,listlist);
plot(p1);
zfilter.mpl end:
zfilter:=proc(dtf) with(linalg):
npts:=2"p2;
pi:=evalf(Pi); # Compute the product of real vectors x and y
dw:=evalf(2*pi/npts); ferm by term
ffd:=subs(z=exp(I*(n-1 )*dw),dtf); # n=vector length
ffdf: =unapply(ffd, n); # z=resulting vector
mx:=vector(npts,ffdf);
x:=vector(npts,O); vecprOO :=proc(n,x,y, z)
xf:=vector(npts,O); z:=vector(n,1 );
xrf:=vector(npts,0); for i to n do
xif:=vector(npts,O); z[i]:=x[i]*y[i];
mdf:=vector(npts,O); 00',
for k to npts do end:
x[k]:=xr[k]+I*xi[k];
xf[k]:=evalc(x[k]*mx[k]);
xrf[k]:=evalc(Re(xf[k]));
xif[k]:=evalc(lm(xf[k])); Reference
mdf[k]:=sqrt(xrf[k]"2+xif[k]"2);
00; A. V. Oppenheim, A. S. Willsky, and I. T. Young,
sf1 :=5f; Signals and Systems, Prentice-Hall, Inc., New
g:=n->(n-1 )*sf1 /npts; Jersey, 1983.
xax:=vector(npts,g);
p:=concat(xax,mdf);
p1 :=convert(p,listlist); John I. MoUnder Oohn_molinder@hmc.edu)
plot(p1); received his B.S. degree from the University of
end: Nebraska, his M.S. degree from the Air Force
Institute of Technology, and his Ph.D. degree
from Caltech, all in Electrical Engineering. Since
ifourier.mpl
1970 he has been a member of the faculty at
# Computes and plots real part of inverse FFT Harvey Mudd College where he is Professor and
# npts=2Ap2=number of points Harvey S. Mudd Fellow of Engineering.
45
IMPLEMENTATION OF A MAPPING PROCEDURE FOR THE
DOMAIN DECOMPOSITION FOR PDEs IN MAPLE
a a
v = (-a
Xl
'''''-a
XN
)
1 Introduction and
A(x, u) = (al(x, u), ... , aN(x, u)).
The analysis for singular perturbation problem has
been successfully used for domain decomposition by o is a bounded region in n Nwhose boundary r is
several researchers. Russo and Peskin[8] combined a smooth (N - I)-dimensional manifold.
The associated reduced equation is,
46
which is a quasilinear first order PDE. The solution
of the reduced equation will be denoted as Uo, u
being the solution of the elliptic problem (1).
As a result of singular perturbation analysis,
the solution of an elliptic problem can be approx-
imated, under certain conditions, by the solution
of the associated reduced equation and correction
terms. That is, in a large portion of the domain of
the elliptic problem the solution of the problem can
be replaced by the solution of the reduced equation;
however there exist subdomains, boundary and in-
terior layers, in which the solution of the problem
is a combination of the reduced solution and corre-
sponding correction terms. Some conditions, called
Figure 1: The domain expressed in Maple
stable conditions, are required for admissible solu-
tions. These stable conditions are described in de-
tail as theorems in [5] and a set of rules are built list, expressing the domain, is as follows:
from the stable condition requirements. The aim
of our system is to search for stable partitions from [[Xl, Yl, eq 1],
all possible partitions using previously mentioned [xz, Yz, eq2],
rules and traversing on a graph of the domain. Af- [X3' Y3, eq3],
ter stable partitioning, the domain is divided into
[X4' Y4, eq4],
a set of subdomains. Finally the system selects
each subdomain individually so that each subdo- [xs, Ys, eq5]],
main can be distributed across different processors
in which every element is a sublist, corresponding
for parallel computation. During the selecting pro-
to a side of the domain. The order of elements in
cess the size of the subdomain has to be adjusted
properly in order to satisfy requirements from the a list is the clockwise order of sides of a domain.
The first and second elements in a sublist are the
Schwarz method[10].
x and Y coordinates of the start location of a side,
and the third element is the equation of curve of
the side. Here we do not limit the equation for a
2 Representations of Domain side; however implementation requires restriction
and BCs to equations recognizable by Maple. Both convex
and concave domains are permissible in our defini-
The first step for implementing, in Maple, domain tion.
decomposition for 2-D PDEs is the representation The boundary conditions in 2-D are expressed as
of domain and boundary conditions. Here we do a list also. For the domain in Figure 1, we have a
not distinguish the concepts, domain and region following list as boundary conditions,
rigorously. The strict definitions of domain and
region are given in [5]. We use lists to express do- [[1,5], 1, h(x, y), fz(x, y), h(x, y), f4(X, y),
mains and boundary conditions because lists are fs(x, y), h(Xl, Yl) = fs(xll yd]·
accessible data structures in Maple. In Maple, a
list can be easily tranformed into a set or an ex- The first element of the above list is a sublist,
pression sequence. This transformation allows dif- which contains the indices of incoming sides. By
ferent type manipulations to be applicable to the incoming side, we mean that the characteristic
same object. For instance, for a domain, set op- curves for the reduced equation (2) are incoming
erations(union, minus and intersect), and list op- through this side. The detail description of in-
eration(concatenation) can be used. More impor- coming side can be found in [5]. The first and
tantly, the list, representing a domain, can be re- fifth sides are incoming side in the above list. The
garded as a graph, so tha~ algorithms for graphs second element is the number of the additional
can be directly applied to the list(domain). boundary conditions. The third to seventh el-
For a general domain in 2-D, as shown in Fig- ements, h(x, y), fz(x, y), h(x, y), f4(X, y), fs(x, y),
ure 1, its boundary consists of several sides. The are given boundary conditions for the first to fifth
47
smooth and do not all vanish at the same point.
The first order system has a parametric form solu-
= =
tion, x x(s), y y(s), and u(s). Also the initial
condition is referred to as the initial curve C in
(x, y, u) space. To solve this initial value problem
we pass a characteristic curve through each point
of the initial curve C. If these curves generate a
surface, this integral surface is the solution of the
initial value problem. The conditions, under which
a unique solution of the initial value problem for
(3) can be obtained, are expressed as,
The solution of the associated reduced equation(2) uo(x, y) = ¢(x, y), for (x, y) in f(x, y) = O.
is the main part of the approximated solution of
For the boundary, f(x, y) = 0 we change the form
PDE(l). Solving the reduced equation is one of
to, y = g(x). Then for the first order system (3),
the principal parts of our system implemented in
the initial condition can be rewritten as,
Maple.
Suppose a general domain for PDE is depicted s = 0, x = 1", Y = g(1"), U = ¢(1",g(1")).
as in Figure 2. The boundary of domain, r, con-
sists of three parts, F_, the incoming side, Fo , the As a special case, if the boundary is x = k, where
tangent side, F+, the outgoing side. For the re- k is a constant, the initial condition then is,
duced equation, we cannot have a solution satisfy-
ing the complete boundary conditions, only a solu- s = 0, x = k, y = 1", = ¢(k, 1").
U
48
Differentiating the first equations of (3) we ob- I lsi Onlor ~tom I
I
tain the equation,
13M~DE I
d2x dx dy du
ds2 = F(ds' ds' ds'x,y,u), (5) F
(6)
(7)
.olved unsolved
Coupling the first equation of (3) and the equation
(6) and solving for y, u, Figure 3: Flowchart for solving the first order sys-
tem
q,
Finally, substituting the above equations into the
equation (7) we obtain the third order ODE (12)
dx
p, (14)
ds
d2 x Similarly to the above case, we apply the transform
(9)
ds 2
d3 x dp
r,
ds 3 dx
d2 p dr
in which p is a function of x. The equation (8) is , (15)
dx 2 dx
transformed into the second order ODE
and obtain the first order ODE
(10) dr
F(dx' r, x) = 0, (16)
Attempts to solve the second order ODE symboli-
which can be solved using Maple. The flowchart
cally are limited by current capabilities of systems
expressing the above procedure is depicted in Fig-
like Maple. If the nonlinear second ODE has the
ure 3.
form
The ODEs for which the above special cases ap-
(11 ) ply can be solved using Maple. However we cannot
49
guarantee that we will obtain a symbolic solution correctors, Wi(X, c), give the nature of layers in de-
to the general ODE like (7). It may be necessary tail. The layer effect exponentially decays along the
to resort to a numerical solution. Using numerical inner normal direction of the corresponding bound-
methods in the singular perturbation analysis will ary or interior singular curve. And the width of
be discussed in a future paper. layer is of order c or of order c l / Z depending on the
nature of the boundary or singular curve [5].
Based on the stability conditions, Theorem 1 -
4 Conditions for Stable Parti- 5[5], we build a production system [7], which uses
tioning and Searching the stability conditions as rules to search for all sta-
ble partitions of the given domain. In the produc-
Using uo, the solutions of the reduced equation, we tion system, the global database consists of sym-
can partition the domain into a set of subdomains. bolic functions, symbolic equations and lists which,
Among all possible partitions we are only interested as defined in Section 2, express the given domain
in the stable partitions with which u, the solution and subdomains as well as boundary conditions.
of the elliptic PDE is approximated in every sub- The search process is implemented by traversing
domains by Uo and is convergent to Uo as c --t O. on the graph which includes the given domain and
Certain stability conditions required by conver- all singular curves in the domain. Moreover, the
gence have to be imposed on such solutions. In search process is controlled by the following steps.
[5], three theorems, Theorem 1, 2, 3, for boundary
1. Along whole boundary every side is distin-
layer and two theorems, Theorem 4, 5, for interior
guished as F+, Fo and F_.
layer are described in detail. Each theorem includes
certain stability conditions as assumptions. When 2. On every side of boundary it is verified that
all assumptions in one of these thorems are satis- there is a theorem among Theorem 1, Theorem
fied, there exists a positive constant co such that 2 and Theorem 3, which is satisfied.
for 0 < c S co the equation (1) has a solution
u = u(x, c) of class c(Z,O')(n i ), which is defined as 3. The reduced solution Uo is tested to determine
the smoothness of a function in [4]. Moreover, for if it is smooth.
x in n i we have that 4. If the Uo is nonsmooth, the singular curves
must be found.
50
satisfaction with requirements from the Schwarz pertur
method [10, 9], that is, the subdomain has to over- {
lap with adjacent subdomains. The overlapping of _solve the reduced equation(sReduequ)
subdomains can accelerate the convergence of it- _determine the singUlar curve with the
erations in computation for PDEs. The following solution of reduced equation(sicurve)
rules are applied in the selecting process: _verify the first assumption of the stable
conditions for boundary layers(criteBl)
1. The selecting starts from the incoming side. _verify the second assumption of the
stable conditions for boundary
2. When the traversal moves from an incoming layers(criteB2)
side to a boundary side which has a bound- _verify the third assumption of the
ary layer, we have to select a birth-boundary stable conditions for boundary
layer subdomain. This subdomain is defined layers(criteB3)
to be the region located at the corner between _determine the widths of boundary layers
incoming side and boundary layer side. for all sides of domain(Wid, boundco)
_form the set of sides of all boundary
3. When the traversal moves along a boundary layers(formlyr)
side which has a layer, we can select a bound- _determine the kind of interior layers
ary layer subdomain. for interior lines(tyinter)
_verify the stable conditions for interior
4. When the traversal moves from a boundary layers (cri tel)
side to another boundary side, both of which _determine the width of interior layers(widI)
have boundary layers, a corner-boundary layer _form the set of sides of all interior
subdomain can be selected. This subdomain layers (formiyr)
is located at the corner between two boundary if no interior layer(sicu=NULL)
sides.
_select subdomains in turn, obtain a set
of sudomains(wsosubs)
5. When traversal moves from an incoming side
elif
to a singular curve, an birth-interior layer sub-
_select subdomains in turn, inclUding
domain can be selected. This subdomain is
interior layers, obtain a set of
defined to be the region located at the corner
subdomains(obtsubs)
between singular curve and incoming side.
fi
}
6. When the traversal moves along a singular
curve, we can select an interior layer subdo-
Following is an example which illustrates the pro-
mam. cess.
7. When the traversal moves from a singular
curve to a boundary side which has a boundary 7 Example
layer, a corner-interior layer subdomain can be
selected. This subdomain is located at the cor- Consider an elliptic problem.
ner between singular curve and boundary side.
au
=--
8. When the traversal is finished on a domain,
[f!.u
ax + u,
after removing the subdomains created in the in the square region n.
above steps, the remaining part, that is the
main subdomain, is selected. s = (x, y) : F(x. y) < 0 for F(x, y) = (1 - x 2)(y2 - 1),
and
6 Structure of Program o side =
l:x 1,0 S y S 1
1 side =
2:x 1. -1 S y S 0
The whole package of domain decomposition in exp\x - 1) 3:-1 S x S 1,y=-1
Maple consists of 78 functions. The structure of the ¢(x, y) = exp( -2)
siue
side =
4:x -1, -1 S y S 0
package can be represented in the following pseudo- o side 5:x= -1,0 S y S 1
code. o side 6:-1 S x S Ly= 1
51
The parameters are y
~ (x, 1) = 0
52
Partial Differential Equations, Vol.4( 1), pp1-
39, 1979.
This study has been supported by the National Sci- [10] H.A. Schwarz, Gesammelte Mathematische
ence Foundation under grant ECS-9110424 at Rut- Abhandlungen, Springer, Berlin, 2, pp133-134,
gers University. 1890.
53
is Professor of Mechanical and Aerospace Engineer-
ing at Rutgers University, and is Director of the
CAIP Computational Engineering Systems Lab.
His research interests include the interface between
symbolic and numeric computing, as well as the de-
velopment of scientific user data management and
interface systems. He has published numerous pa-
pers related to computer software and applications,
as well as in the fields of computational fluid dy-
namics, nonlinear dynamics, and combustion.
54
IIA. MAPLE IN EDUCATION
THE INFLUENCE OF MAPLE ON A LINEAR ALGEBRA COURSE
AT THE DELFT UNIVERSITY OF TECHNOLOGY
-q
An if:
-6
[ -1
(i) A = -4 4
7 -9 -3
-1
(ii) A =
[ -3
: 7
3
-1~
-3
]
57
2 2
[ -2 -5 ]
(iii) A = 1~ -7 20 o
-4 11 with basis (b],b 2 ), where b] 3
-10 o
(iv) A =
[-1 11
-6 ]
-8 -5
7 1
o
o
J]
14
(v) A = [ -2
-1 10
and b2 = 1 . f is the linear map
1 -13 o
o
0 1 1 1 1 from V to W defined by
0 0 1 1 1
(vi) A = 0 o 0 1 1 2v] - V2 - 6V3 - 3V4
0 000 1 o
0 000 0 3v] - V2 - 8V3 - 4V4
Un
1
o
(vii) A = 1
o
0 (in Maple: f:=v->vector([
2*v[1]-v[2]-6*v[3]-3*v[4],O,
-n
Of course, students are not surprised with the out- 3*v[1]-v[2]-8*v[3]-4*v[4],O,O]);)
come of question (a). But when they answer (b),
they usually become enthusiastic. (Without a com-
puter, they would not have been so enthusiastic (aJ Let v =[ Write vasa lin-
about this exercise.)
ear combination of (a], a2, a3) and
Example 2.1.2
put the coefficients of this linear
We teach our students how to find the matrix of a
combination in the column vector
linear map relative to certain bases, and we prove
x. This x is called the column of
that the matrix of f times the matrix of 9 is equal
co-ordinates of v relative to the
to the matrix of the composite map fog. They
see a lot of I:'s but most of them don't know what basis (a], a2, a3)'
it is all about. Students now have the opportu- (b) Compute f( v) through the Maple
nity to practise this within a reasonable time. For command f (v) ; . Find the col-
the following exercise, all they need to know is the umn of co-ordinates y of f( v) rel-
definition of the matrix of a linear map. ative to (h, &2)'
(c) Find the matrix F of f relative to
Exercise (a],a2,a3) and (b],b 2).
n", [!]
V is the vector space with basis (d) Verify that Fx = y.
(a],a2,a3), where (e) 9 is the linear map from W to R2
defined by
where c] = [ ~ ] and C2 = [ ~ ].
Find the matrix G of 9 relative to
(b],b 2) and (C],C2).
58
(f) h is the linear map defined by h( v) = the definition, students can get an impression of
g(f(v)) (so h is the composite map what the condition number is trying to tell them.
of g and f). Find the matrix H of
h relative to (aI, a2, a3) and (Cl, C2)'
Exercise
(g) Verify that H = G F. A is the matrix ~ [-1 ~]. The
unit circle in the x, y-plane is trans-
Example 2.1.3
formed by A into the curve
Suppose the students have learned and practised
solving systems of linear equations, and we now
C = {A [ cos(t)sin(t) ] (O:S t:s 27f)}
have come to the issue of finding eigenspaces. Again,
lots of systems must be solved. There is no need A picture of this curve is obtained by
to do this by hand any longer, so the students may the Maple commands
use Maple here. This will save a lot of time which
they can use for practising the things we want them
to practise, like determining the algebraic and ge- b:=evalrn(A&*vector([cos(t),sin(t)]»;
ometric multiplicity and diagonalizing matrices.
plot([b[1],b[2],t=O .. 2*Pi]);
Exercise Find the determinant and the condition
Given the matrices number of A and make a picture of the
83 80 -60] curve C. Do the same in each of the
A = -20 3 30 and
:]
[ following cases:
o 0 43
7 -20 -5 (a) A = [~ ~]
5 -13 -5
B = [
-5 10 7 :
(b) A= [ 100 100]
5 -10 -5 -3 -100 100
(a) Use only det and solve to find 100 200]
the eigenvalues of A and B. Check (c) A =[ 300 400
your answer with eigenvals.
It appears that the determinant tells us
(b) Use only nullspace to find a ba- something about the measure by which
sis of each of the eigenspaces of the area of the unit circle is enlarged,
A and of B. Check your answer whereas the condition number tells us
with eigenvects (The output of something about the measure by which
eigenvects(A); consists of " lists" the shape of the unit circle is "flattened."
of the form [a, b, S], in which a is
an eigenvalue, b is the algebraic
Example 2.2.2
multiplicity of a and S is a basis
One ofthe most important applications of linear al-
of the corresponding eigenspace).
gebra is solving systems of linear differential equa-
(c) Is there a basis of R 3 that consists tions. We would like the students to make phase
of eigenvectors of A? portraits, but since we are not teaching them cal-
(d) Is there a basis of R 4 that consists culus, we don't want them to spend too much time
of eigenvectors of B? on it.
59
each of the questions, we are dealing would be rather discouraging without a computer,
with the initial value problem but in a computerlab class, they are manageable
for the students.
u' Au = Example 2.3.1
{ u(O) = Uo
Exercise
l", ~
V is the vector space spanned by (a1' a2)
(a)A= [ -11 -1]-1 anduo= [ 11 ] .
and W is the vector space spanned by
Find the solution u and give the
commands
curvel:=[u[1].u[2].t=0 .. 10]; (b" b" b3 ), wh", ", ~ -~ [
[-il ~ Ul ~ -j]
and
plot(curvel);
to make a picture of u.
Repeat this question, but this time
b, b, [
with Uo = [ ~ ]. Assign the name
curve2 to this curve. In the same
way, make a curve3 with Uo
[ ; ] and a curve4 with Uo
and b3 ~ [ -!H
(a) Verify that both a1 and a2 are per-
[ ~ ]. Draw the four curves III pendicular to each of bl , b2 and b3 ·
one picture with the command (The dotproduct of two vectors v
plot({curvel.curve2.curve3.curve4});. and w is computed by Maple through
the command dotprod (v. w) ; ).
(b) The same question, but now with
(b) Verify that each vector from V is
A=[~ -b]' perpendicular to each vector from
W. Hint: Take v = C1al + C2a2
(c) Again the same question, with A =
and w = d1 bl +d2 b2 +d3 b3 (don't
[~ _ ~ ] and for the initial con- assign values to Cl, C2, d l , d2 and
d3 ! If necessary, give the com-
ditions we take respectively Uo =
mands cl:='cl'; etc.) and show
[ to ],
1
UQ = [ 1
5], UQ = [ 19 ] that v is perpendicular to w.
and Uo = [ ~l5 ]. This time, the (c) Now the general statement. V is
the vector space spanned by
interval from 0 to 1 is a better (al,a2, ... ,a n ) and W the vector
range for t. Why was this change space spanned by (b l ,b 2 , ... ,bm ).
not needed in questions (a) and It is given that ai is perpendicu-
(b)? lar to bj for i = 1, ... ,n and j =
1, ... , m. Prove that each vector
from V is perpendicular to each
2.3 Proving abstract statements vector from W.
If we give our students an abstract statement and
ask them for a proof, they usually have two prob- Example 2.3.2
lems. Firstly, "abstract" means" difficult" or" mys-
terious" to them. They often don't see what an Exercise
abstract proof has to do with down-to-earth com-
putations. Secondly, they don't know how to start.
The following two exercises are examples of how
to help them with both problems. Both of them
(a) A is the matrix [1 6
94
-~~ =i~]
-4 -5
60
17 -49 70] we did not want them to use eigenvals immedi-
and B = 6 -20 34 . ately, since this exercise was meant to practise the
[ o -2 7 computing of eigenvalues. So we often had to in-
(i) Find a matrix 5 and a matrix dicate which Maple functions they were allowed to
Tsuch that 5- 1 AS T- 1 BT = = use.
A, where A is a diagonal ma-
Third, we did not want to spend too much time on
trix.
teaching them Maple. So we decided to introduce
(ii) Compute M =
5T- 1 .
each function at the moment it was needed. Fur-
(iii) Verify that B = M- 1 AM. thermore, we provided a list of all the Maple func-
(b) A is an n x n matrix with n dis- tions that are used in our course. This turned out
tinct eigenvalues and B is an n x n to be a good policy: there was hardly any need to
matrix with the same eigenvalues give the students an introduction to Maple. They
as A. Prove that B is similar to just used it.
A.
4. The results
Comparing the experience of the past two years
3. Teaching materials with the teaching of linear algebra without a lab
In our view, most books with titles such as" Linear
class, we make the following observations.
Algebra with a Computer" make too much use of a
computer (see, for example, "Experiments in Com- 4.1 Students' motivation
putational Matrix Algebra" by D. R. Hill (Random On the average, the motivation of the students is
House,1988) or "Linear Algebra with Maple V" by better. Of course, there always is the usual group
E. Johnson (Wadsworth, 1993)). Definitions are of students who are motivated anyway, and also
often surrounded by lots of computer commands there are those who just want to pass their exams
and sometimes the reader is expected to type com- with minimal efforts. But talking about students
plete programs. This approach focuses too much who are somewhere between these extremes (which
on the computer. So we decided to use a textbook is the largest group) we noticed that they do much
on Linear Algebra without a computer. We have better than the norm for this group of students.
chosen G. Strang's book" Linear Algebra and its
Applications" (third edition, Harcourt Brace Jo- 4.2 Understanding the theory
vanovich, San Diego 1988). Then we wrote a sup- We teach definitions, we give examples and we
plement for the lab classes. The exercises in the prove theorems, and our students sit and listen
above examples are from this supplement. Writing (and, hopefully, make notes). But a great deal
the supplement, we faced the following three diffi- of our theory cannot be practised by the students
culties. themselves, for the simple reason that there is not
enough time. With computer algebra, we can over-
First, we were tempted to make the matrices too come this problem. For example, observing the
big. For example, we asked for the rank of the way students handle the exercise in example 2.1.2,
matrix it turns out that the recipe for finding the matrix
1- t -4 7-t -6 of a linear map is not as straightforward as we ex-
2 tz-2t+l -4 t2 - 2t + 3 pected it to be for the students. After completing
t-6 -6 t+3 -9 this exercise in the computer lab class, they have
1 2t - 4 7 - 3t 3t - 6 a much better understanding of what this matrix
3t - 12 2t - 12 6 3t - 18 is all about.
for each value of t. It turned out that the students 4.3 Tests
needed more time than expected to type all the Every other week, at the end of a lab class, we
entries and to detect typing errors. give the students a 20-minute test. With Maple
available, we can ask them the things we want to
Second, we did not want the students to use all ask. A typical example is a test in which several
the available Maple functions. In example 2.1.3, 3 by 3 matrices are presented, and students are
61
asked to diagonalize them, if possible. Thus we
can see if they have learned how to handle eigen-
values and eigenvectors, without going through the
time-consuming process of solving lots of systems
of linear equations.
5. Conclusion
It hardly takes time to teach Maple to the students,
whereas using Maple saves a lot of time. With the
assistance of Maple, we observe an improvement in
the motivation of the students. Furthermore, they
get a better understanding of the theory and we
can test them more effectively.
E-mail: H.A.W.M.Kneppers@twi.tudelft.nl
62
CAN MAPLE HELP IN TEACHING CALCULUS
WITH LIMITED TIME AND STAFF?
Scott R. Fulton
Department of Mathematics and Computer Science, Clarkson University,
Potsdam, NY
Abstract 2 Background
This paper describes our experiences incorportat- In the 1993-94 academic year we introduced a
ing Maple into a calculus course with limited time significant component of Maple into the standard
and staff. Our approach to teaching the basics Calculus course at Clarkson University. This sec-
of Maple and its use in lectures and take-home tion describes the background for this experiment:
projects are described. Student reactions are sum- the facilities, time and staffing constraints, and
marized and compared to those at another insti- prior uses of Maple at the University.
tution. We conclude that our low-key approach
can have a positive impact on the course without
radical changes in the course format or substantial
2.1 Facilities
increases in contact hours or staffing. Clarkson University has a wide range of computer
facilities available for students. A generous site
license from Waterloo Maple Software allows the
1 Introduction full Academic version of Maple (currently Maple
V release 2) to be available on all machines which
Computer algebra systems such as Maple have
are capable of running it. This includes:
enormous potential for transforming the teaching
and learning of Calculus. Well-established pro-
• Student PCs: Each student entering the Uni-
grams, such as that at Rensselaer Polytechnic In-
versity is issued a personal computer. For
stitute [11 have made it clear that Maple can be
1993-94, this computer was an IBM PS/2
used effectively if the necessary commitment, fa-
Model 25SX (20MHz 80386SX processor)
cilities, time, and personnel are there. But what
with 4MB RAM, an 80MB hard disk, and a
if any of these factors are lacking? Can Maple
color VGA montior. Maple was pre-installed
still be used effectively? This paper describes our
on each student PC.
experiences incorporating Maple into a calculus
course with adequate facilities but a distinct lack • Networked PCs: Various PCs in dorm com-
of time and personnel. We hope this informa- mon areas, computer labs, classrooms, and
tion will prove useful to others interested in using lecture halls are available to students (when
Maple under less than ideal conditions. not in use ill classes). Many of these are capa-
The paper is organized as follows. Section 2 ble of running Maple, accessed from a central
describes the institutional setting and constraints. file server.
The format of the calculus course and the ways in
which Maple were used are described in section 3. • Workstations: Over 125 IBM RS/6000 color
Section 4 presents results from a survey of student workstations are available for student use.
reactions to using Maple. Our conclusions and Many of these are concentrated in three com-
thoughts for the future appear in section 5. puter classroom/labs with 20-30 worksta-
tions each; all run Maple.
2.2 Constraints
The standard freshman calculus course at Clark-
son (taken primarily by engineering and science
63
majors) meets for two hours of lecture and one 3 Implementation
hour of recitation per week. This austere schedule
poses a challenge for teaching and learning calcu- Maple (or any other computer algebra system) can
lus, even with a conventional approach. Adding serve at least two distinct purposes in a calculus
a new aspect to the course (such as using Maple) course:
must be balanced against the prospect of having
to cut something else out due to lack of time. In • As a learning tool: Maple has the potential to
Fall 1993, there were three lecture sections (150- help students better understand the concepts
160 students each) and 12 recitations (about 38- of calculus by making it easy to explore an
40 students each), with a total of about 460 stu- idea graphically and numerically as well as
dents. Total staffing was one professor and three analytically.
and a half Teaching Assistants. In Spring 1994
• As a problem-solving tool: Maple allows stu-
there were about 15% fewer students, the same
dents to solve problems more difficult and/or
number of sections, one professor, and four TAs.
realistic than the standard "textbook" prob-
Undergraduate tutors were available for scheduled
lems, allowing students to focus on the con-
group and drop-in tutoring and help sessions. Stu-
cepts involved rather than the details of the
dent consultants were available in the computer
calculations.
labs in the evenings and on weekends.
While we have tried to incorporate both of these
aspects of Maple into the course, our focus is on
the first: using Maple to help teach and learn cal-
culus.
2.3 History
3.1 Recitations
The efforts to incorporate Maple into calculus de- Our first goal was to teach the students enough
scribed in this paper build on the efforts of others about Maple to allow them to use it effectively
in previous years. In Fall 1991, an experimen- on their own. To do so, the first three weeks of
tal section of Calculus II (for students with ad- recitations were held in a workstation-equipped
vanced placement credit) met regularly in a PC- classroom/lab. Experience from the previous year
equipped classroom/lab. Also, an experimental showed that standing in front and writing on the
course combining calculus and physics used Maple board was a poor way to explain Maple (the stu-
regularly. Anecdotal evidence suggests that stu- dents cannot see the board well from behind the
dents were not completely satisfied with either ap- computer monitors), so we prepared tutorial hand-
proach; however, the experience gained by the in- outs to lead students through the basics of Maple.
structors helped guide later experiments. The tutorial handout for the first week led stu-
dents through starting Maple, getting help, using
In Fall 1992, all recitations of Calculus I were Maple as a calculator, basic Maple commands and
held in a workstation-equipped classroom/lab. syntax, and some basic commands for algebra. All
The Teaching Assistants showed students how to algebra was limited to expressions (not functions)
use Maple to solve problems related to their home- for this first week. For this first week only, we had
work. Although it did not generate a student two TAs in each recitation to help deal with the
revolt like at the University of Pennsylvania [2J, initial confusion of logging in, lost account names
this experiment was not a complete success. Sur- and passwords, etc.
vey results indicated that many students felt that The tutorial handout for the second week ex-
they did not learn enough about Maple to use it plained more commands for algebra, introduced
effectively on their own, and that the recitation lists (which arise in solving equations) and the
time would be better spent going over homework Maple notation for functions, and showed how to
and answering questions, rather than dealing with generate simple plots. Most students appeared to
Maple. Some compared this approach to a typing be able to work through these tutorials during the
class: "The TA wrote a command on the board recitation; some optional exercises were included
and we typed it in but didn't understand any- for working at home, but were ignored by most
thing." students. Having students work in pairs worked
64
well: this appeared to help overcome the typing were intended as learning exercises, grading was
problems and general confusion experienced the intentionally lenient: anyone making an honest ef-
previous year. It was also inevitable, since there fort would get a majority of the credit available.
were more students per recitation than worksta- Each project counted 5% of the course grade, and
tions in the lab. included an optional extra credit section.
The third week of recitation (still in the com- The three projects for the Fall consisted of:
puter lab) was devoted to working through a
"Practice Project" intended to give students an • Project 1: The Derivative.
idea of what to expect in the Maple Projects they This led students through the concept of the
would later do on their own (see below). This derivative as the slope of the line tangent to
project led students through some simple transfor- a curve, using both graphics and numerical
mations of functions (translations and dilations) calculations in an attempt to beat the con-
and then used these ideas in solving a simple ap- cept to death. An application section consid-
plied problem (finding the equation of a curve de- ered a problem involving a rocket under con-
scribing the shape of a tunnel). Most students did stant thrust, using the derivative to compute
the first part without trouble, while many were the acceleration from the velocity. Maple was
not able to complete the last part. This work was used to estimate the time at which an astro-
not handed in. naut would black out due to the effects of ac-
All remaining recitations were held in a regu- celeration. An extra credit section pointed
lar classroom and devoted to reviewing material out that the acceleration increases rapidly as
from lecture, going over homework problems, and the fuel runs low. and asked students how to
answering questions. Thus, after the third week, adjust the assumptions to avoid crushing the
students were on their own as far as using Maple. astronaut.
The book Maple V Flight Manual [3] was recom-
• Project 2: Optim·ization.
mended as a useful supplement, but it appears
An initial section had the students use Maple
that few students bought it.
to find the derivative of a function. set it
equal to zero, and solve for the critical points.
3.2 Maple Projects Graphs were used to see what was happen-
ing, and Maple's fsol ve command was in-
Students completed three take-home Maple troduced. An application section usell Maple
Projects during each semester. The goals of the to solve the classic textbook min-max prob-
projects were two-fold: to reinforce the calculus lem of moving a beam around a rectangular
concepts being learned through lecture and home- corner in a hallway. and then illustrated the
work, and to show how Maple can be used as a power of Maple by considering the case where
tool to solve "real-life" problems. Each project the thickness of the beam was not negligible
consisted of a handout with explanation and in- (i.e., a 4 x 4). An extra credit section gener-
structions and an answer sheet to be completed alized the problem by allowing the beam to
and turned in. Some of the projects were entirely be tipped in the vertical.
new, while others were based on ideas from other
sources, notably [4]. Students had one week to • Project S: The Definite Integral.
complete each project, and were allowed to work This used \.Olllmands from Maple's student
in pairs if desired (less than half did so). Most stu- package to illustrate areas under a curve
dents used Maple on their own PCs, rather than (graphically and mUllerically). Students then
go to one of the networked workstations or PCs. used an integral to solve an applied probabil-
Given the large enrollment and limited staff, ity problem (what percentage of sheet steel
we tried to design the projects so the instruc- can be expected not to meet the specifica-
tions would be crystal clear (to avoid unnecessary tions?); this integral could not be evaluated
confusion) and to make the grading possible in a using antiderivatives. An extra credit sec-
reasonable amount of time. Initially, most of the tion explored the accmacy of answers given
commands needed were given explicitly in the in- by various numerical approximations (left-
structions (with explanation); later, students were sum, right sum, middlesum. trapezoid, and
expected to figure out how to accomplish a given simpson).
task in Maple on their own. Since the projects
65
The three projects for the Spring consisted of: • On the first day of class, simple animations
of secant lines approaching a tangent line and
• Project 1: Volumes of Solids of Revolution. boxes filling up the area under a curve were
An initial section led the students through used to illustrate the dynamic nature f)f the
defining and plotting a solid of revolution fundamental ideas of calculus.
(like a football), and computing its volume
by the disk method. In the next section, • In discussing limits (e.g., lim:z:~o sin(x)/x =
students repeated this for a doughnut using 1), it proved useful to have Maple generate
the washer method, and then worked out the tables of numerical values and graphs (these
Maple commands for the shell method on seem more believable when produced on the
their own. An extra credit section had stu- spot, rather than copied from the instructor's
dents compute the volume of frosting needed notes).
to cover the top of the doughnut (maple frost- • Using Maple helped bring Newton's method
ing, of course). to life.
• Project 2: Numerical Integration. • Using Maple for graphs was especially helpful,
After defining the "exact" expression for the since it allows one to draw accurate graphs
period of a pendulum as an integral, this that everyone can see.
project used Maple to investigate the accu-
• In discussing infinite series, the fact that the
racy of the linear approximation to the pen-
harmonic series diverges was made more be-
dulum and the accuracy of the trapezoidal
lievable by using Maple to comute partial
approximation to the integral. Students also
sums of a large number of terms (e.g., 10 10 ,000
found the length required for a given period.
terms).
• Project 3: Convergence of Infinite Series. In addition to helping communicate the concepts
After introducing the Maple commands to being taught, using Maple in lecture helped the
generate (and plot) partial sums of a series, students take the program seriously, and provided
students used Maple to investigate whether a them with examples of its use. Also, it helped
given series would converge, and estimated its break up the monotony of the lecture format,
sum. They then computed approximations to which may have helped enhance learning and im-
7r using four different series and compared the prove students' perceptions of the course.
number of terms required to give three deci- We started the year using the DOS version of
mal place accuracy. Maple on a 386 PC. This arrangement proved frus-
trating, since the characters produced were barely
Grades on the Maple Projects were uniformly readable from most of the lecture hall. Several stu-
high, which is not suprising given the simple na- dents suggested trying the PC-windows version;
ture of the projects and the intentionally lenient this proved to be great, and was used the rest of
grading policy. It appears that most students the year. With the larger fonts available, text was
were able to complete most of each project with- clearly visible from everywhere in the room, and
out trouble. While few students expressed great the black-on-white format was much clearer. Also,
enthusiasm for the projects, few complaints were the ability to point and click on a graph to find
heard. Finally, despite the opportunity given to coordinates of a point was helpful.
work with a partner, it is likely that some cheat-
ing also occurred (this was suggested by several
students); given the current lack of staff for the 3.4 Homework
course, it is difficult to see what could be done to Students turned in homework to be graded ap-
prevent or even detect it. proximately once per week. None of the problems
specified using Maple (with the exception of the
3.3 Lectures Maple projects). However, students were encour-
aged to use Maple to check their answers (not to
Maple was used every day in lecture, typically for do the work!), and they were shown how to do so
5-10 minutes of a 50 minute lecture. The pri- in many cases in lecture. It appears that about
mary use was to help illustrate the concepts being 30-40% of the students did use Maple this way
taught. Some examples include: (see section 4 below).
66
3.5 Exams 4 Evaluation
During the fall semester, each of the three hour ex- There was relatively little negative feedback about
ams contained questions which involved Maple, in Maple during the year. In six opportunities for
each case worth a total of 10% of the exam. The written feedback about the course, few students
purpose of these questions was two-fold: to en- expressed an opinion about Maple (although those
courage students to learn Maple, and to evaluate who did were often negative). In talkiug with stu-
whether or not they had. The first exam had two dents and TAs, it appeared that student reactions
questions testing basic Maple syntax, the second to Maple were generally favorable.
had two questions about how to express certain A survey about Maple conducted in lecture dur-
operations in Maple, and the third asked which ing the last week of class each semester provided
of five sequences of Maple commands would solve more quantitative feedback. The respOIlses are
a given max-min problem. With only one excep- shown in Table I for the Fall semester (299 of 444
tion, average scores on the Maple questions were students responding) and Table II for the Spring
substantially higher than on the non-Maple ques- semester (177 of 361 students responding). Note
tions; nevertheless, many students were upset that that questions 1 and 10 were changed between
Maple appeared on the exams, and there was great semesters. For comparison, many of the state-
relief when it was announced that the final exam ments on the survey were taken directly from a
would not involve Maple. similar survey used at Rensselaer Polytechnic In-
During the spring semester, no Maple appeared stitute (RPI) and reported in [1]. The columns
on the exams. In retrospect, this was a mistake. labeled "RPI" give the percentages of students at
as several students pointed out: it allowed stu- RPI who agreed with the statement in Fall 1992
dents who "worked with a partner" on the Maple (Table I) and Spring 1993 (Table II). It should
projects to avoid any real involvement (and learn- be noted that the calculus course at RPI has sub-
ing) with Maple. stantially more time (3 or 4 lectures. 1 recitation, 1
computer lab per week) and resources (31 TAs for
about 1000 students) than at Clarkson (2 lectures,
1 recitation, no computer lab, with 3.5-4 TAs
3.6 Notes
for about 400 students). Finally, a simple survey
To keep our focus on learning calculus-rather about Maple was done at Clarkson ill Fall 1992;
than struggling with computers-we intentionally only one of the questions was repeated here (#17),
stuck to the basics of Maple. In particular, we did as the others did not seem applicable. In 1992 the
not teach or use: responses for #17 were 1%, 10%, 28%, 28%, and
31 % (strongly agree to strongly disagree), showing
that students in the present year feel significantly
• programming constructs (if/then, loops, pro-
more comfortable with using Maple on their own.
cedures, etc.)
Students were also given the opportunity to
write their own comments on the surveys. While
• advanced graphics their written comments were few. many of these
were negative. A common thread was the re-
• printing Maple sessions or graphics quest for more help in learning Maple: either a
handbook, a separate computer lab, or a separate
Implicit plots and animation were used a few times course in Maple. Indeed, in the Spring--when
in lecture, but the students were not asked to use many students were enrolled in the engineering
them. computing course---several students wrote that we
During the Spring semester, no additional in- should "make Maple a separate course" and have
the calculus course "stick to learning calculus".
struction in Maple was given (except for optional
review sessions and help for the few students who
were not enrolled in the course in the Fall). How-
ever, most of the students (the engineering ma-
jors) were also enrolled in an introductory engi-
neering course in computers which used Maple for
30-60% of the time.
67
strongly uncertain or strongly
agree agree no opinion disagree disagree BPI
1. The first three weeks of recitation in the computer 5 25 9 44 15
lab taught me enough about Maple to be able to use
it effectively in this course.
2. The use of Maple in lectures helped me to better 11 39 21 20 8
understand the concepts of calculus.
3. The Maple projects were interesting. 6 31 26 25 12 50
4. The Maple projects were reasonable in length and 12 52 20 12 4 54
difficulty.
5. Working on the Maple projects with a partner was 37 38 17 3 3 86
helpful and worthwhile.
6. Working the Maple projects helped me to better 7 29 27 26 10
understand the concepts of calculus.
7. Attending weekly computer labs (in addition to 25 23 18 23 10
recitations) would have been better than take-home
Maple projects.
8. I used Maple often to check my homework or to 10 26 12 24 27
help understand material from class.
9. I prefer to use Maple on my personal com- 31 30 26 6 5
puter rather than on one of the networked computers
(workstation or PC) in the computer lab rooms.
10. The exam questions involving Maple were rea- 10 33 18 24 14
sonable and fair.
11. Maple enables me to solve some problems that 32 46 11 6 4 87
would be almost impossible by hand calculations.
12. By using Maple I am able to see new approaches 5 29 31 25 8 57
for solving some problems.
13. Maple was easy to apply to problems of various 6 23 25 34 10 41
kinds.
14. The use of Maple in this course has improved my 2 14 31 35 16 42
problem-solving skills.
15. The use of Maple revealed aspects of calculus 3 21 35 29 11 49
that I hadn't thought about before.
16. The use of Maple was satisfactorily interwoven 11 46 20 17 6 71
with the rest of the course.
17. I have learned Maple well enough to feel confident 6 30 19 29 15
using it on my own.
18. My knowledge of Maple will probably help me in 12 32 26 17 11 70
other science and engineering courses.
19. I enjoyed the course. 14 36 23 16 9 76
20. I would rather have had a calculus course that 21 15 23 23 16 46
did not use Maple.
68
strongly uncertain or strongly
agree agree no opinion disagree disagree RPI
1. I learned enough about Maple last fall in Calculus 13 44 10 26 6
I to be able to use it effectively in this course.
2. The use of Maple in lectures helped me to better 12 38 23 19 7
understand the concepts of calculus.
3. The Maple projects were interesting. 4 30 31 25 10 64
4. The Maple projects were reasonable in length and 8 54 15 16 6 64
difficulty.
5. Working on the Maple projects with a partner was 42 36 15 3 2 89
helpful and worthwhile.
6. Working the Maple projects helped me to better 4 37 23 23 12
understand the concepts of calculus.
7. Attending weekly computer labs (in addition to 15 20 19 23 23
recitations) would have been better than take-home
Maple projects.
8. I used Maple often to check my homework or to 12 33 14 24 17
help understand material from class.
9. I prefer to use Maple on my personal com- 20 28 23 13 15
puter rather than on one of the networked computers
(workstation or PC) in the computer lab rooms.
10. I sometimes use Maple now for learning or solving 6 30 21 22 20
problems, even when it is not required for a course.
11. Maple enables me to solve some problems that 38 47 10 2 2 91
would be almost impossible by hand calculations.
12. By using Maple I am able to see new approaches 4 29 39 21 6 69
for solving some problems.
13. Maple was easy to apply to problems of various 3 41 26 22 7 59
kinds.
14. The use of Maple in this course has improved my 2 21 37 31 7 57
problem-solving skills.
15. The use of Maple revealed aspects of calculus 5 28 35 25 6 62
that I hadn't thought about before.
16. The use of Maple was satisfactorily interwoven 14 53 13 15 5 82
with the rest of the course.
17. I have learned Maple well enough to feel confident 14 49 12 14 9
using it on my own.
18. My knowledge of Maple will probably help me in 28 41 12 10 7 74
other science and engineering courses.
19. I enjoyed the course. 12 44 25 10 8 80
20. I would rather have had a calculus course that 10 10 24 32 22 36
did not use Maple.
Table II: Responses (percent) to Maple Survey (Calculus II, Spring 1994)
69
5 Conclusions and Thoughts Professor A. S. Fokas continued that effort. The
suggestions of Professor Michael Felland were also
for the Future of great help. The TAs for the course (Ben-
Overall, our experience with introducing Maple in jamin Brown, Joel Helms, Taras Lakoba. Frank
our calculus course was positive. The student re- Michielsen, and Anwar Saleh) did much of the
actions, while not overwhelmingly positive, indi- front-line work with the students. The Educa-
cate that many students found the use of Maple at tional Resource Center staff (especially Thomas
least acceptable, and in some cases helpful. On the Wright and Robert Barringer) provided invaluable
other hand, some students appear to view Maple technical support. Finally, the people at Waterloo
as an add-on to the course, and as such it provides Maple Software made this work possible by their
a convenient focal point for complaints. Some pos- generous license which allowed us to put Maple on
itive aspects: all student computers.
• Having Maple on the student PCs (rather [2] T. J. DeLoughry, T. J., "A Revolt Over
than in a computer lab to which students Software," Chronicle of Higher Education,
must make a separate trip) made it much 11/24/93, p. AI?
more palatable. [3] W. Ellis, E. Johnson. E. Lodi, and D.
Some possible improvements for the future: Schwalbe. Maple V Flight Manual. Pacific
Grove, California: Brooks/Cole, 1992.
• Identify a specific subset of Maple commands
to be learned and used in the course, and pro- [4] M. H. Holmes, J. G. Ecker, W. E. Boyce.
vide a handout listing and describing them. and W. L. Siegmann, Exploring Calculus with
Maple. Reading, Massachusetts: Addison-
• Require students to purchase an appropriate Wesley, 1993.
printed manual for Maple, such [3].
70
ENLIVENING THE MATHEMATICS CURRICULUM WITH MAPLE
71
In Section 2 below we give details of the integra- 2.2 Maple Laboratory Sheets
tion of Maple into the first year of the mathematics
degree course and discuss the educational philos- The introduction of Maple was implemented by
ophy that motivated this teaching initiative. In an interested and enthusiastic team of writers who
Section 3 we describe the use of Maple in higher- were familiar with the entire course and developed
year service mathematics subjects and present an material that would support the overall aims of the
evaluation based on a student questionnaire and programme. Initially it required the weekly prepa-
an analysis of student performance in one of these ration of a hand-out, in the form of a laboratory
subjects. Planned new developments are outlined sheet along the lines suggested in [2], on some topic
in Section 4 and our conclusions are summarised in of the course. As the Maple sessions ran in parallel
Section 5. with the traditional laboratory sessions, each week
students were solving similar problems using both
pen and paper calculations and Maple. The oppor-
2 Mathematics Degree tunity to explore algebraically more difficult prob-
lems than a typical modern student could handle
without recourse to a symbolic manipulation pack-
2.1 Structure of the Programme age was not lost on the developers of the Maple
laboratory material. In Table 2, a list of all the
As was mentioned in Section 1, Maple was intro-
duced into the teaching of the first-year mathemat- first-year topics, grouped by subject area, for which
Maple laboratory sessions have been developed is
ics degree programme in 1992. This was achieved
by developing a set of Laboratory Sheets structured presented.
around a pre-existing mathematics laboratory sub- A handbook of laboratory sheets for use by stu-
ject in which students performed "pen and paper" dents in the Maple sessions has now been prepared
calculations. The first year of the mathematics de- in two parts with one part for each semester. The
gree programme is a traditional one that covers the handbook has been published by the Department
areas of analysis, linear algebra and applied mathe- of Mathematics as part of the RMIT Lecture Notes
matics (mathematical modelling). Presentation of in Mathematics Series [3,4]. (These handbooks re-
the material has always been in the form of small flect the high quality of the lecture note series in
classes that are typically a combination of lecture general and provide excellent resources to the stu-
and tutorial. However, in support of the theoreti- dent at a modest cost.) Each laboratory sheet in-
cal presentations, a formal component of the course cludes:
involves students attending the mathematics labo-
ratory sessions. In these, staff assistance can be
obtained while the students attempt problems re- • a statement of the aims of the session;
lated to work recently covered in lectures.
• a review of the mathematical background for
The five core subjects and one laboratory subject the session;
in the first year of the mathematics degree course
are given in Table 1. All of these are year-long • worked examples;
subjects taken over two 13-week semesters. In
addition to the core subjects, there are also four • student exercises;
hours per week of non-mathematics elective sub-
• the syntax of the Maple commands to be
jects. The mathematics laboratory subject MA192
used;
was designed to develop the students' problem-
solving skills with problems being drawn from the
• a report sheet.
four core mathematics subjects (MAlll, MA212,
MA532 and MA533). Only one of the two contact
hours for MA192 is now devoted to solving prob- A shortened version of the laboratory sheet for the
lems by the traditional pen and paper methods. session on Polar Coordinates is given as an exam-
The other contact hour is taken up by a weekly ple in Appendix A. (The Maple command syntax
Maple Laboratory Session. and report sheet are omitted in this version.)
72
Table 1: Core subjects in first year.
73
Table 2: List of first-year topics available as Maple laboratories.
Subject Topics
Maple Introduction
Variables and functions
Analysis Inequalities
Composition of functions
Limits
Differentiation
Riemann sums
Non-linear equations
Integration
Polar coordinates
Functions of two real variables
Sequences and series
Linear Algebra Spanning sets
Vectors
Matrices
Linear transformations
Inner product spaces
Eigenvalues and eigenvectors;
diagonalization
Applications of diagonalization
of matrices
Mathematical Methods Differential equations
and Models Particle motion
Phase plots
Resonance
74
mathematics degree course. The same style of lab- Macintosh SE Laboratory when it is not being used
oratory session is nevertheless followed. The cur- for classes. As these students are in the third year
rent availability of Maple on only a small number of of an engineering or physics degree course, they
machines for a large number of students is clearly have much more experience in computer program-
a problem from the point of view of conducting ming and the use of computer software packages
supervised laboratory sessions. than first-year mathematics students.
Maple laboratory sessions for MA004 cover the fol-
3.2 Differential Equations A lowing topics:
75
3. What, in your opinion, are the three most way in which this enabled them to visualize solu-
important things you have learned from tions of differential equations. This is illustrated in
using Maple in DEB? the answer to Question 1 by Student A and in the
comment by another student that 'seeing in three
A broad categorization of the respondents is that dimensions the graphical output of heat equations'
nine were 'positive', i.e. they found Maple useful was one of the three most important things learned
in helping to learn the subject, and the remaining from using Maple. Seven of the eleven respon-
two were 'negative', i.e. they did not find Maple dents to the questionnaire mentioned this aspect
useful. The answers of a typical 'positive' respon- of Maple as a positive feature. Four of the respon-
dent (Student A) and of a 'negative' respondent dents did not answer Question 2 and two others
(Student B) to the three questions are reproduced made only brief comments to the effect that the
in full below. package was not very 'user friendly' (see also the
response of Student B given above). Others, how-
Student A
ever I had deeper specific criticisms in response to
1. Visualizing the series and graphical solution Question 2. For example,
of the boundary-value problems; understand-
ing the steps used in deriving the Fourier co- Perhaps try to tie the Maple commands
efficients. more in with the lectures, but keep the
assignments and examples.
2. The process of producing the program output
is not necessarily time consuming. However,
getting these printed (when many people are and
on the system) can be. One suggestion-
someone from the Mathematics Department Sometimes the Maple exercises are so
needs to assist the computer staff with Maple easy to do because you just had to copy
printing. the worked examples (maybe change a
few things), so at times like that we
3. (a) Using another or alternative computer weren't really thinking about the prob-
package to 'Mathematica'. lem on our own.
(b) To visualize particular senes expan-
sions. Both of these students were positive about using
(c) Being able to solve 'long-winded' Maple, however. Their answers to Question 1 were
boundary-value problems.
76
Analysis of Student Performance ment. Its effectiveness in terms of students' perfor-
The assignment requirements were not only to pro- mance and understanding needs to be further eval-
duce numerical answers or graphical output but uated. It will be useful to carry out evaluations of
also to give a physical interpretation or commen- other subjects along the lines of that already dis-
tary on the results obtained. Most students did the cussed for the subject MA004.
assignments very well. Approximately 84% of the
students achieved a total mark of 15 or greater out
of 20 for the three assignments combined. Only 4.2 New Laboratory
5% of students achieved a mark of less than 10 The large numbers enrolled in service courses is
out of 20. Many students sought advice from the a major difficulty with attempting to introduce
lecturer, particularly for Assignment 1. The chief Maple. However the department has recently ac-
request was for clarification of technical details of quired new accommodation that includes a labo-
Maple commands. Many students obtained their ratory with approximately fifty 486 machines each
own copy of Maple for use on their own comput- running Maple under the Windows environment.
ers. A few students went to extraordinary lengths This should also have an impact on perceptions
in producing graphical output for the assignments of "user friendliness" of Maple. We look forward
and this was accompanied by commentaries and to the opportunity to exploit this in introducing
interpretations that indicated an excellent under- Maple in service mathematics where the provision
standing of the subject matter. These students of more realistic examples has always been a prob-
were also among the top performers in the exami- lem. Furthermore, we intend to schedule super-
nation. vised classes in this new laboratory for all students.
The pass rate for MA004 in 1993 was 80%. This
The fact that some students have their own copy
compares with pass rates of 74% and 70% in 1992 also assists the introduction of Maple to these
and 1991 respectively. Of course not too much can
courses. We are happier suggesting students con-
be read into one year's figures but it is at least
sider such a purchase once a full version is readily
clear that the introduction of Maple has not had a available on the RMIT campus.
detrimental effect on student learning in this sub-
ject. On the contrary, there is evidence from the
answers to the examination questions that some 5 Conclusion
common misconceptions held by students in the
past have to a large extent been eliminated by the Maple has been successfully introduced into a va-
use of Maple. For example, egregious errors in the riety of mathematics programmes covering a wide
manipulation of infinite series solutions of partial range of topics offered at RMIT. Supporting ma-
differential equations were almost entirely absent. terial in the form of laboratory sheets provides a
It is significant that an understanding of such ma- useful student resource in understanding the math-
nipulations was necessary in all three assignments ematics and the implementation of the Maple ma-
in order to be able to use Maple to produce the terial.
required solutions and graphs. This argument is The introduction of Maple to the mathematics
supported by the comment of one student, already teaching programme has helped to put into fo-
quoted above, that 'the preparation for the assign- cus the mathematically important elements of the
ments where we had to look through the lecture mathematics curriculum. There is an opportunity
notes to understand the solution process of the as- to delineate precisely the core mathematical ideas
signment' was an aspect of the use of Maple that needed to be presented in a course without the
helped the understanding of topics in this subject. added distractions of routine methods getting in
the way of understanding any new material be-
4 Planned Developments ing presented. Too often students are labouring
in their grasp of new topics simply because of their
4.1 Evaluation lack of technical expertise in material covered at
The integration of Maple into our undergraduate an earlier stage (often before they arrive at the ter-
programmes is still in its early stages of develop- tiary level).
77
Students participating in the programme have en- (a) if the equation is invariant under the sub-
joyed the experience and have responded in posi- stitution (r,O) --+ (r, -0), then the curve is
tive ways. Many use Maple to solve problems in symmetric about the initial line;
other subjects they are currently studying. This
(b) if the equation is invariant under the substi-
develops further the use of Maple in the entire
tution (r,O) --+ (r,7I'- 0), then the curve is
mathematics curriculum at RMIT.
symmetric about the straight line 0 = ~71' -
this is the straight line through the origin and
References perpendicular to the initial line;
[1] Stewart, J. Calculus, 2nd ed., Belmont Califor- (c) if the equation is invariant under the sub-
nia, Brookes/Cole, 1991. stitution (r, 0) --+ (-r, 0) or the substitution
(r,O) --+ (r, 0+ 71'), then the curve is symmet-
[2] Bauldry, W. C., & Fielder, J. R. Calculus ric about the origin.
Laboratories with Maple, Belmont California,
Brookes/Cole, 1991. Points of intersection of two curves defined by po-
[3] Connell, H. J., Fitz-Gerald, G. F., Healy, W. P. lar equations are obtained by solving the equations
and Luo, Y. S. Maple Laboratory Sessions Part simultaneously for rand O. However, this method
1, RMIT Lecture Note in Mathematics, Mel- may not give all points of intersection, since some
bourne, Mathematics Department RMIT, 1993. points of intersection may have to be represented
by two different sets of polar coordinates in order
[4] Connell, H. J., Fitz-Gerald, G. F., Healy, W. P. to satisfy the two equations. In these cases, it is
and Luo, Y. S. Maple Laboratory Sessions Part often necessary to transform the polar equation of
2, RMIT Lecture Note in Mathematics, Mel- one of the curves. In general, it is useful to sketch
bourne, Mathematics Department RMIT, 1993. the two curves on the same diagram to ensure that
all points of intersection have been located.
78
We know from lectures that the equation r = intersection of the cardioid and the parabola are
2a cos B represents a circle that passes through the (1, ±t1l") and that the two curves touch at these
origin, has radius a and has a diameter along the points.
initial line. (Note also that since cos B is even in
(), the graph must be symmetric about the initial 4 Exercises 1
line.) The curve produced by Maple, however, is
distorted and does not look like a circle. To rectify 1. For each of the following polar equations,
this, we can specify horizontal and vertical ranges
(for the Cartesian coordinates x and y) to ensure (i) use the plot command to sketch the
that the aspect ratio of the graph is the same as curve;
that of the screen. The aspect ratio is the ratio of (ii) state the symmetries, if any, the curve
the width to the height and for Macintosh screen possesses;
this is about 1.5. In the following plot command,
(iii) explain how the symmetries can be in-
the horizontal and vertical ranges are -3 .. 3 and
ferred from the polar equation.
-2 .. 2 respectively. This gives an aspect ratio of
6/4 or 1.5 and the curve obtained does look like (a) r = 3 - 2 cos B (lima<;on without a
a circle when the plot window is 'maximized' to loop)
occupy the entire screen. We also use the 'title'
option to give the graph a name that will appear (b) r = 1 + 2sin B (lima<;on with a loop)
in the plot window.
2. (a) Sketch the 4-leaved rose r = 4 sin 2B and
the circle r = 4 in the same window.
• plot([2*cos(t), t, t = 0 .. Pi], -3 .. 3, -2 .. 2,
coords = polar, (b) Find all points of intersection of the two
title = 'Example 1- Circle'); curves.
79
obtain the solution of 0.28 = 1/(2 - cos 8) in this (ii) Note that the four-leaved rose is sym-
intprval metric about the origin and can also be
represented by the polar equation -r =
• fsolve(0.2*t = 1/(2 - cos(t)) ,t, Pi/2 .. Pi); cos 28, although its petals will now be
2.039428915 traced out in a different order as 8 in-
creases from 0 to 21T. Plot r = - cos 28
The corresponding value of r is then obtained by and r = 1 - cos 8 for ~1T < 8 < ~1T
substitution. The right-hand side of either equa- only and then use fsolve to find polar
tion can be used but here it is easier to use r = 0.28. coordinates for this point of intersection
correct to 3 decimal places.
.4078857830
G. F. Fitz-Gerald (rmag{@minyos.xx.rmit.edu.au)
is a Senior Lecturer in the Mathematics Depart-
Polar coordinates for the point of intersection are
ment at RMIT. He holds a B. Sc.(Hons.) and Ph.
therefore (0.408,2.039) correct to 3 decimal places.
D. degrees in Applied Mathematics from the Uni-
versity of Western Australia. His main research
6 Exercises 2 interests include water gravity waves and the use
(a) Sketch the 4-leaved rose r = cos 28 and the of mathematical methods to solve applied problems
cardioid r = 1 - cos 8 in the same window. arising in applications. Such applications have re-
cently included bluff-body aerodynamic flows, elec-
(b) Your graphs should show that there are seven tromagnetic wave propagation and aero-acoustics.
points of intersection. Polar coordinates for He has been particularly interested in the teaching
three of these points can be read directly from of service mathematics and is the coordinator of all
the graphs. What are they? higher year service mathematics at RMIT. The in-
(c) Of the other four points of intersection, two troduction and use of symbolic computation pack-
are in the first quadrant and the other two ages (such as Maple) into the teaching programme
are reflections of these in the initial line. It at RMIT is another of his interests.
is therefore sufficient to determine the polar
coordinates of the two points of intersection W. P. Healy (rmalh@minyos.xx.rmit.edu.au) is a
in the first quadrant. One of these two points Senior Lecturer in the Department of Mathemat-
appears to have a 8 coordinate in the interval ics at RMIT. He received a B. Sc.(Hons.) degree
(0, ~1T). in Applied Mathematics from North-East London
Polytechnic in 1972, a Ph. D. from University Col-
(i) Plot r =. cos 28 and r = 1 - cos () for lege London in 1975 and a Graduate Diploma in
o < 8 < ~1T only. Computing Studies from the University of Mel-
(ii) Using fsolve, find polar coordinates for bourne in 1991. Prior to joining RMIT as a Lec-
this point of intersection correct to 3 turer in 1982 he was a Postdoctoral Research Fel-
decimal places. low for four years and a Lecturer for four years
and a Lecturer for two years at the Australian Na-
(d) The other point of intersection in the first
tional University, Canberra. His research interests
quadrant appears to have a 8 coordinate in
are chiefly in Quantum Electrodynamics. He is the
the interval (~1T, ~1T). However, using fsolve
author of a book "Non-Relativistic Quantum Elec-
to try to find a solution of cos 28 = 1 - cos 8
trodynamics" (Academic Press, London, 1982) and
in this interval produces a null result.
has published more than twenty research papers.
(i) Explain this null result by plotting r = His teaching interests are in undergraduate Pure
cos 28 and r = I-cos 8 for ~1T < 8 < ~1T and Applied Mathematics, Engineering Mathemat-
only. (Note that cos 28 is negative on ics and pedagogical uses of symbolic manipulation
this interval.) packages.
80
lIB. MAPLE IN SCIENCE
ANALYTICAL APPROACHES TO SOLVING COUPLED
NONLINEAR SCHROEDINGER EQUATIONS USING MAPLE V
(CNLS) equations involving highly oscillatory Solitons are nonlinear pulses that
terms attracts great current interest owing to propagate without dispersion in the
both its fundamental meaning and potential anomalous dispersion regime of single-mode
have used Maple V in solving the problem of group-velocity dispersion and self-phase
paper describing the main features of this solitons in these fibers and can be described
been done in the past in the investigation of intermodal dispersion and can be coupled
1
nonlinear processes in optical fibers. ,2 together through the Kerr effect. The
Propagation of soliton pulses as information coupling between the two polarization modes
attracted a great deal of interest since it was can be regarded as an important effect, since
83
The interaction between the two Variational analysis of eNLS equations
fiber may be described by a system of birefringent optical fiber with two distinct
equations and it gives rise to a large number velocity dispersion regime is governed by a
6
of schemes for making all-optical switches. system of CNLS equations
equations are reduced to a Lagrangian u(z,t) = v(z,t) and v = v(z,t) are the slowly
problem when solitons are considered as varying wave envelopes of the slow and fast
formulation, a set of ordinary differential velocities of the two modes. We assume that
equations (ODE's) for various soliton the fiber is lossless. The highly oscillatory
84
K
this leads to polarization instability [6] - [7]. ---secht, (4)
V1 + f
These equations without the highly
I
u(z,t) = v(z,t) = 'I/J(z,t)
u(O,t) = -
A
secht, (2a) VI + f
.fi
2( /"2
-""-- exp(2i,> z)sech(2(t) (5)
v(O,t) = -
A secht. (2b) V1 + f
.fi
(3)
We assume that the above results are also
and, when applied to the Cauchy problem coupled NLS equations (Ia) - (Ib) using a
1"(1)
u(O,t) = v(O,t)
f J
[l)
8 Ldzdt = o. (7)
-m -m
_ 1 _ 'I/J(O,t)
VI + f
85
The Lagrangian, L is given by soliton-form ansatz for the polarization
components:
. Ov* Ov
+ ':'(v::r
2 uz
- v* ::r)
uz
obtain
86
and x
r
= 2(r (t - e),r r = 1,2.
1 Using the Euler-Lagrange equations,
(1 + t)
a coupled system of eight ODE's for the
(ll) de r
(r -dz r + (-1) 8(r - 2j.L (
r r
where
1 iR8z
+ 8" e
a
7Jji: <
L2
uv>
r
1 -iRbz
+-e ~<
a L3
>= 0' (12)
8 Uj.L uv
r
d
+ ;rr-
a 1
- 8 Dd j.L ( )
z r r u"-_ <Luv >r
+e
iR8z a
;rr-<
£2
>
U"-_r uv
8 £3
+ e -iRCz ;rr-
u"-_ < uv > = 0, (13)
r
87
a <£3 > =
+ -41 e-iROz "!r.:- 0, (14) and is calculated from soliton
ull uv
r
phenomenology. The formula for the
-1/2 ,
+0 • 26£ u. (16)
J1-r -iROz a £3
- 4[ e (Jjj: < uv>
r r
Our calculated values of the threshold
1 a £1
+ -;:v-<
1 iR&
>+-e ;:v-
a amplitude by formula (16) was found to
4 v~_ uv 4 v~_
r r depend nonlinearly on birefringence.
These ODE's give a criterion for the two 1. V.E. Zakharov and A.B. Shabat, Sov.
nonlinearity of the medium makes it possible 2. A. Hasegawa and F. Tappert, Appl. Phys.
together above threshold amplitude through 3. L.F. Mollenauer, R.H. Stolen and J.P.
their effective interaction. This threshold Gordon, Phys. Rev. Lett. 45, 1095(1980).
varies with the birefringence parameter, 0 4. D. Glage, Appl. Opt. 10, 2252(1971).
88
5. D. Anderson, M. Lisak, and T. Reichel,
392(1988).
89
SOLUTION OF THE SOLAR CELL TRANSPORT EQUATIONS
USING MAPLE
*
can be considered the starting point in most device
In its simplest form the transport equation is a analysis.'
second order linear ordinary differential equation with
well known general solutions. Maple can easily solve Light
this equation and even apply simple boundary
conditions. However, solar cells can have unusual -W n - - - - - - - - - - -
boundary conditions that often cannot be easily n type
applied. In either case, once a solution is found, it -Xn - - - -
may be several pages in length and difficult to put
into an intelligible form. 0---------
Wp - - - - - - - - - -
x
Figure 1. Solar Cell configuration
90
The configuration is shown in figure 1. Light is Dark Cell Solution
incident on the surface at -Wnon a cell that is Wp +
Wn thick. The pn junction is at x =
0 and the p region
depletion region is Xp + Xn thick. The steady state
minority carrier diffusion equations and associated The equations for a dark cell are identical to those
boundary conditions are: of a regular pn junction. Since there is no light, G =0
and the minority diffusion equation in the p region
p region (xp < x < Wp) reduces to:
2
d ~ np(x) ~ np(x) Goe·ClX f1 :=diff(dnp(x),x$2)-dnp(x)/Ln"2=0;
d x2 • -Ln-2- = Dn
dn,,( JJ,t J
fl :=(l..dnp(X»)- dnp(x) =0
~ np(xp) =
ax 2 Ln 2
~) J
d 2A£.1pn(x) _ A
~ _ Goe -ClX
d X2 Lp2 - Dp
bel :=dnp(XPl=dnpo(.(
91
dnpx:=rhs(f2): n region
In addition the assume command must be used to The minority carrier diffusion equation for the n
inform Maple of the sign of Ln. This is necessary so region of a dark cell (G =0) is:
that Maple can determine if exp(-Wp/Ln) is 0 or
undefined. The limit will return unevaluated if f3:=diff(dpn(x),x$2)-dpn(x)lLpA2=O;
assume is not included.
a2
f3:= -dpn(x) -
J dpn(x)
0
assume(Ln>O): ( ax 2 Lp2
dnpx:=simplify(limit(dnpx,Wp=infinity);
The boundary condition at the edge of the depletion
~) J (-
( ( Vt
P region (-xn) is comparable to bel. However, there is
X-X )
Ln- little sense in inserting such a long constant so soon in
dnpx := dnpo e - I e the calculations. We can use Cdpn for now and
substitute the actual expression {dpno*[exp(VNt)-
Ln- is Maple's notation that this result was I]} later. Another advantage is that this constant will
computed using an assumption on Ln. It is now a not be converted into trig form in later manipulations
simple matter to compute the current density due to so that the final expression will be simpler.
electrons and evaluate it at x =xp:
bc3:= dpn(-xn)=Cdpn;
Jnx:=q*Dn*diff(dnpx,x):
Jnxp:=simplify(subs(x=xp,Jnx»;
bc3 := dpn( -xn ) =Cdpn
bc4:=D(dpn)(-Wn)=Sp/Dp*dpn(-Wn);
Maple cannot completely evaluate this boundary condition in one step and additional commands will be
necessary.
f4:=dsolve({f3,bc3,bc4},dpn(x));
(
( Wn ) ( ) ~ J (~)
f4 '= dpn(x) = Cdpn e Lp Dp + Sp dpn( -Wn) e Lp Lp e Lp
Note that dpn(x) contains a dpn(-Wn). We can evaluate dpn(-Wn) by substituting oWn for x and solving for
dpn(-Wn). If dpn(-Wn) is then defined to be that expression, further references to f4 will include the evaluated
dpn(-Wn).
dpn(-Wn):=solve(subs(x=-Wn,f4),dpn(-Wn»:
92
In its present fonn f4 is a very long and complicated expression and will not be shown here. To simplify f4
we use convert to put it into trig fonn and then we can use combine to gather the trig tenns. It is also necessary
to use simplify after each of these commands to get the simplest expression.
f4a:=simplify(convert(f4,trig)):
f4b:=simplify(combine(f4a,trig)):
dpnx:=rhs(f4b);
Jwn+x) . (wn+x))
d nx'- Cdpn ( Dp cos,\ Lp + Sp Lp smh Lp
p.- Jwn-xn) .nJwn-xn)
Dp cos'\ Lp + Sp Lp ShU\ Lp
If we had not taken the precaution of substituting Cdpn for dpno*[exp(VNt)-l] Maple would have also
converted it to trig fonn and created a very long expression.
Now we can compute the current density due to holes and evaluate it at -xn.
Jpx:=-q*Dp*diff(dpnx,x):
Jpxn:=simplify(subs(x=-xn,Jpx));
Jpxn:=subs(Cdpn=dpno*(exp(VNt)-1 ),Jpxn);
Jpxn :=-
q Dp dpno el((~) ]( - 1
Wn -xn
{ )
.nJwn-xn)
Dp ShU\ Lp
.
JWn-xn))
+ Sp cos,'\. Lp Lp
n{UT))
nn -xn
Lp ( Dp cos Lp + Sp Lp S1 Lp
Jp(-xn) is more complicated than In(xp) because of the different boundary conditions. However, it is easy to
show that the expressions are comparable if we make the comparable assumption that Wn is essentially at
infinity.
assume(Lp>O):
Iimit(Jpxn,Wn=infinity):
This simpler fonn of Jp(-xn) added to In(xp) is known as the ideal diode equation. 2
93
Illuminated Cell Solution
The boundary conditions are the same as for the dark + C3 e(-a Wp) =0
cell and will not be repeated here.
From our experience with the dark cell we can C1 a:=simplify(solve(",C1 ));
guess that the solution is of the form:
P
CIa:= _ C2 cos{ WpL:x )+C3 e (-a Wp)
dnpx:=C1 *sinh((x-xp)/Ln)+C2*cosh((x-xp)/Ln)+
C3*exp(-a*x); P
sm{W1£:x )
dnpx:=
CIa is the only term with a Wp. Since we are
interested in the solution when Wp is infinite it is
Cl sm{ x ~:p ) + C2 cos{ x ~:p ) + C3 e( -a x) enough to evaluate CIa at Wp = infinity. This time it
is necessary to make an assumption about both Ln
and a.
If this is actually a solution it should solve the
original differential equation. assume(Ln>O): assume(a>O):
94
a:='a': Ln:='Ln': If this is actually a solution it should solve the
original differential equation.
Jnxp:=expand(subs(x=xp,Jnx));
subs(dpn(x)=dpnx,f6):
qDn C3a
(a xp) C6a:=simplify(solve(",C6));
e
Go q D n L ne
(-axp)
qDndnpoU~)J C4a:=
(Ln a+ l)Dp Ln
C5 Sin{ W~;xn )DP + C6 a e(a Wn) Lp Dp
D region
cos{ wn ; xn ) Dp + Sp Sinh( Wn ; xn ) Lp
L L
The minority carrier diffusion equation for the n
region of an illuminated cell is: wn-xn) (aWn)
+ Sp C5 cosh( Lp Lp + Sp C6 e Lp
f6:=diff(dpn(x),x$2)-dpn(x)/LpI'2=
-Go*exp(-a*x)/Dp;
cos{ Wn ; xn ) Dp + Sp Sin{
L
W~; xn ) Lp
f6 .-(:i.d
.-
( )] dpn(x)
po x -
Go e(-a x)
------
Often Sp is not known and we are interested in the
solution when Sp =0 and Sp =infinity.
ax
2 Lp2 Dp
C4SpO:=limit(C4a,Sp=O);
The boundary conditions are the same as for the dark
cell. We can guess that the solution is of the form:
. C5Sm{w~;xn)+C6a/awn)Lp
dpnx:=C4*sinh«x+xn)/Lp)+C5*cosh«x+xn)/Lp)+
C4SpO .= { DT
"n-xn )
C6*exp(-a*x);
cos Lp
dpnx:=
C4Spi:=limit(C4a,Sp=infinity);
_J -r;- J x + xn )
C4 situ'\.
x + xn )
+ C5 cos,'\. -r;- + C6 e
( -a x)
. C5 cos{ WnL;xn )+ C6 e(a Wn)
C4SPl := n{ DT
"n-xn )
95
The current density due to holes evaluated at x = -xn Very few commands were needed to find these
is: solutions. However, many commands are useless
unless they are combined with others. A good
Jpx:=-q*Dp*diff(dpnx,x): example of this is the necessity of using "assume"
before taking a limit. Other commands that work
Jpxn:=expand(subs(x=-xn,Jpx)); together are convert and combine. In turn these
commands should be followed with simplify, expand
C4 D C6 (a xn) or collect in some sequence. Often it is necessary to
Jpxn := • q Dp
Lp + q 'P ae try several possibilities before the simplest form is
reached.
For the special case of Sp =0, Jp(-xn) can be found
as follows: References
C4:=C4SpO: C5:=C5a: Jpa:=collect(Jpxn,C6): 1. Pierret, Robert F., Semiconductor Fundamentals
2nd edition, Addison-Wesley Publishing Co.
C6:=C6a: Cdpn:=dpno*(exp(VNt)-1): 1988 88-92
Conclusion Biographies
Two differential equations were solved with three Randy T. Dorn received his B.S. in Electrical
different boundary conditions. We used Maple's Engineering from the University of Nebraska-Lincoln
"dsolve" to find the solution to the homogenous in 1992. He is currently a graduate student at the
differential equations fl and n. However, additional same institution. Interests include solar cells,
commands were required to complete the application electronic devices and computer assisted symbolic
of the boundary conditions. We were able to insert computations. Email: rrnrtd@engvms.unl.edu
the mathematical form of the boundary condition for
be I at the very beginning because of the simplicity of Dr. R. J. Soukup received his B.S., M.S., and Ph.D.
bc2. If we had tried to do the same with be3 Maple degrees all in Electrical Engineering, all from the
would have converted the exponential term into trig University of Minnesota. He worked for Sperry
form and the solution would have become very RandlUnivac (now Unisys) for three years before
complicated. Since we took special precautions the joining the faculty of the University of Iowa as an
final solution contained both exponential and Assistant Professor in 1972. In 1976 he moved to the
trigonometric functions. University of Nebraska as an Associate Professor.
He became Chairman of the Department of Electrical
Maple's dsolve could also have been used to find a Engineering there in 1978, a position he still holds,
solution for the nonhomogeneous differential and was promoted to Professor in 1980. He is a
equations f5 and f6. However, dsolve typically uses Fellow of the IEEE, a member of ASEE, a member of
exponentials exclusively and the solution would not the AVS, a member of and a past President of
have contained the mixed trig and exponential forms NEEDHA and President of CSEEDHA. His research
that we desire. This would cause the solution to be is in solar cells. Email: eerdrjs@engvms.unl.edu
very long and complicated. By making an
appropriate guess of the solution and then solving for
the constants we were able to keep the mathematics
manageable.
96
KRAMERS AND WANNIER V-MATRICES FOR THE
PARTITION FUNCTIONS OF THE ISING MODEL
97
and the one including Un at the next position be reversing all the signs of one, the other can be
given by obtained. Define the parameters
98
A clearer picture of a typical 2-d V-matrix in the
'tV 1 000 o 0 0 =
class (J /I 1 has t IH' followill!!, 1'01'111 for /I 4. =
o 0 w 1 0 000
o 0 000 o t 1 > uV:=d2upvmat(4,s,t);
Ml:=
o 0 o 0 t 100
o 0 o 0 Ii' 100 s 1 0 0 0 0 0 0
o 0 000 Owl 0 0 s 1 0 0 0 0
o 0 t 1 0 000 0 () 0 0 s 1 0 0
t 1 000 000 () 0 0 0 0 0 s 1
uF:=
The V-mat.rix is t.he one used in t.he PF com- 0 0 0 0 0 0 t 1
put.at.ion not the matrix .'\-1, One can build t.he 0 0 0 0 t 1 0 0
V-mat.rix direct.ly or apply a transformation to 0 0 t 1 0 0 0 0
accomplish it., The latter case is adopted, The t 1 0 0 0 0 0 0
transformation is defined as
Three const.ants are ext.ract.ed from the V-matrix
(3) t.o compute the PF. FOl' n = 3, these const.ants
are:
where I is the identity matrix of order 2" -I, It.
is given by the program below. > uO:=evalm(U_O);
"o~ [ !
#the order of the matrix 0
~1
nl:=2~n; 0
Hl:=array(identity,l, .nl/2,1 .. nl/2); 0 1
H2:=evalm(-array(identity,1, ,nl/2, 0 0
1. . n1/2» ; 0 0 0
H:=copyinto(H2,stack(augment(Hl,Hl),
augment(Hl,Hl»,nl/2+1,nl/2+1); > ul:=evalm(U_l);
end:
For n = 3,
"l~ ~
the transformation looks like this: 1 0
~]
> H:=d2stmat(3); 0 0
[ 0 0
10001000 1 0
01000100
00100010 > u2:=evalm(U_2);
,- 00010001
H .-
1 0 0 0 -1 0 0 0
o 1 0 0 0 -1 0 0
,) ,_
0000]
0 0 0 0
o 0 1 0 0 0 -1 0 Ii_.- 0 0 1 0
o 0 0 1 0 0 0 -1 [
1 000
Then performing the following operations t.he
two matrices in the upper left and in the lower The lIext. section discusses t.he 3-d computation
right are defined to be t.he V-mat.rices in t.he two of t.he V-mat.rix.
classes, (J" = 1 and (J" = -1.
> V:=evalm(d2stmat(3)&*d2cvmat(3,r,s) 3 3-D Kramers and Wan-
&*inverse(d2stmat(3»);
nier V-matrix.
l' 1 0 0 o 0 o 0
o o ./. 1 o 0 o 0 The 3-el V-mat.rix is much 1Il0re complex than
o o s 1 o 0 o 0 t.he 2-d '·-lIlatrix. To build t.lle 3-d ferromag-
\/.- s 1 0 0 o 0 o 0 Ilet. 011(' lIlay hav!' to 1'011011" tlH' advice of Oguchi
o o 0 0 /. 1 o 0 [2]. He shOlw'<! thar rl1(' sal Ill' approach of t.he
o o 0 0 o 0 l' 1 screw Illet hod ("all 1)(' applied t.o evaluat.e t.he PF
o 000 o 0 -s -1 of t.he Ising modd 011 a cubic lat.t.ice. This ap-
o o 0 0 -s -1 o 0 proach adds spillS one by aile. For t.he simple
99
cubic lattice, it can be divided into many lay- fi;
ers. Then starting from an arbitrary first posi- nl:=2"n/2; k:=round«n-3)/2);
tion, add a spin beyond the one just placed pre- if n<3 then
viously. This construction is continued until a full ERRORC'n must be 3 or greater');
line is arranged. The next line is then arranged in fi;
the same sequence until the whole arrangement if n >=3 then
is completed. Then moving to the first position jl:=n-2-k;
in the next layer the same process is repeated. nb:=2"k;
Consider the 1Hth layer, if the kth spin is added fi;
next, then since the interactions are restricted to #compute the needed matrices.
only nearest neighbors, only the (k - 1) th, the P:=matrixC2"Cjl-l) ,2"jl, []):
jth placed immediately beside it in a preceding #the constant matrix UO
line and Oth spin placed just under the kth spin for i to 2"Cjl-l) do
in the (11), - 1)th layer interact with it. Assume for j to 2"jl do
that each spin has two orientations 17; = ±1. The if j=2*i-l then P[i,j] :=a"3:
t
interaction energies are =f J for parallel and an- elif j=2*i then P[i,j] :=a:
tiparallel spins respectively. Thus the three in- else P[i,j] :=0:
teractions stated above are: fi:
od:
od:
Q:=matrixC2"Cjl-l),2"jl,[]):
Again I .... is defined as l\' = J InT. Let the ar- for i to 2"Cjl-l) do
rangement 17k-I, ... ,l7j-I, ... ,170 have the proba- for j to 2"jl do
bility A(17k_I, ... ,l7j_I, ... ,I70). The probability if j=2*i-l then Q[i,j] :=a:
A( 17k, ... , 17 j, ... , 171 ) is the one in which 171 occupies elif j=2*i then Q[i ,j] :=b:
the place of 170, 172 takes the place of 171 etc. Then else Q[i,j] :=0:
by Boltzmann's theorem, the probability of any fi:
particular arrangement of spins is proportional od:
to exp( - E I kT) because every arrangement has od:
weight 1. Hence one obtains R:=matrixC2-Cjl-l),2"jl,[]):
100
V:=copyinto(Q,V,2~(jl-l)*(2*i-l)+1, The proof, using matrix theory, consists of
2"jl*(2*i-l)+1) ; proving the fact that for sufficiently high temper-
V:=copyinto(R,V,nl/2+2"(jl-l)*2*(i-l)+ ature. the maximum characteristic value of the
1,nl-2"jl*(2*i-l)+1) ; matrix /\;1(K) uo louger degenerates. For suffi-
V:=copyinto(S,V,nl/2+2~(jl-1)*(2*i-l)+ ciently high temperature, we have
1,nl-2"jl*2*i+l) ;
od; .J
JiUI -- -t ().
I-IX 2I.'T
end; Heucl' k = .JJUT -t O. so
(:'/, =0 = 1 =;3=(:'-/'.
Set. a = =
e /, and I) e -/,'; t.hese are used as de-
fault paramet.ers for the 3-d V-matrices. Again Now usiug our funct.ion d2'1/.]nrmat and for n = 3,
as in 2-d case, one can override these elements one can generate the matrix
by substituting any suitable elements. For con- > V+(O):= d2upvrnat(3,1,1);
venience we have used the symbols (/. and b. Let
P. Q, R. S, be the block matrices in the example
(~~(°1~0
below each of dimension 1 x 2. Then a typical
member of the upper V-matrix iu 3-d is shown F + (0):= 0011 011]
below as [
>d3upvrnat(4,a,b);
In the same way Ilsiug our function d2lnllTnat,
=
and for 11 3, the mat.rix
(13 0 0 0 0 0
(/. 0 > V-(O) :=d21nvrnat(3,1,1);
0 0 (I b 0 0 0 0
0 0 0 0 (13 0
(l 0 o
~
1
0 0 0 0 0 0 a b o 1
0 0 0 0 0 0 b3 b 11 - (0):= [
o -1
0 0 0 0 0
b:J b
b (/ 0 -1 -1 o
0 0 0 () 0 0
b (l 0 0 0 0 () () nUl })(' g('lIerat('(1. H('IT. WI' an' dealiug with a
fiuitl' probieul for which the Imit.rices are of order
A typical member of the lower 3-d V-matrix is 21' wherl' ,. is a Jlositive iutegeL Thus raisiug the
also shown below as matrices \ . + (0) allll \. - (0) to tht' second power
one obtaius
>d31nvrnat(4,a,b);
> evalrn(V+(O) "2) ;
i]
(13 0
(I 0 0 0 0 0 1 1
0 0 a b 0 0 0 0 1 1
0 0 0 0 (13 a 0 0 IV + (O)'= [ ; 1 1
0 0 0 0 0 0 a b 1 1
0 0 0 0 0 0 _b 3 -b
0 0 0 0 -b -(/ 0 0 aud
0 0 _b:J -b 0 0 0 ()
> evalrn(V-(O)-2);
-b -a 0 0 0 0 0 0
1 1
As in the 2-d case, the constant matrices
needed for one t.o compute the PF can be eas-
ily extracted.
11 _ (0)2 := [ ~ 1 -1
1
-1
1 ~1 ]
-1 -1 - 1 -1
As an application in t.his paper, we demon-
strate that an order-disorder transition takes This shows that the matrices are of order 22 .
place between states of tiuite long range order Comput.ing the characterist.ic values of F + (0)2
and those with no long rauge [5]. Due t.o space with t.he help of :\Iap1<'-s eigeuvals fuuct.iou oue
limits matrices of small size are used. gets
101
for j to n1 do end;
if j=2*i-1 then uO[i,j] :=a #Program computes the complete
elif j=2*i then uO[i,j] :=1 #V matrix of Kramers and Wannier
else uO[i,j] :=0 d3lnvmat:= proc(n) local P,Q,a,b
fi; ,R,S,j1,nb,k,V;
od; if nargs=l then
od; a:=exp(K): b:=exp(-K):
u2:=matrix(n1,n1,[]): else
for i to n1 do a:=args[2]; b:=args[3];
for j to n1 do fi;
if j=2*(n1-i)+1 then n1:=2"n/2; k:=round«n-3)/2);
u2[i,j] :=-b if n<3 then
elif j=2*(n1-i)+2 then ERROR('n must be 3 or greater');
u2[i,j] :=-1 fi;
else u2[i,j] :=0 if n >=3 then
fi; j1:=n-2-k;
od; nb:=rk;
od; fi;
fO:=delrows(uO,n1/2+1 .. n1); #compute needed matrices P,Q,R,S.
f2:=delrows(u2,1 .. n1/2); P:=matrix(2~(j1-1),2~j1,[]):
stack(fO,f2); #the constant matrix UO
end; for i to 2-(j1-1) do
#Program computes the the upper for j to 2-jl do
#V matrix of Kramers and Wannier. if j=2*i-1 then P[i,j] :=a~3:
d2upvmat:= proc(n) local c1,c2, elif j=2*i then P[i,j] :=a:
#a,b,fO,f2,uO,u1,u2,n1; else P[i,j] :=0:
if nargs=l then fi:
a:=exp(2*K): b:=exp(-2*K): od:
else od:
a:=args[2]; b:=args[3]; Q:=matrix(2~(j1-1),2-jl,[]):
fi; for i to 2~(j1-1) do
n1:=2~n/2; for j to 2~jl do
uO:=matrix(n1,n1,[]): if j=2*i-1 then Q[i,j] :=a:
for i to n1 do elif j=2*i then Q[i,j] :=b:
for j to n1 do else Q[i,j] :=0:
if j=2*i-1 then uO[i,j] :=a fi:
elif j=2*i then uO[i,j] :=1 od:
else uO[i,j] :=0 od:
fi; R:=matrix(2~(jl-l),2-jl,[]):
od; for i to 2-(jl-l) do
od; for j to 2-jl do
u2:=matrix(n1,n1,[]): if j=2-jl-1-2*(i-l) then
for i to n1 do R[i,j] :=b~3:
for j to n1 do elif j=2~jl-2*(i-1) then
if j=2*(n1-i)+1 then R[i,j] :=b:
u2[i,j] :=b; else
elif j=2*(n1-i)+2 then R[i, j] : =0:
u2[i,j]:=1; fi:
else u2[i,j] :=0; od:
fi; od:
od;od; S:=matrix(2~(j1-1) ,2-jl, []):
fO:=delrows(uO,nl/2+1 .. nl); for i to 2-(jl-l) do
f2:=delrows(u2,1 .. nl/2); for j to 2-jl do
stack(fO,f2); if j=2-jl-1-2*(i-l) then
102
eigenvals(V+(O)-2); reading through the paper and for his important
comments.
0,0,0,4
Similarly the characteristic values of F - (0)2 are Biographies
> eigenvals(V-(O)-2)
Peter Frempong-Mireku is a Doctoral stu-
0,0,0,0 dent at Dalhousie University, Halifax, Nova Sco-
tia, Carmda. He is working on Symbolic Solution
One observes that the maximum characteristic
of the Potts-Ising model. He obtained his MSc in
value of V + (0) is 2 and the rest vanish, while
Mathematics at the University of Saskatchewan.
the characteristic values of V - (0) are all zero.
He also holds MSc degree from Kaluga Pedagog-
This is because the trace of (V + (0)2) is 22 and
ical Institute in Russia, where he had his BSc
that of (V - (0)2) vanishes. From these computa-
degee in },flathematics. He has taught in the Uni-
tions, one gets the following generalization. For
versity of Ghana for three years. His e-mail ad-
any upper V-matrix TV + (0) and lower V-matrix
dress is pfmIQlcs.dal.ca.
TV -(0) of an arbitrary size, there exists a positive
Kevin J. M. Moriarty, graduated from Im-
integer,. such that, since the rank of (HO + (0))"
perial College of Science and Technology, Univer-
and (W - (0)" are one. the characteristic equa-
sity of London, in England. He has taught and
tions reduce to
done research at IlIlperial College, the Deutsches
Elektrollen Synchrotron (DESY) in Hamburg,
Germany. the Interuat.ional Center for Theoret-
The trace of (lV + (0))" is 2", hence the charac- ical Physics (ICTP), in Trieste Italy, CERN in
teristic values of (TV + (0))" are 2", ... ,0, giving Geneva, the Technion-Israel Institute of Tech. in
the maximun characteristic value of HI + (0) to Haifa, Israel. Brookhaven National Laboratory
be 2, and all the rest are 0. However, the trace (BHL) in Long Island. NY., Colorado State Uni-
of (Hl - (0))" is 0. Hence all the characteristic versity in Fort Collins. the Institute of Advanced
values vanish and so are the characteristic values Study in Princeton. He was first Lecturer and
of l'F - (0). This shows that for sufficiently high then reader in Applied Maths. at Royal Holloway
temperature the maximum characteristic value of College of the University of London. In 1983, he
.'\It is non-degenerate. hence it has no long range joined Dalhousie l:niversity. where he is professor
order. The programs are not many so they are of computing Science. In 1990. he was appointed
given in the appendix below. director of the computing sGience at Dalhousie
University. In 1988 he started the Scotia High
End Computing Ltd.. which signed a partnership
4 Conclusion with Alliance Computer Systems of Littlton Mas-
sachusetts, to develop the Scotia Programming
Taking advantage of Maple's built-in functions
Environment and Facility (SPEFY). He is on the
in the linear algebra package it has enabled us to
editorial board of Sc/'entijic Computing.
describe the V-matrix which is used in statisti-
cal physics to comput.e the PF of the Isillg model
by the perturbation method. The V-lllatrix de-
Appendix
scribed here is interesting in its own right. It can
be used in the classroom as a tool in teaching the #Program computes the
screw-like formulation of the Ising 1ll0del prob- #lower negative V matrix
lem forlllulated by Kralllers and Wannier. The d2lnvmat:= proc(n) local cl,c2,a,
computation of the PF is in progress and it may b,uO,ul,u2,fO,f2,nl;
be given in another paper. We are confident that if nargs=l then
in the future we look to a major role for Maple a:=exp(2*K): b:=exp(-2*K):
in statistical physics. else
a:=args[2]; b:=args[3];
Acknowledgements fi;
n1:=2-n/2;
We like to express our appreciation to Dr. uO:=matrix(nl,nl,[]) :
Thomas Trappenberg of Dalhousie University, for for i to nl do
103
S[i,j]:=b:
elif j=2~jl-2*(i-l) then
S[i,j] :=a:
else
S[i,j] :=0:
fi:
od:
od:
V:=matrix(nl,nl,O);
for i from 1 to nb do
V:=copyinto(p,V,(2~(jl-l))*2*
(i-l)+1,2~jl*2*(i-l)+1);
V:=copyinto(Q,V,2~(jl-l)*(2*i-l)+
1,2~jl*(2*i-l)+1);
V:=copyinto(evalm(-R) ,V,nl/2+2~
(jl-l)*2*(i-l)+1,nl-2"jl*(2*i-l)+1);
V:=copyinto(evalm(-S),V,nl/2+2"
(jl-l)*(2*i-l)+1,nl-2"jl*2*i+l);
od;
end;
References
[I] Kramers, R. A. and Wannier, G. R.o Phys.
Rev. 60,252 (1941).
104
IlIA. MAPLE IN ABSTRACT ALGEBRA
FRAC: A MAPLE PACKAGE FOR COMPUTING IN THE
RATIONAL FUNCTION FIELD K(X)
Abstract:
field IK. We want to start motivating this problem
In this paper we present the programs package FRAC (=
through some applications:
Funciones RACionales) which is designed for perform-
The problem of determining algorithmically if an Applying our FRAC code decomposition to the
element f of a class of functions can be represented function f, we get:
as a composition of two "simpler" functions 9 and decomposition(J)=
h in the same class, i.e., such that f =g(h), has
3 x4 - 1 _x 3
attracted interest for a long time, see Ritt(1922)
[x 4 (x - 1)' 1 ± x7 J
from a theoretical point of view or Zippel(1991)
from the computational one. This general problem time 60.35 words 1726942.
f = g(h), where h = 1_x
3
is called the Functional Decomposition Problem. Then, ± x7 and 9 =
Although not every function can be decomposed in 3x 4 - 1
this manner, when such a decomposition does exits x 4 (x - 1)"
many problems become significantly simpler. We 1.2 Polynomial Solving
present the particular case when the class of the
The equation f(x) = 0 can be numerically solved
functions are rational functions over an arbitrary
more efficiently if f is decomposable. In the partic-
ular case when f is a polynomial, it is easier then
to determine if the zeroes of f can be expressed in
terms of radicals. The polynomial decomposition
algorithms (see Kozen and Landau(1989)) are now
supported by all major symbolic algebra systems.
107
For instance, Maple uses the procedure compoly, In order to construct symbolically this lattice, we
which is based on an algorithm by Gutierrez et use the FRAC procedure interm. Moreover, if
al. (1989), in order to compute symbolically the we want to order the subfields, we must use the
roots of a polynomial. The following polynomial procedure intermorden. In the particular case
is irreducible over the rational number field: when the field IK (G) contains a non-constant poly-
I=x 12
- 4x 8
- 5x 6
+ 4x + lOx + 3,
4 2
nomial, we can use the procedure interpol (see
but the polynomial is decomposable, as can be Alonso (1994)). Of course, this code is much faster
seen using the compoly Maple comand: than the one above, as can be checked in the last
compoly(f, x) = section of this paper. In this example, we want to
[x 6
- 4x 4
- 5x 3
+ 4x + lOx + 3,x =x
2 2
] compute all intermediate order subfields IF, with
time 5.05 word$111084. <Q(f) c IF C <Q(x), where I is a rational function
On the other hand, applying our procedures de- with rational number coefficients I= 4-l.
x
We
composition or decompol to the polynomial I, apply the procedure intermorden to I:
we get a complete decomposition of I, i.e all given intermorden(f) =
components of I are now indecomposable: 2 _x 2 x2 4 X _x 2
[
x, 1+x4'~'x], [1-x2' 1+x 4],
decompol(f' x) =
2 2 [X2
. [x 2 - 5x + 3, x3 - 2x, x 2]
4
[1:+xx2' l~xx4], [1~xx4], l-x4], [x ]
1.3 Computing Subfields ofIK(x) So, we can note that there exist six proper sub-
fields; see in the next section for details about the
Given two rational functions G(x) and H(x), we
inclusion order relation.
are interested in finding explicitly the lattice of all
subfields related to IK(G(x)) and IK(H(x)), i.e.
the union field, the intersection field and all inter- 1.4 Simplifying Inverse Kinematics
mediate subfields IF , with K (G) C IF C lK (x). As
it is mentioned in Helmke (1990), this is a classical The symbolic solution of the inverse kinematic prob-
issue in Algebra. The following diagram illustrates lem requires solving a set of joint determining equa-
this: tions for the correpondingjoint variables. Univari-
lK(x) ate determining equations (after triangulations)
for a revolute joint variable-angle 8, is a kind of
polynomial equation 1(0) == O. The particular
K(G(x), H(x)) type of function 1(8) is called a sine-cosine poly-
nomial or sc-polynomial (see Kovacs &Hommel
/ \ (1992)):
K(G(x)) H«H(x))
108
can be converted into a rational function F( x) 1.5 Integrating
in a new variable x = tan(~), with denominator
(1 + x 2 )m. If this rational function is decompos- Assume we want to integrate an indefinite integral
able as F = G(H) such that G is a polynomial of the form (see Zippel (1991), (1992)):
and H is a rational function with denominator of
the form (1 +x 2 y then, the equation /(0) == 0 can J F(x)H(x)t dx,
be numerically and symbolically solved more effi-
where F(x) and H(x) are rational functions. If the
ciently (see also Gathen&Weiss (1993)). To solve
rational function H(X) is a suitable leftcomponent
this problem, first of all, we use the procedure in-
term and then the procedure equals that checks
of F(x), i.e. if there exists G(X) such that F =
G(H), then
when two fields are equal and finally the procedure
leftcomponent.
We consider the se-polynomial /(0) == 0 as III
109
polynomial (the procedure quasipolynomial checks polynomial r(x)s(y)-r(y)s(x) (see Alonso (1994),
that). In this particular case, we can use the faster Gutierrez and Recio (1992-11). Finding near-sepa-
procedure maxcompol to test simplicity. rated polynomial factors of the bivariate polyno-
Finally, these procedures can be understood as mial r(x)s(y)-r(y)s(x) is equivalent to decompos-
tests of birationallity, i.e. checking if ing the associated rational function F( x) = ~.
S(X)
lK(F1(t), ..., Fm(t)) = K(t). This fact is the basic idea of some of the proce-
See Ollivier (1989), Gutierrez&Recio (1992-1). dures that we are presenting.
In order to illustrate the use of the FRAC pack- Other applications of the functional decomposi-
age for solving the above problem, we consider the tion problem are: the n-partition problem (see
parameterization of the unit circle x2 + y2 - 1: Lenstra&Lenstra &Lovasz (1982)), the problem
of characterizing the class of automorphisms of
lK[Xl, ... ,x m ] and computing their inverses (see
Dickerson (1989), Gutierrez (1991)) and the prob-
lem of finding public key ciphers in algebraic cryp-
First of all, we check if the given parameterization tographY'(see Cade (1985)).
is quasipolynomial, via: Finally, assumimg that we want to know if the
q uasipolynomial( F1 , F2 ) bivariate polynomial:
false f = 3x 2 y - 2x 2 - X +Y - 3y 2 x + 2y2
time 2.18 word8 49298.
over the rational number field is a near-separated
Then, we must apply the procedures netto (see one, we will use the procedure nearseparated,
the last section ):
given an upper bound of the degree:
netto(F1 , F2 ) = nearseparated(j, 3, x, y) =
2x 2 + x
time 3.25 word8 89268. 1 + 3x 2
time 0.21 word8 2222.
So, the parameterization is no simpler and the new
parameter
.
IS S
t2
= (T+t). The polynomial is near-separated and the associ-
ated rational function is the output of the proce-
dure.
110
PROCEDURE: left component PROCEDURE: decomposition
111
PROCEDURE: sederberg Synopsis:
• The procedure interm computes all interme- Arguments: Two polynomials fl(X) and f2(x)
diate subfields between lK(F(x)) and lK(x). Uses
leftcomponent and nearseparated described a- Calling sequence:
bove. If the input is a polynomial, then the in-
intersectionpol(ft (x), f2(x))
term uses instead the procedure interpol.
Synopsis:
PROCEDURE: intermorden
• The procedure interseetionpol computes, if
Arguments: A rational function F(x) it exists, the polynomial generator of the intersec-
tion field ]I( (ft (x)) n lK (J2( x))
Calling sequence: intermorden(F(x))
112
PROCEDURE: intersection PROCEDURE: TRfaithful
Arguments: Two rational functions FI(x) Arguments: Two rational functions FI (x) and
F2 (x)
F2 (x) and a positive integer s
Calling sequence: TR!aith!ul(F I(x),F2(X))
Calling sequence: intersection(FI(x), F2(x))
Synopsis:
Synopsis:
• The procedure TRfaithful decides if a pa-
• The procedure intersection computes, if it rameterization of a plane curve given by FI (x)
exists, the rational function G( x) of degree least and F2 ( x) is faithful or not. This procedure uses
than the positive integer s and generator of the a Taylor resultant computation of two bivariate
intersection field lK(FI(x)) n lK(F2(x)). If such a polynomials. (see Abhyankar and Bajaj (1989),
function G( x) does not exits, the procedure re- Abhyankar (1990), Alonso (1994)).
turns the message "may be the ground field".
PROCEDURE: quasipolynomial
PROCEDURE: SSfaithful
Arguments: A list of univariate rational func-
Arguments: A list of multivariate rational func- tions
tions and the list of the variables, Xl, ... ,X n , in-
volved. Calling sequence:
quasipolynomial([rat.func.l, . .. ,ratJunc.n])
Calling sequence:
55! aith!ul([ratJunc.l ,... ,rat.func.n], [Xl, ... ,X n ]) Synopsis:
113
PROCEDURE: Implicit Dickerson,M.: Functional Decomposition of Poly-
nomials . Tech. Rep. 89-1023, Dep. of Computer
Arguments: A list of multivariate rational func-
Science, Cornell University, Ithaca NY (1989).
tions and the list of the variables, t l , ... , t m , in-
volved. Farin, G.:Curves and Surfaces for Computer Aided
Geometric Design. Academic Press, Boston 1988.
Calling sequence:
Implicit([ratJunc.l, ... ,ratJunc.n],[t l , ... , t m ])
Fried, M., MacRae, R.:On curves with separated
variables. Math. Ann., 180, pp. 220-226, 1969.
Synopsis:
Gathen, J. von zur.: Functional decomposition of
• This procedure computes the implicitization
polynomials: the tame case. J. of Symbolic Com-
ideal of the rational funcions following the algo-
putation 9, pp. 281-299 (1990).
rithm of Alonso& Gutierrez&Recio (1994). This
procedure uses computations of some quotient ide- Gathen, J.&Weiss, J.:Homogeneus bivariate de-
als. compositions. Preprint, Dep. of Computer Sci-
ence, University of Toronto, 1993.
Cade, J. J .:A new public-key cipher which allows Kozen,D.&Landau,S.: Polynomial decomposition
signatures. Proc. 2nd SIAM Conf. on App!. Lin- algorithms. J. of Symbolic Computation 7, pp.
ear Algebra, Raleigh NC, 1985. 445-456 (1989).
114
Lenstra. A. K., Lenstra, H. W., Lovasz, L.:Factoring pure mathematics, symbolic computation, solid mod-
Polynomials with Rational Coefficients. Math. Ann. eling and applications to robotic. His e-mail ad-
261, pp.515-534, 1982. dress is:
gutierrez@ccucvx.unican.es
Ollivier,F. Inversibility of rational mappings and
structural ide .:.iifiability in Automatics. Proc. IS-
Tomas Recio is a full Professor of Mathematics
SAC'89, pp. 43-53, ACM; 1989.
at the Universidad de Cantabria. He received his
Ritt,F.: Prime and Composite polynomials. Trans. Ph.D. in Mathematics from Universidad Complut-
Amer. Math. Society 23, pp. 51-66 (1922). ense de Madrid in the area of Real Algebraic Ge-
ometry. He has published extensively in the fields
Schinzel, A.:Selected topics on polynomials. Ann
of real algebraic geometry, computational geome-
Arbor, University of Michigan press, 1982.
try, symbolic computation, robotics and complex-
Sederberg, T. W.:lmproperly parametrized ratio- ity theory. He can be reached by electronic mail
nal cur- ves. Computer Aided Geometric Design, sent to:
3, pp. 67-75, 1986. recio@ccucvx.unican.es
115
GROUP RINGS AND HOPF·GALOIS THEORY IN MAPLE
Timothy Kohl
Department of Mathematics and Statistics, SUNY at Albany, Albany, NY
116
(2) Any finite algebraic extension of the ratio- with( numtheory);
nal numbers f{ /Q can be viewed as the
quotient ring Q[z]/ (f(z)) where f(z) is an simp := proc(expr,n)
irreducible polynomial In Q[z]. local e,ee,temp,ne,c,i,j ,degx,degz:
e.g. Q( J3) '= Q[z]/(z2 - :3) e := d + dd + expand(expr):
IH' := nops(e):
(:3) if (.'" denotes the cyclic group of order n ee := 0:
then we can represent the group ring [{ ('" for i from 1 to ne do
as the quotient ring J([:z:J/ (:z:" - 1). Since temp := op(i,e):
in this quotient ring, :z:" = I, every element degx := degree(temp,x):
is a polynornial expression of degree < n, degz.
:= degree(ternp,z):
.
cyclosimp := proc(expr,n)
local dj,e,cyp:
d := phi(n):
cyp := zAd-cyclotornic(n,z):
where (tij E Q, then {C:, (Tj Ii = 0, ... , ¢( 11) - 1, j = e := expr:
0, ... ,11- I} is a Q-basis for Q((")C,,. Hence, ele- for j from d to n-l do
ment.s of Q(Cn)Cn can be represented in Maple as e := subs(zAj=zA(j-d)*cyp,e):
follows: od:
n-10(n)-1
e := collect(e,z):
(*) 2::= 2::= aij zi:zj RETURN(e):
end:
j =0 i=O
117
procedure cyclosimp() is used so that all powers II. HOPF ALGEBRAS
of z (think (n) that appear in an expression are
of exponent less t.hat. ¢(n). For example, ¢(9) = 6
In t.his section we shall describe how Maple was
and <l>a(z) = z6 + z3 + I hence + (~+ 1= 0 so (g used t,o comput.e bases for cert.ain Hopf algebra.s
over CQ which are given as subrings of group rings
({; = -(~ - 1 and thus (J, for instance, may be
-3 - I) = - (49 - ~9 of t.he form Q( (pk )C> where p is an odd prime .
WI'I.t,t,en as (-6
9~~) = (9( -~9 -
An init.ial example of a calculat.ion t.hat can be These Hopf algebras act analgously to a Calois
done is t.o det.ermine a set. of orthogonal idernpo- group on the field ext.ension, CQ(a1/pk)/Q where
tent.s in CQ((n)C", that is n element.s C 1, ... , Cn such a E <01 but. a t- bP for any b E <Q!. This ext.ension
t.hat c; = Ci and cici = 0 for i j. For exam- t- is not. C;alois in the usual sense, but is an exarnple
ple, if n=:3 we may define Cl = HO'2 + 0' + I), of what is called a Hopf-Calois ext.ension. (See t.he
C2 = ~((2O'2 + (0' + 1), C3 = ~((O'2 + (20' + I) and references for furt.her information).
Without. going int.o excessive det.ail, the problern
readily verify t.hat. t.hese sat.isfy t.he above proper-
ties. Keep in mind t.hat. ( is a primitive cube root of is this. Civen the group ring Q((pk)Cpk, there is a
uni ty and as such 1+( +(2 = 0 so that. (2 = -( - I. group 6. k = (8) cyclic of order ¢(pk) = pk _ pk-l
which acts" on Q((pk)Cpk as follows:
>el := In*(xA2+x+1);
I I I
el := _;/:2
:3
+ -3:
:3
+ -
:3 where 7r is t.he least. primitive root of pk which in
>e2 := 1n*(zA2*xA2+z*x+1); Maple is given by t.he primroot() function in t.he
numtheory package. This in mind, we can ask
I 2 2 I
e2 := -z x + -Z3: + -1 for a det.ermination of (CQ( (pk )C:pk ) Cl.pk , that is the
:3 :3 :3 subring of elements fixed by all of 6. p k. Specif-
>e:3 := In*(z*xA2+zA2*x+ I); ically, (Q((pk)Cpk)Cl.pk = {cr E CQ((pk)CpkIVct =
cr VS r E 6. p k} which is a Hopf algerbra over Q of
rank pk (as a vector space) and shall be denoted
by pk H. The problem is how to compute a basis for
>rnu(el,el,:3); pk Hover CQ. Now the initial approach was to take
I I I each element of the set of ¢(pk)pk ba.sis elements
-3,2+- 3,+-
:3' :3' :3 =
{(; kO'i Ii 0, ... , ¢ (pk) - I, j =
0, ... , pk - I} an d
compute t.he 'trace' of it under the action of 6. k.
> mu(e2 ,e2,:3);
That is, given (~k O'i define: "
I I I I
( --z - _)3: 2 + -Z3: +-
:3 :3 :~ ;~ cP(pk)-1
(*) t1'((;kO'i) = L V ((;kO'i)
r=O
I 2 I I I cP(pk)-1
3"n: +(-3"Z-3")3:+3"
L (;( O'i"r
> rn u(e l,e2,:3) ;mu(e I ,e:3 ,:3) ;rnu(e2,e:3 ,:3); r=O
118
Note the following sample calculations where we
take the image (under the trace map) of a generic
basis element of Q((9)C9 and demonstrate that 89 :={1, z4 x 8 + (_z5 - z2) x 7 + (_z4 - z) x 5
this image is invariant under the action of L\g.
+ Z2 X4 + Zx 2 + Z5 X, (_Z5 _ Z2) x 8
>simp( tr(z:;'x,9),9); + (_z4 - z) x 7 + z5 x 5 + Z4 x 4 + z2 x 2 + ZX,
z3 x 8 + (_z3 _ 1) x 7 + z3 X5
+ (_z3 - 1) x 4 + z3 X2 + (_z3 -1) X,
(_Z5 _ z2) x 8 + (_Z4 _ z) x 7 + Z5;1: 5 + z4 x 4
(_z4 _ z) ;1: 8 + z5 X7 + zx 5 + (_z5 _ z2) x 4
+z2 x 2+ zx
+ z4 x 2 + z2 x , z5 x 8 + zx 7 + z2 x 5
+ (_Z4 _.::) x 4 + (_z5 _ z2) x 2 + z4 x ,
>simp(delta(" ,9,1),9);
(_z3 -1) x 6 + z3;c 3,z3 X6 + (_z3 -1) x 3,
zx 8 + z2 X7 + z4 X5 + z5 x 4 + (_z4 _ z) x 2
(_Z5 _ z2) x 8 + (_z4 _ z) x 7 + z5 x 5 + z4 x 4
+ (_z5 - z2) x, z2 x 8 + z4 x 7
+z2 x 2+ zx
+ (_Z5 _ z2) x 5 + zx 4 + Z5 X2
>s3:=genspan(3);
b9 :={1, .:;4 x8 + (_z5 - z2) x 7 + (_z4 - z) x 5
+ z2 X4 + zx 2 + z5 x , (_z5 _ z2) x 8
+ (_z4 _ z) x 7 + z5 x 5 + Z4 x 4 + z2;1:2
+ zx, z3 x 8 + (_z3 - 1) x 7
3 9
Although not immediately obvious, distinct (ip k (Tj 's
>s9:=genspan(9); can have identical traces and since the output. of
119
genspan() is a set, in the theoretical sense and as only 27 H but also 81 H, with none of the overhead
the Maple data type, duplicate traces do not ap- induced by looking at spanning sets. The culmina-
pear in the spanning set. Furthermore, some ad- tion of this is the procedure jastbasis(b,p,k) which
ditional conditioning is performed so that, among recursively generates a basis for pk+l H given a basis
other things, the constant 1 always appears in the b of pk H. If we make the convention pO H = 1 H =
basis and if tr (~l1'j) is any other rational num- Q and let b1 = {I} then applying jastbasis() to b1
ber, it is not added to the spanning set. Hence the yields a basis bp of pH and applying jastbasis() to
spanning set in general has fewer than ¢(pk)pk el- bp yields a basis bp 2 of p2H and so on.
ements yet more than pk elements, hence the need We illustrate this process with p=3 as before:
for the linearize() routine. Consider the following
example where we generate a basis for 27 H. Again
note the size of the spanning set as compared to >bl := {I}
the basis. bl := {I}
120
>b81[13]; a framework in which the complex expressions t.hat
arise are no longer difficult to manipulate. In do-
(_Z39 _ Z12) X 78 + Z51 X 75 + Z21 X 69 + Z6 X 66 ing so, we have freed ourselves to go after the main
+ (_Z30 _ Z3) X 60 + Z42 X 57 + Z12 X 51
problem and deal with it within this same environ-
ment without having to worry about tedious inter-
+ (_Z51 _ Z24) X 48 + Z48 X 42
mediate calculations. Furthermore, as mentioned
+ Z33 X 39 + Z3 X 33 + (_Z42 _ Z15) X 30 earlier, preliminary calculations led to preliminary
results which in turn led to not only increased in-
+ Z39 X 24 + Z24 X 21 + (_Z48 _ Z21) X 15 sight into the problem itself, but an improved com-
+ (_Z33 _ Z6) X 12 + Z30 X 6 + Zl5 X 3 putational scheme. It is in this respect that Maple
stands out, not just as a computational tool but
>simp( delta(b81 [13] ,81,1 )-b81 [13],81); as a conduit of empirical information from which
observant users may derive deeper understanding
o of their subject.
>b81[59]; REFERENCES
Z43 X 80+ Z5 X 79 + zlO x 77 + Z53 x 76 [1] Lindsay N. Childs, On the Hopj Galois Theory jor Sep-
arable Field Extensions, Communications in Algebra
+ (_z31 _ z4) x 74 + z20 X 73 + z25 x 71 17(4) (1989),809-825.
[2] C. Greither and B. Pareigis, Hopj Galois Theory jor
+ (_z41 _ z14) X 70 + (_z46 _ z19) x 68 Separable Field Extensions, Journal of Algebra 106
+ z41 x 16 + z6 x 14 + z8 x 13 + z13 x ll
+ (_z29 _ z2) x lO + (_z34 _ z7) x 8
+ z23 x 7 + z28 x 5 + (_z44 _ Z17) x 4
Conclusion
121
RATIONAL GENERATING FUNCTION
APPLICATIONS IN MAPLE
Generating function techniques have been used To use generating functions, we must first be
throughout the literature to evaluate summations able to map between closed forms and generat-
and recurrences. Rational generating functions ing functions and between recurrences and gener-
are a particularly effective computation tool, as ating functions. The genfunc package functions
they encode all linear recurrence sequences. These rgLencode, rgLexpand, and rgf....sequence and
are sequences defined by homogeneous linear re- the Maple library function rsolve perform these
currences with constant coefficients. There are tasks.
known generating function techniques for evalu-
To encode a generating function we use the
ating summations and convolutions that involve rgLencode function. As with most of the func-
linear recurrence sequences. Unfortunately, these tions in the genfunc package, rgf _encode re-
methods do not lend themselves well to hand cal- quires that the index variable of the sequence and
culation.
the generating function variable be passed as ar-
The Maple genfunc package provides tools for guments. In the examples in this paper, we use
manipulating rational generating functions and n as the index variable and z as the generating
the sequences that they encode. This paper illus- function variable.
Consider the sequence (n 2 + 2n + 3). We em-
trates how Maple is used for quick and easy eval-
uation of sums and convolutions of linear recur- ploy rgLencode to find its generating function
rence sequences. Section 2 looks at encoding and
G(z).
decoding generating functions. Summations and
convolutions are considered in Section 3. Tech-
niques for hybrid terms and linear indexing are
presented in Section 4. Hybrid terms are terms
defined by the term-wise product of two or more 3 z
----- + 2 --------
sequences. Linear indexing defines a new sequence
1 - z 2
by using a linear polynomial to index a known
linear recurrence sequence. To illustrate these ap-
o - z)
plications of Maple, we consider several summa- / 1 z \
tions and convolutions, including some well known + z 1-------- + 2 --------1
problems involving the Fibonacci numbers. 1 2 31
\O-z) O-z)/
2
- 3 + 3 z - 2 z
Gz := - -------------------
2 3
1 - 3 z + 3 z - z
The function rgf-norm puts a rational gener-
ating function into a "normal" form with respect
122
to the generating function variable z. The func- z
tion rgf _expand reverses the process to find the Fz .= - ------------
2
closed form of a sequence defined by a rational
- 1 + z + z
generating function. Consider the expansion of
G(z). To find the recurrence and boundary condi-
tions for the Fibonacci numbers from their gener-
> rgf_expand(Gz, z, n); ating function we use the rgf -sequence function.
This function answers a number of queries about
2 (n + 1) (1/2 n + 1) - n + 1 the sequence encoded by a rational generating
function. We use the 'recur' and 'boundary'
> expand(II); queries here.
2
n + 2 n + 3
> rgf_sequence('recur', Fz, z, F, n);
123
Consider the convolution Sn = 2:;=0 k2 n- k . linear recurrence Sn = Sn-1 + an, for boundary
To evaluate Sn, we use rgf _encode to find the gen- condition So = ao. For the sum of the Fibonacci
erating functions of (n) and (2 n ), multiply them to numbers, we noted that the indefinite sum can be
find the generating function of Sn , and expand the expressed using the symbolic name Fn . In gen-
resulting generating function with rgf .expand. eral, the indefinite sum of any linear recurrence
sequence (an) can be expressed in finite terms us-
ing the symbolic function name an [2, 3].
> Az := rgf_encode(n, n, z);
We use the function rgf...relate to evalu-
z ate indefinite summations that involve symbolic
Az := -------- names of linear recurrence sequences. This func-
2 tion is a general purpose routine that relates
(1 - z) two sequences that have common factors in the
denominator of their generating functions. Let
> Bz := rgf_encode(2-n, n, z); the sequence (an) be encoded by the generat-
ing function A( z). Let B( z) be a generating
1
function whose denominator has factors in com-
Bz := -------
1 - 2 z mon with the denominator of A(z). The func-
tion rgf...relate expresses the sequence encoded
by B( z) in terms of the symbolic sequence name
an. The first four arguments of rgf ...relate de-
n scribe the generating function A( z) and the se-
- n - 2 + 2 2 quence (an), The last two arguments describe the
generating function B(z) of the sequence that is
to be expressed in terms of an,
3. Summations and Convolutions Involv-
Consider Sn = 2:;=1 Fk, the summation of
ing Symbolic Function Names
the first n Fibonacci numbers. We found the
generating function F(z) of (Fn ) in Section 2. To
Often, a summation involves a symbolic function find an expression for the indefinite summation
name instead of a closed form expression. For Sn, we divide F( z) by 1 - z and relate Sn to the
example, the problem might be to evaluate the symbolic name Fn .
summation Sn = 2:;=1 Fk, where (Fk ) is the se-
quence of Fibonacci numbers. If a recurrence or
generating function is given for the named func- > rgf_relate(Fz, z, F(n), n, Fz/(1-z), z);
tion, we can use the functions in Section 2 to
find a generating function for the solution and
2 F(n) + F(n - 1) - 1
then expand it. However, this may not be de- The expression for Sn can be left in this form,
sirable or feasible. The solution might be more or the Fibonacci recurrence can be applied twice
understandable if it can be expressed in terms to express this in the simpler form F n +2 - 1. The
of the named function. For example, the sum function rgf....simp does this simplification for us.
of the first n Fibonacci numbers is known to The function has 5 arguments and an optional
be Fn +2 - 1. The corresponding closed form is sixth argument. It simplifies an expression with
(((1 + J5)/2)n+2 - ((1- J5)/2)n+2)/J5 - 1. It respect to a symbolic sequence name. The first
is not unreasonable to regard Fn +2 - 1 as a more argument is the expression to be simplified. The
informative solution. In other cases, a named second and third arguments define the generating
function used in a problem may have a generating function of the sequence being simplified. The
function that cannot be expanded by rgLexpand. fourth and fifth arguments describe the sequence
Thus, we cannot find a closed form solution for the name. If the sixth argument is omitted, the ex-
problem. pression is simplified relative to the nth term of
The sum Sn = 2:;=0 Fk is the indefinite sum- the sequence. If the sixth argument is present,
mation of the sequence (Fk)' Evaluating the in- it provides the target index, and the sequence is
definite summation Sn = 2:;=0 ak of a linear re- simplified relative to that index.
currence sequence (an) is equivalent to solving the
124
> rgf_simp(Sn, Fz, z, F(n), n, n+2); result, we first expand S(z) using partial fractions
with respect to z.
F(n + 2) - 1
+ 3 T(n - 3) - 5 + 12 z
+ 1/11
> Tz := rsolve({Tn, T(i=O .. 2)=i}, T(n), 2
'genfunc'(z»; 1 - 2 z + 3 z
For other convolutions, this approach does not 4. Hybrid Terms and Linear Indexing
give satisfactory results. Consider the convolution
Sn = L~=o tkFn-k, where (tk) is encoded by the Hybrid terms are sequences defined by the term-
=
generating function T(z) 1/(1- 2z + 3z 2). The wise product of two or more parent sequences.
generating function of Sn is T(z)F(z) = z/(l-z- For example, Fn 2n is a hybrid term derived from
z2)/(1- 2z + 3z 2). We can relate Sn to either the the sequences (Fn) and (2 n ). If (an) and (b n )
symbolic name Fn or the name tn' However, the are linear recurrence sequences, then the hybrid
most desirable result relates Sn to both function sequence (anb n ) is a linear recurrence sequence
names, which rgf .relate cannot do. To find this and has a rational generating function [1, 2, 3].
125
The function rgf...hybrid computes the gen- that sequence will require at most m consecutive
erating function of a hybrid sequence. The first terms from the symbolic sequence name (2].
argument to rgf...hybrid is the generating func-
The techniques for hybrid sums work for all hy-
tion variable. The remaining arguments are the
brid sequences defined by the term-wise product
generating functions of the hybrid term's parent
of two or more linear recurrence sequences. We
sequences. Once the generating function of a hy-
examine one other example here. Consider the
brid term is found, we can employ the techniques
of Section 3 to evaluate summations and convolu-
hybrid sum Sn = L~=o akbk, where the sequence
(ak) is encoded by the generating function A(z) =
tions involving that hybrid term.
1/(I-z+4z 2 ) and the sequence (b k ) is encoded by
Consider the summation Sn = L~=l F'{ The the generating function B(z) = 1/(1- 5z - 2z 2 ).
sequence (F;) is a hybrid sequence defined by Following the steps above, we can express Sn in
the term-wise product of two Fibonacci sequences. finite terms using the symbolic function names an
We employ rgf ...hybrid to find its generating func- and bn .
tion.
2
- z + z Az .= ------------
2
F2z .= - -------------------
1 - z + 4 z
2 3
1 - 2 z - 2 z + z
2 2 2 2
3/2 F(n) + 1/2 F(n - 1) - 1/2 F(n - 2) 1 + 8 z
ABz := --------------------------------
This result expresses Sn in terms of the squares 234
of the Fibonacci numbers. We can leave the result - 5 z + 114 z + 40 z + 64 z
as is, or "simplify" it to involve just Fn and Fn - 1 .
> Sn:= rgf_relate(ABz, z, AB(n), n,
ABz/(1-z), z);
> rgf_simp(", Fz, z, F(n), n);
213 52
2
Sn .= --- AB(n) + --- AB(n - 2)
F(n) + F(n) F(n - 1)
214 107
A further "simplification" can be obtained if
we simplify with respect to Fn +1 . 109 32
+ --- AB(n - 1) + --- AB(n - 3) + 9/214
107 107
> rgf_simp(", Fz, z, F(n), n, n+1);
126
109 recurrence sequence, then the sequence (aan+iJ),
+ --- A(n - 1) B(n - 1) for integer constants Q' > 0 and (3, is a linear re-
107 currence sequence and has a rational generating
function [2, 3].
32
+ --- A(n - 3) B(n - 3) + 9/214 We need one other piece of information before
107 we can compute the generating function of a se-
quence defined by linear indexing. If a sequence
We can leave the expression in this form, or (an) is defined by an order m recurrence, then the
"simplify" it relative to an and bn . sequence (aan+iJ)' for integer Q' > 0 and (3, is de-
fined by an order m recurrence [3]. Knowing this,
> Sn := rgf_simp(Sn, Az, z, A(n), n); we can use the function rgLfindrecur to com-
pute the order m recurrence defining (aan+iJ)'
The function rgLfindrecur computes the or-
Sn := 9/214
der m recurrence that defines a sequence from 2m
consecutive values of the sequence. Once the re-
/213 13 currence is found, rsolve is used to find the gen-
+ 1--- B(n) - --- B(n - 2) erating function for the sequence. The techniques
\214 107 of Section 3 can then be used to evaluate summa-
tions and convolutions that involve the linearly
\ indexed sequence.
- 2/107 B(n - 3) I A(n)
Consider the summation Sn = I:~=o tk, where
/
tk = F2k+l' The sequence (Fk) is defined by
/109 an order 2 recurrence, therefore (tk) is defined
+ 1--- B(n - 1) - 6/107 B(n - 3) by an order 2 recurrence. The first four terms
\107 of the sequence (tk) are (1,2,5, 13). The func-
tion rgf...findrecur computes its recurrence and
13 \ rsolve computes its generating function T(z).
+ --- B(n - 2)1 A(n - 1)
107 /
> rgf_findrecur(2, [1,2, 5, 13], T, n);
> Sn := rgf_simp(Sn, Bz, z, B(n), n);
T(n) = 3 T(n - 1) - T(n - 2)
/205 14 \
Sn := 9/214 + 1--- A(n) + --- A(n - 1)1 B(n) > rsolve({", T(O)=l, T(1)=3}, T(n),
\214 107 / 'genfunc' (z)) ;
/ 19 36 \
+ 1--- A(n) + --- A(n - 1) 1 B(n - 1) Tz := ------------
\107 107 / 2
z - 3 z + 1
> expand(");
The generating function of Sn is T(z)j(l- z).
205 19 The value of Sn can be related to F 2n +1 and the
9/214 + --- A(n) B(n) + --- A(n) B(n - 1) resulting expression simplified relative to F 2n .
214 107
127
Not surprisingly, this can be further simplified Robert A. Ravenscroft, Jr. received his Ph.D.
to yield a more compact result. in computer science from Brown University. His
research interests include the analysis of algo-
rithms and symbolic computation. In 1991-92,
> rgf_simp(Il, Fz, z, F(n), n, 2*n+2);
he was a visiting post-doctoral fellow with the
F(2 n + 2) - 1 Symbolic Computation Group at the University
of Waterloo. While there, he implemented the
genfunc package in Maple and redesigned and
5. Conclusion reimplemented much of the rsolve library func-
tion. He was most recently employed as a lecturer
This paper considered the use of rational gen- in computer science at the University of Rhode
erating functions in Maple to find finite expres- Island.
sions for summations and convolutions of linear Robert Ravenscroft
recurrence sequences. Techniques were presented Department of Computer Science and Statistics
that handled hybrid terms and linear indexing. Tyler Hall, University of Rhode Island
The techniques presented in this paper are gen- Kingston, RI 02881, USA
eral enough to solve quickly and conveniently any
summation or convolution involving linear recur-
rence sequences.
The author would like to thank Edmund La-
magna, John Savage, and Keith Geddes for their
useful feedback on this work.
REFERENCES
128
IIIB. MAPLE IN SCIENCE
SYMBOLIC-NUMERIC COMPUTATIONS FOR PROBLEM-
SOLVING IN PHYSICAL CHEMISTRY AND BIOCHEMISTRY
I
as Maple changes the approach to solving mathe-
matical problems in science. The concept of scien-
tific computation has evolved from a field encom-
symbolic
passing primarily numerical methods to a much
broader field that includes algebraic and analytical
methods, numerical methods, and graphics. The
combination of all these computing techniques fa-
cilitates efficient and accurate problem-solving. It
allows the development of software systems for the
automatic solution of problems in ways that are
not possible with conventional computing systems. Figure 1: Computing steps in a scientific problem-
Figure 1 displays typical steps in a computerized solving process.
solution process.
First, we study the thermodynamic behavior of
steam reforming reactions. The product compo- 2 Physical Chemistry
sition at equilibrium is calculated by solving a
system of nonlinear equations which itself is de- The catalytic reaction between steam and hydro-
rived by reformulating the equilibrium condition carbon into mixtures of hydrogen, carbon monox-
for each separate reaction. The Newton-Raphson ide, carbon dioxide and methane forms the ba-
method and symbolic computation techniques are sic feedstock (synthesis gas) to produce ammo-
used to solve this system of nonlinear equations. nia, methanol and other chemicals. To find the
most economic reaction conditions, especially car-
In our second example we demonstrate how the
bon boundaries, it is necessary to study theoret-
McConnell equations in Biochemistry, a linear in-
ically the reaction behavior with respect to the
homogeneous system of differential equations with
operating parameters. In the present thermody-
constant coefficients, can be solved elegantly by
namic study we examine the temperature and
using symbolic linear algebra alone. This method
pressure dependence of chemical compositions at
utilizes the special structure of the ODE system
equilibrium. We consider the following simple sys-
and therefore is faster and more direct than sim-
tem of steam reforming reactions to demonstrate
the mathematical model and the computation
techniques involved:
131
1. The methane-steam equality
-1 0 -1 K3 = PlI2
PCH4
-1 -1 0
Now, if we insert the relation Pj = XjP, where Pj
Q, := 1 -1 0 denotes the partial pressure, P the total pressure
3 1 2 and Xj the mole fraction of chemical component
Sj, then we obtain
o 1 o
> for j from 1 to 5 do
Therefore, the composition of the participating p[j] :=x[j]*P
chemical components at equilibrium is evaluated od:
by the following matrix algebra: j :=' j' :
for i from 1 to 3 do
> xi:=vector(3): print(value(eqn['i']»
print(xi); od:
n :=vector(5):
print(n);
ne:=add(n,multiply(alpha,xi»:
print(ne);
132
Before solving this system of nonlinear equations
we determine the temperature dependence of the
constants In(Ki ), i = 1..3. To obtain an expres-
sion for the reaction enthalpy we use Kirchhoff's
law with a polynomial ansatz for the description
of the molar heat capacity. We have
> diff(H(T),T)=
Sum(A[j].(s.T)~j,j=O.. 6);
The individual mole fractions Xj are calculated by
dividing nej by the total number of moles. Thus, d
L Aj (sT)j
6
the sum over the component index should yield dTH(T) =
unity. j=O
> nsum := sum(ne[j],j=1 .. 5): > expand(dsolve(value("),H(T)));
x := map(y -> y/nsum,ne); assign(II):
6 n3 + {l - 6 2 2 4
nl - {l - 6 n2 - {l - H(T) = A T A l sT A2s T3 A3S 3T
x := [ %1 ' %1 ' %1 ' 0+ 2 + 3 + 4 +
d H(T)
dT InK(T) = RT2
The equilibrium mixture defined by {i, i = 1..3, > expand(dsolve(", InK(T)));
must simultaneously satisfy the equilibrium condi- assign(II):
tion for each reaction, i.e. since Xi = xi(6,6,6)
we have to solve the following equations for the
I K(T) _ A6S6T 6 AsssTs A4s4T 4 A3S3T3
reaction extents simultaneously: n - 42 R + 30 R + 20 R + 12 R +
> for i from 1 to 3 do A2S2T2 AlsT Ao In(T) _Cl C2
f[i] := In(value(rhs(eqn['i'])))- 6R +"""2R+ R -RT+-
In(lhs(eqn['i']))=O:
print("); The coefficients A j are determined by the cor-
od: responding coefficients of the pure substances in
each reaction. These coefficients can be obtained
from thermochemical data prepared for computer
In (P2 (n3 + {l - 6)( n4 + 36 + 6 + 26)3) _ calculations [5J. The following coefficient matrix
(nl - {l - 6) is used:
In(nl +2{l +6+n2+n3+n4+ns)2(n2-{l-6))-
aOCH4 aOH2o aOco aOH2 aOC02 aOe
In(Kt} =0 ale
al CH4 alH20 al co al H2 al CO2
In ((n 4 + 3{l + 6 + 26)(ns + 6)) -In(K2) = 0 a2CH4 a2H20 a2co a2H2 a2C02 a2e
(n2 - {l - 6)(n3 + {l - 6)
a9CH4 a9H20 a9co a9H2 a9C02 age
In (p(n 4 + 36 + {2 + 2{3)2) _
(nl - {l - 6) a4CH4 a4mo a4co a4H2 a4C02 a4e
133
Now, reading in the coefficients In(K[i])=eval(lnK(T));
print(");assign(");
> readlib(readdata): _C1:='_C1':_C2:='_C2':
U:=readdata(fprothero.dat f ,6): od:
U:=convert(U,matrix):
and then including carbon (graphite) into the sto- In(Kd =
ichiometric coefficient matrix 0::
-2.266129470 1O- T 6 + 2.7517048361O- 16 T 5 -
2o
> beta:=stack(alpha,[O,O,l]);
1.439640670 1O- 12 T 4 + 4.206807101 1O- 9T 3 _
-1 0 -1 7.207461326 1O- 6 T 2 + 5.133144050 1O- 3 T+
-1 -1 0
5.2643363741n(T) - 23067.92495~ -10.97646894
1 -1 0
/3=
3 1 2 In(K2 ) =
0 1 0 -8.800218119 1O- 21 T 6 + 1.129751855 1O- 16 T 5 _
0 0 1 6.422612785 1O- 12 T 4 + 2.153951730 1O- 9T 3 _
allows calculation of the coefficients A j , j = 0..6, 4.851992918 1O- 6 T 2 + 8.483621895 1O- 3T-
for the three reactions by the following matrix
multiplication: 2.665443083 In(T) + 4698.749275~ + 8.82258362
> V:=multiply(U,beta): print(V);
In(K3 ) =
10.45411100 -5.293134000 2.846880000 -2.0366411411O- 20 T 6 + 2.568659013 1O- 16 T 5 _
20.38716900 33.69417100 36.52153400 1.4047837711O- 12 T 4 + 4.3494237471O- 9 T 3 -
-85.87703600 -57.81158600 -98.41227000 8.259514570 1O- 6 T 2 + 9.195504045 1O- 3 T+
100.2483700 51.32875000 103.6469300
1.433592386 In(T) - 8107.550186~ - 3.56194983
-57.17781800 -25.50851700 -55.79341600
6.730507200 15.30281000
This completes the thermodynamic model. Next,
16.39330720
we consider a feed mixture of nl = 1 moles of
-1.890068240 -0.7339833400 -1.698663200 methane and n2 = 1 moles of steam under a pres-
sure of P = 5 bar and solve the equilibrium equa-
The integration constants _Cl and _C2 can be
tions for the reaction extents ~i, i = 1..3. In Maple
calculated by using special values of H(T) and we applied the procedure fsolve which permits the
InK(T) at standard conditions (T = 298.15° K)
numerical solution of equations. Assuming a step
for the three equations [6J. Inserting the value of
size of 10 degrees the program fsolve had to solve
the gas constant R and taking into account the
46 times a system of three nonlinear equations
conversion factor F between the unit cal (used in
within an accuracy of 6 digits over the interval
Prothero's thermochemical table [5]) and the SI
T = [750..1200J. On a RS/6000-32H workstation
unit Joule we eventually arrive at:
this computing task requires about 80 seconds.
> HO[l] :=206185: HO[2] :=-41165: The temperature dependence of the reaction ex-
HO[3]:= 74873: tents and the resulting mole fractions for steam,
lnKO[l] :=-57.3621: InKO[2] :=11.546:
lnKO[3] :=-20.47458665: hydrogen, carbon monoxide, carbon dioxide, and
s:=10-(-3): R:=8.3143: F:=4.1868: methane are displayed in Figures 2 and 3. When
for i from 1 to 3 do the reaction extent 6 is zero or negative, the con-
for j from 0 to 6 do dition for no carbon formation (see Fig. 2), then
A[j] :=F*V[j+1,i]; a two dimensional calculation model has to be ap-
od;
solve ({HO [i] =subs(T=298. 15, plied. Setting 6 = 0 we obtain the two roots of
H(T))},_C1) ;assign(II); 6(T) as follows:
solve({lnKO[i]=subs(T=298.15,
InK(T))},_C2);assign(");
134
3.0" .
0.' 0.' ,.
x1(ll x1(lJ
0.' 0.'
0.' 0.'
0.'
xl[2J
xl
~o. 2 -0. ;Z
Figure 2: Temperature dependence of the reaction Figure 4: Temperature dependence of the reaction
extents ~i, i = 1..3, under the conditions P = 5 bar extents ~i, i = 1..3. Same conditions as in Figure
and a steam to carbon atom ratio H 2 0: C = 1 : 1. 2. In regions with no carbon formation a two di-
mensional calculation model is applied.
X[jll- ''-''""..:..(x..:.:[J.:.:.J•.:.:.l-'.:.:.
......;''_ _
135
d
dt MA(t) = -kA1 MA(t) + L1MB(t) + dA
d
dt MB(t) = k1MA(t) - kB1 MB(t) + dB
> with(linalg):
C:=matrix([[-k[Al], k[-l]],
[ k[l], -k[Bl]]]);
D:=vector([d[A], dEB]]);
YO:=vector([MAO, MBO]);
C:= [-kkA1
1
Ll]
-k B1
D:= [dA,dBJ
YO:= [MAO,MBOJ
Figure 6: Temperature and pressure dependence
of the mole fractions Xj, j = 1..5. Same conditions Applying the Maple function for the evaluation of
as in Figure 5. matrix exponentials leads to the following solution
of the inhomogeneous ODE system:
3 Biochemistry > F:=multiply(exponential(C, t), YO):
f:=s -> multiply(exponential(C,
In recent years, in vivo nuclear magnetic reso- t-s), D):
nance (NMR) spectroscopy has allowed measuring P:=vector([int(f(s) [1] , s=O .. t),
rate constants of transport and diffusion across liv- int(f(s) [2] , s=O .. t)]):
81:= add(F,P):
ing cell membranes [9-10J. The theoretical basis
for the analysis of magnetization-transfer exper- It should be noted that the solution of the analo-
iments is a system of differential equations first gous one-dimensional ODE is found in a formally
introduced by McConnell [l1J. These equations, identical way. The correctness of the one dimen-
here formulated in a slightly different way as in sionl solution is easily verified:
Ref. [3], are given by > exp(c*t)*yO+int(exp(c*(t-s»*d,
s=o .. t):
> diff(MA(t),t)=-k[Al]*MA(t) + evalb(expand(diff(",t)=c*"+d»;
k[-l]*MB(t) + d[A];
diff(MB(t),t)= k[l]*MA(t) -
k[Bl]*MB(t) + dEB];
136
true the particular solution, is constant. Then, linear
algebra computations in Maple lead to the follow-
If matrix C is invertible then the solution of the in- ing compact analytical solution (see Ref. [13J for
homogeneous ODE system can be computed with details):
matrix algebra alone. We have
> dsolve({diff(y(t),t)=
c*y(t)+d, y(O)=yO}, y(t))i
-CD in solution S2
e 2 + MeB
> MeA := -CD[l]i MeB := -CD[2]i #(*) where
137
and MB(t) are determined by a nonlinear least- system such as Maple enables an automatic and
squares analysis, Le. by fitting the model parame- computerized solution of problems in ways that
ters to experimental data for MA(t) and MB(t) ob- are not possible with conventional computing sys-
tained at different values of time [1-3J. For the nu- tems.
merical parameter fitting we used the ACM In our first example we study the thermodynamic
program NL2S0L [14J which is based on the behavior of steam reforming reactions and deter-
Levenberg-Marquardt algorithm and which needs mine the temperature and pressure dependence of
an analytic Jacobian matrix as input. The sym- the chemical compositions at equilibrium. Using
bolic evaluation of the Jacobian matrix is done Maple's symbolic computation capabilities a sys-
by the Maple procedure jacobian. Again, for the tem of nonlinear equations for the reactions ex-
translation into optimized FORTRAN code and tents is derived. For the fast numerical solution
the generation of a driver program for the fitting of the nonlinear equations we applied the Newton-
routine we implemented a preprocessor in Macro- Raphson algorithm and the programming language
fort [8J. This program generator is capable of FORTRAN. A FORTRAN preprocessor in Maple
constructing complete and ready-to-compile FOR- calculates the Jacobian matrix needed for this al-
TRAN code for a given set of functions and pa- gorithm and generates a complete and ready-to-
rameters. compile FORTRAN program.
Now, for plotting the functions MA(t) and MB(t) In the second example we demonstrate how the
we substitute special values for the formal param- McConnell equations in Biochemistry, a linear in-
eters. These values were computed by fitting data homogeneous system of differential equations with
from inversion transfer experiments to investigate constant coefficients, can be solved analytically in
transport processes in a special biological system a direct way by using Maple's symbolic linear al-
[15J (see Fig.7). gebra routines. In addition, the automatic gener-
ation of numerical code for the determination of
the formal parameters involved in the solutions is
MA(t) described.
140
1>0 References
[lJ J. J. Led and H. Gesmar, J. Magn. Res. 49,
444-464, (1982).
MB(t)
138
[9] K. Kirk, NMR Biomed. 3, 1-16, (1990). [I 'eps,maxiter:' I], [J],
[readm,input,[ld22.15 I ,i6],
[10] P. W. Kuchel, NMR Biomed. 3, 102-119, [eps,maxiterJ] ,
(1990). [writem, output ,
[I 'start,step,nsteps:' I], [J],
[11] H. M. McConnell, J. Chem. Phys. 28,430- [readm,input, [12e14.7,i6 1] ,
431, (1958). [start,step,nsteps]]] ;
# while instruction
[12] P. Hartman, "Ordinary Differential Equa- linit:=[[writem,output,
tions", John Wiley & Sons, Inc., (1964). [I'Inital vector Xi:,I] ,[]],
[readm,input, [II .d. le14.7 1],
[13] J. Grotendorst, P. Jansen, and S. M. [seq(xi[ii] ,ii=l .. d)]]];
Schoberth, The Maple Technical Newslet- for ii from 1 to d do
ter, 1, 56-62, (1994). pushe([equalf,f[ii],ff[ii]],
'linit')
[14] J. E. Dennis, D. M. Gay, and R. E. Welsch, od;
ACM Trans. Math. Software, Vol. 7, No.3, lWhile:=[[matrixm,zj,jac],
[callf,dgetrf,[d,d,zj,d,
(1981 ). ipiv,infoJ] ,
[15] S. M. Schoberth, A. A. de Graaf, B. E. [callf,dgetrs, [I 'N,I ,d,l,zj,
d,ipiv,f,d,info]],
Chapman, P. W. Kuchel, and H. Sahm, XV [dom,k,l,d, [equalf,xi[k] ,
International Conference on Magnetic Res- -f[k] +xi[k]]]] ;
onance in Biological Systems, Jerusalem, for ii from 1 to d do
Israel, August 16-21, (1993). pushe([equalf,f[ii],ff[ii]],
, lwhile , )
od;
5 Appendix llwhile:=[whilem,znorm(f,d) >= eps,
linit,lwhile,maxiter];
# translate the mole fractions
It follows a listing of the FORTRAN code gener- fw:=[J ;
ator genJ'ort in Macrofort and an example how it for ii from 1 to dd do
was used within Maple: pushe ([equalf,y[ii],xl[ii]],
'fw' )
> with(share): od;
readlib(macrofor): fw:=[op(fw),[writem,4,[19(lx,e14.7),
read(gen_fort): lx,i6 1],[T,y,xi,nwhilel]]];
fl:=map(y->lhs(y) ,f): forloop:=[dom,j,l,nsteps,[[equalf,T,
gen_fort(fl,xi,3,x,5,l extents.f l ): start+(j-l)*step],llwhile,fw]];
# Maple program gen_fort in Macrofort
pg:=[op(pg),[openm,4,lresult.datl,
gen_fort:=proc(ff,xx,d,xl,dd,pg_name) UNKNOWN,forloop]];
local f,fo,ii,jac,jj,j,k,linit, pg:=[programm,newton,pg] ;
lwhile,m,pg,xi,zj,y,ipiv,n, # fo: quadratic norm of f
nwhilel,llwhile,forloop,fw,eps, fo: =[[declaref ,
maxiter,start,step,nsteps,P,T, limplicit double precision l ,
znorm; [I (a-h,o-z) IJ],
# calculate the jacobian matrix
[declaref,ldimension l , [f[m]]] ,
jac:=linalg[jacobian] [equalf,znorm,O.],
([seq(ff[ii],ii=l .. d)], [dom,j,l,d,[equalf,znorm,
[seq(xx[ii] ,ii=l .. d)]); znorm+f [j] **2]] ,
# pg: MAPLE list describing main pgm
[equalf,znorm,sqrt(znorm)]] ;
pg:=[[declaref, .. fo:=[functionm, Idouble precision I ,
limplicit double preclslon l znorm,[f,m] ,fo];
[I (a-h,o-z) IJ],
# FORTRAN code generation
[declaref,ldimension l , writeto(pg_name);
[f Ed] ,zj [d,d] ,xi[d] ,y[dd]]], init_genforO;
[declaref,dimension,[ipiv[d], precision := double;
n[dd]J] , optimized := true;
[writem, output , interface(quiet=true);
[I ,P,vector n; I I] , [J] ,
genfor(pg);
[readm, input, genfor(fo);
[ld22.15 I , I I .dd. li6 1],
[P,seq(n[ii] ,ii=l .. dd)]], interface(quiet=false);
writeto(terminal);
[writem, output , end:
139
Biographies
Johannes Grotendorst obtained his doctoral de-
gree in theoretical chemistry at the University of
Regensburg and his background also includes stud-
ies in mathematics and physics at the University of
Bielefeld. Since 1988, he has been at the Institute
for Applied Mathematics at the Jiilich Research
Center (KFA). His current research interests in-
clude integration of symbolic and numeric compu-
tation techniques for mathematical problem-
solving in applied science, extrapolation methods
in theory and practice and parallel computing in
computational chemistry.
Jiirgen Dornseiffer obtained his diploma in chem-
istry at the Technical University of Aachen
(RWTH) and is currently a Ph.D. student in the
Institut for Applied Physical Chemistry at the
Jiilich Research Center. His research interests in-
clude the conversion of hydrocarbon waste mate-
rials by steam reforming.
Siegfried Schoberth obtained his doctoral degree
in microbiology at the University of Gottingen.
He is currently a research scientist in the Institute
for Biotechnology at the Jiilich Research Center.
His research interests include "in vivo" NMR spec-
troscopy and general microbiology.
The authors may be reached at:
Research Center Jiilich
0-52425 Jiilich
Fed. Rep. Germany
140
MAPLE V ANALYTICALLY CALCULATING PLANE STRAIN
FE-MATRICES WITH ROTATIONAL DEGREES OF FREEDOM
G. Zirwas
Lehrstuhl fOr Baumechanik, MOnchen, Germany
141
i FE-Method, U in has to be integrated either
of the fields of displacements u is built up by an
antisymmetric part of rotations numerically or analytically (symbolically)
142
unit global
/
/
/
/
/
/
/
/
/
/
(xb,yb)
Three lines at the boundary and three going through of unknowns a shifted element with xa=O and ya=O
the midpoint are used is used. The three nodes are:
to build up as equations of planes the shape- The global geometry depends on the three nodes and
functions fm[l] to fm[9]. the unit coordinates. It is a projection from the sJ' S2
to the X (Sp S2) =Xi2 (SI,S2)
i2
fin[I]:=g[2] ;
fm[2]:=g[3] ; i2 ( ) _ i 2 i,
X tri8llg1 Sl' S2 - roomer
• fin i (Sl' S2 ) .
1
fm[3]:=g[l] ;
fin[4]:=g[2]*g[3] ;
xtri[I]:=O; xtri[2]:=0;
fm[5]:=g[2]*g[3]*g[4] ;
for il to 3 do ### 3 nodes.
fin[6]:=g[I]*g[3] ;
for i2 to 2 do ### 2 coordinates.
fin[7]:=g[I]*g[3]*g[5] ; xtri[i2]:=xtri[i2]+ri[i I ,i2]*fin[i 1];
fin[8]:=g[I]*g[2] ;
od',
fin 9:= 1 * 2 * 6 ;
od:
Nine shape functions for both of the displacement
A well known equation of tensor analysis states how
fields UX1 (81, ~) and UX2 (81, ~) in global to derive the base vectors. Because the curvature is
directions XI and x2 leads to 18 degrees of freedom. zero, they are constant and the situation becomes
To evaluate the projection of a triangle from unit simple.
coordinates to global coordinates only the linear
shape functions are needed. To decrease the number
143
integration. We seek the inverse relation from
X ( 5) ,52) to t ( XI , x2 ) for the chain rule in
i2 2
=)ds,]
_I _I
for it to 2 do
for i2 to 2 do
### flat base vectors gJ2..
a2
dSI
00;
00: and vice versa for the total derivatives written in a
matrix notation:
The determinant dF measures the changed size of
differential areas dx1dx2 =dF . ds)ds2 for later
cs) _ yc cs( _ xc
[G~O] [~:J =
& I xb yc - xc yb &2 xb yc - XC yb
[:::] - -CS2 =- ---"----
yb cs 2 _ xb
~
[IG] &) xb yc - xc yb &2 xb yc - XC yb
12
I
&.I)
3
& 12
~
for it to FAZ do JUSiliJ
u[1]:=u[1]+Can[2*il-1]*frn[il];
u[2]:=u[2]+Can[2*il ]*fm[il]; for il to 2 do
00: for i2 to 2 do
Jus[i I,i2]:=diff(u[iI],s[i2]);
Two material constants of Lame adjust the energy 00',
density in linear elasticity. It is a linear combination 00',
V in = c) VI + c2 V2 of two parts. The
combination depends on whether you have plane for il to 2 do
strain or plane stress. The Jacobian Jux for i2 to 2 do
Jux[il,i2]:=O;
for i3 to 2 do
Jux[i l,i2] :=Jux[il,i2]+Jus[i l,i3]*IG[i3,i2];
### chain rule for partial derivation
00',
has to be used. UI and U2 are positiv definite in the 00',
coefficients of the Jacobian Jux. 00',
The integration with respect to unit coordinates 5)
and 52 has to be taken into account by scaled
ImcI=mu. differential areas. The term Uln that remains from
UI:=Jux[I,I)A2+Jux[2,2]1\2+
144
the U1 portion of the energy is ready for integration d[ 6] :=subs(s[1]=0,s[2]=O,Jus[2,2]):
(numerical or syrnbolic(analytical». d[ 7]:=subs(s[I]=I,s[2]=O,u[I]): ### 2. node
d[ 8]:=subs(s[I]=I,s[2]=O,u[2]):
IUln:=UI*dF: d[ 9]:=subs(s[I]=I,s[2]=O,Jus[l, I)):
d[ 10]:=subs(s[1]=I,s[2]=O,Jus[ I,2)):
FE-Method extremises, as an approximation, the d[II]:=subs(s[I]= l,s[2]=O,Jus[2, I)):
inner energy d[ 12]:=subs(s[1]=I,s[2]=O,J05[2,2)):
1 .. d[13]:=subs(s[I]=O,s[2]=I,u[I)): ### 3. node
Uelement -- 2 Ki l i 2 d "d '2 d[ 14]:=subs(s[I]=O,s[2]=l,u(2)):
d[ 15]:=subs(s[I]=O,s[2]=I,Jus[ I, I)):
which depends on the stiffness matrix and the d[ 16]:=subs(s[I]=O,s[2]=I,Jus[ I,2)):
displacements d, which are up to now the d[17] :=subs(s[1]=O,s[2]=I,Jus[2, I)):
generalized ones, Can. Therefore the stiffness d 18 :=subs(s I =O,s 2 =1,Jus 2,2 ):
coefficients are the second derivatives of the stored
energy The dependency OC[il,i2] of nodal degrees of
freedom d[il] on the Can[i2] are inverted to the
dependency CO[il,i2] of the Can[il] on the nodal
degrees offreedom d[i2]. The linear transformation
is applied.
and here
for il to OOF do
for i2 to OOF do
OC[i I,i2]:=diff(d[i I],Can[i2));
od;
od:
In the nonlinear situation this is the tangent stiffness CO:=inverse(DC):
matrix. The double integration over the unit COt:=transpose(CO):
triangular area is split up for every coefficient in the KG:=multiplv(COt,multiplv(KI,CO»:
FE-Matrix, in order to manage the integration
workload. What we get in this step is a stiffness The Jacobians at the nodes are, for KG, still in a
matrix KI for generalized displacements Can. mixed formualtion. In a last transformation Txst the
displacements u are left invariant but the Jacobian
for il to OOF do Jus is expressed by the Jacobian Jux. The
for i2 to OOF do transformation appears as a block matrix for all
KII[il,i2]:=diff(Uln,Can[il],Can[i2)); three nodes
### stiffness-Integrand.
KI [i I,i2] :=int(int(KlI[i I,i2],s[1]=0..(1- ou X.
= ou X.
OS 12
od',
od:
We start to substitute Can by enumerated nodal or in matrix notation for every node
displacements, which are the coefficients of the
displacement vector and the Jacobian at the nodes.
The coefficients in the Jacobian can be realized as
degrees of rotations and stresses. To manage an
inversion of this 18 by 18 matrix the mixed Jacobian
Jus at the nodes has to be used.
145
1 U2
1
u) U)
&1 &2 Ul ,x2
U2 U2
&1 &1
U),SI &1 &2
U),x 1 U2,xl
=
U1,sz ~ &2 U1,xz
X Ul
U 2,st &) &2 U2,Xl 2
&) &) U 2,x z
U2,sz
&1 &2
~ ~
ITRT:=multiply(Txstt,multiply(KG,Txst»:
TRJ:j = TRJ:j(xb,yb,xc,yc).
146
A few results:
or FORTRAN.
Concluding Remarks
analytical symbolic integration.with MapleV
Without influencing the basic solution process a
varying family of element fonnulations are derived. and
Condensing degrees of freedoms at the nodes, the
number of unknowns can be lowered from 18 automated and optimized C or FORTRAN code of
(TRT18 complete gradient) to 12 (TRT12 only the matrices
rotational degrees offreedom) and to 6 (CST no
rotational degrees of freedom). leads to a rational and fast application of
The MapleV solution can easily be applied to a computational resources.
pyramid shaped brick element (PRT48), with 4
nodes and 48 degrees of freedom. Downward we can
have a standard beam element in 3D.
All these elements fit together, because the fields of References
displacements at their boundaries are natural
splines of degree three. [1] K.J. Bathe. Finite Element Procedures in
Engineering Analysis. Prentice-Hall, Englewood
Application of computational resources during the Cliffs, N.J., 1982.
production of FE-codes leads to faster response at [2] K.J. Bathe and E. Dvorkin. A formulation of
the application afterwards. No numerical general shell elements - the use of mixed
integration has to be passed for every single interpolation of tensioral components. Int. 1.
element. Numer. Methods in Eng., 22,697-722, 1986.
[3] B. Szabo and I. Babuska. Finite element
Both analysis, John Wiley Sohns, 1991.
147
[4] TJR Hughes and F. Brezzi, On the drilling
degrees of freedom, Comput. Meths. Appl.
Mech. Engrg., 72, 105-121, 1989.
[5] M. Iura and S. N. Atluri, Geometrically
nonlinear membrane elements with drilling
degrees of freedom, Proc. of the Int. Conf. on
Compo Eng. Sci. (ICES 1991),393-398,
Atlanta, 1991.
[6] Flogge W., Tensor analysis and continuum
mechanics, Springer, N.V. 1986.
[7] G. Zirwas, Impedance Matrix of Viscoelastic
(layered) Halfspace, Proc. of the Int. Conf. on
Compo Eng. Sci. (ICES 1991), 1293-1296,
Atlanta, 1991
G. Zirwas
Lehrstuhl fur Baumechanik
Technische UniversiUit Miinchen
Arcisstr. 21
D-80333 Miinchen FRG
email: t5121ak@sunmail.lrz-muenchen.de
Tel: +498921058341
148
CHEMICAL ENGINEERING WITH MAPLE
149
Maple at Clarkson
In common with many other schools, undergraduate engineering students at Clarkson University are
required to take a programming course. Until this year, the language taught in this course was Fortran
(although some students received instruction in Basic). No longer will Clarkson students take courses in
Fortran (unless it be by choice); the introductory computing course has been completely revised and
Clarkson students will now be programming using the computer algebra system Maple.
The decision to abandon Fortran in favor of Maple was not reached lightly or without considerable
debate within the engineering school at Clarkson. Factors in favor of Maple included the fact that the
students were receiving some instruction in the use of Maple in their calculus classes and that the site
license allows Maple to be installed on nearly all machines owned by Clarkson. All students (regardless
of discipline) currently receive a PC when they enroll as freshmen. Clarkson's PC program has been in
place for over a decade and this year the freshmen received their computers with Maple already installed
on the hard drives of their PC.
The fact that Maple can exchange files across platforms is a great advantage for a computationally
diverse campus like Clarkson; in addition to the huge number of PCs (> 3000) there are nearly two
hundred IBM RS/6000 workstations and more than a few Suns and DECs.
150
what equations, and what numerical methods should
be used to solve (each subset of) the equations have
been thoroughly explored. Figure 3 shows an
incidence matrix (sparsity pattern) for a column
distilling a nonideal binary mixture in 10 stages. The
equations and variables are grouped by stage leading
to the familiar block tridiagonal pattern shown in the
figure; however, just two lines of Maple is all it
takes to reorder the equations so that they are
grouped by type rather than by stage. It is pertinent
to point out that although with Maple it is simple to
explore different computational strategies, Maple
also makes topics like this largely irrelevant (even if
they are interesting).
Simple phase equilibrium calculations and the Figure 3: Incidence matrix for a small distillation
creation of phase diagrams for binary systems using problem (2 components, 10 stages). The pattern is
Maple have been discussed by Taylor (1994). "upside-down" because Maple plots cannot (yet) go
from high to low on any axis.
Separation Processes
Multicomponent distillation simulations require the Four pages of Maple code is all that is required to
numerical solution of a large set of equations: solve most multicomponent distillation problems
Material balances, energy balances, and equilibrium (including the derivation of all of the equations).
(thermodynamics) equations. These equations are This compares to the many hundreds (or even
sparse, nonlinear, and can easily number in the thousands) of lines that would be needed to solve the
hundreds and sometimes in the thousands. The same problem using Fortran. Interlinked columns
literature on distillation contains scores of papers and nonstandard specifications also are simple to
discussing methods of solving these equations (see deal with (and only slightly more difficult to solve).
Seader, 1985). Issues such as what form the Figure 4 shows the McCabe-Thiele diagram plotted
equations should take, what variables should be from the results obtained by numerically solving the
used, in what way should the equations and variables equations that gave us Figure 3.
be ordered, what variables should be computed from
151
the stability of each steady state could be determined
by computing the eigenvalues of the state matrix
using Polymath. All of these things are possible
with Maple; however, Maple is capable of
evaluating the eigenvalues of the state matrix
symbolically as well!
152
solve flowsheet problems using tearing or Unfortunately, Maple currently is many times slower
simultaneous modular strategies. Maple's open than compiled Fortran when carrying out large scale
interface and powerful language makes it possible numerical computations. Maple needs better (i.e.
for engineers to create their own unit models in the faster) routines for purely numerical computing. A
Maple programming language; others would then be fast sparse linear equation solver, for example,
able to use them as plug-in modules in their own would go a long way to making large scale
problems if these modules were to be made flowsheeting problems and multicomponent
available. distillation problems a practical proposition. For
now, you can set up the problem with Maple and
More Maple then translate the results into Fortran (or C) so that
you can compile the application yourself.
There are, of course, a number of ways in which
Maple needs to be improved. Many models in chemical engineering consist of
large sets of (stiff) ordinary differential equations,
Maple needs to gain the ability to read and write (ODEs) mixed systems of differential and algebraic
binary direct access files (as is possible in Fortran equations (DAEs) or partial diffemtial equations
and C). This will make it possible to access (PDEs). Fast numerical methods for stiff ODEs,
databanks of physical property data for direct use in DAE systems, and for solving PDEs by, for
engineering calculations. example, the method of lines would be very
Maple needs improved symbolic capabilities. There welcome.
are many engineering formulae where it is necessary
to differentiate arbitrary sums and products (Le. a Maple's graphics capabilities, although quite good,
sum or product of indexed variables where the could be improved by adding more basic plot types
index range is non-numeric: i.e. i = l..c). The fact that are encountered often in (chemical) engineering
that Maple cannot do this is a very serious (triangular diagrams and their three-dimensional
impediment to using Maple for certain important counterparts are examples that come to mind).
problems (e.g. the derivation of thermodynamic
properties of mixtures). We also need to be able to Conclusion
(elegantly) exclude selected elements from sums and
products of indexed variables. In this article we have highlighted only a few ways
in which Maple can be used in chemical engineering
A great many problems in chemical engineering education. Additional applications of Maple are
require finding numerical solutions to large (or listed in Table 1. Some of these worksheets are
small) systems of (sparse) nonlinear equations. This included in the Maple share library (and which is
is not one of Maple's strengths. The floating point provided as part of the new Release 3 of Maple V),
solver built into Maple lacks some of the features others are available from the first author. We have
that one would like to see. In particular, it is not also identified a few areas where Maple needs
possible to provide the initial estimates or to control improved capabilities.
the iteration history. On the other hand, it is
possible to program Newton's method in Maple so The fact is that Maple can have a significant impact
that all the user must provide is a set of equations, a in almost all areas of chemical engineering
list of unknown variables and a starting point; Maple education. However, there are some problems
can compute the Jacobian symbolically thereby associated with using Maple in existing courses.
removing one of the major chores that must be faced
when using the method as part of a Fortran program. Using Maple to derive expressions that are standard
In fact, Maple is used for precisely this purpose fare in current engineering textbooks will rapidly
within some companies that write software for demonstrate that it is not always easy to get from
process engineering simulations. Differential Maple an answer that you recognize. It may be
arc-length homotopy continuation methods, quite trivial for Maple to solve your problem
recommended by Seader (1985) for solving difficult correctly but it can require considerable skill in
nonlinear problems, also may be easily (and expression manipulation in order to get a familiar
elegantly) programmed in the Maple programming result. While this may not be important in solving
language. original problems, it can make matching the results
153
Table 1: Maple Worksheets in Chemical Engineering
2. Thermodynamics
(a) Critical constants for cubic equations of state (Taylor and Monagan, 1993)
(b) Phase equilibrium calculations and phase diagrams for ideal systems (Taylor, 1994)
(c) Activity coefficients in binary and multicomponent systems
(d) Gibbs free energy surfaces
(e) Phase equilibrium calculations for nonideal systems
(f) Flash calculations for ideal systems
(g) Advanced flash calculations
(h) Thennodynamic property relations and the Maxwell equations
3. Reaction Engineering
(a) Material balances in tubular reactors
(b) Isothennal tubular reactor (multiple reactions, numerical integration)
(c) Nonisothennal tubular reactor
(d) Multiple steady states in a CSTR
(e) CSTR dynamics
(f) Fitting reaction rate coefficients to rate data.
5. Numerical Methods
(a) Newton's method for systems of equations
(b) Homotopy-continuation for systems of equations
154
Fogler, H.S., Elements of Chemical Reaction with many aspects of Maple, from programming and
Engineering, 2nd Edition, Prentice-Hall, Englewood writing documentation to providing user support,
Ciffs, NJ (1993) and teaching Maple courses.
Reklaitis, G.V., Introduction to Material and Energy The authors are writing a book entitled "Chemical
Balances, McGraw-Hill, New York, 1983. Engineering with Maple".
The Authors
155
IVA. MAPLE IN EDUCATION
MAPLE LABS AND PROGRAMS FOR CALCULUS
Abstract
curves in two and three dimensions. This pa-
This paper describes work done over the past per gives a brief summary of all the routines in
three years at Worcester Polytechnic Institute the CaleP package and provides examples of how
aimed at integrating Maple computer labs and some them have been used in the course. Our
projects into freshman calculus. We give an main motivation in writing the procedures was
overview of the course structure and then provide to keep the focus of the students on calculus and
examples drawn from labs we have used. We also to keep the Maple component of the course from
describe the Maple CaleP package, a set of about becoming too burdensome. On the other hand,
thirty Maple procedures written at WPI for use we do encourage the students to learn Maple by
in the course. using it to solve problems and students with pro-
gramming backgrounds are encouraged to learn
a little about programming. In fact, the second
Introduction author of this paper was a student in the Maple
calculus course who went on to help with the
For the past three years, we have been working on
programming in his second year at WPI.
introducing Maple into the calculus course taken
by nearly all entering freshmen at WPI. Most of The routines we have written have been col-
our students are engineering majors of one sort lected together in the form of the Maple package
or another, so they need to be able to use cal- CaleP, including help pages for each procedure in
culus to solve problems. Our main goals in in- the package. (For calculus with projects - see
troducing Maple into the course were to expose the course description below.) They have been
the students to a CAS, which we see becoming tested with the Xll/UNIX and PC-Windows
a standard tool for any technical profession, and, versions of Maple V, Release 2 and Release 3.
more importantly, to focus the students' atten- They are available by anonymous ftp from the
tion away from the details of manipulation and host wpi. wpi. edu in the files Cale/CaleP. R2 and
onto the fundamentals of using calculus to solve Cale/CaleP. R3. If there is sufficient interest, the
problems. package will be submitted to the Maple share li-
In the course of developing labs and projects brary. Maple users are encouraged to obtain and
for use in the course, we have written about use this package. Report any problems of bugs
thirty different Maple procedures for use by the to the first author, preferably via e-mail at the
students. They range from visualization tools for address bf arr<Owpi. edu.
topics like Newton's method and solids of revo-
lution to routines for computing curvature and
normal and tangential acceleration for parametric Course Format
Calculus classes at WPI normally meet four times
a week. The regular academic year consists of
four seven-week terms, each roughly equivalent
to a quarter in terms of contact hours. For the
Maple calculus sections, one of the four weekly
159
class meetings takes place in our computer lab, package. Examples are provided in the next few
equipped with 22 DECstation UNIX worksta- sections.
tions.
When students arrive at the lab, they are • The CalcP package contains three proce-
given a two-to-four page handout that contains dures that are useful in the visualization
background material on the lab topic, examples, and manipulation of polyline approxima-
and a set of exercises for them to complete. The tions to a function.
students work in pairs on the lab. During the lab ArcInt displays the integral to calculate
period, the instructor and student helpers circu- the actual arc length of a given func-
late around the room, providing help and answer- tion. It can be used to find a numerical
ing questions. Students generally do not complete value as well.
the lab in one hour. On the contrary, our inten-
PolyLength gives the numerical value of
tion is to provide a mix of routine computations
the arc length of a polyline approxi-
and challenging exercises in the labs. The stu-
mation to a function.
dent teams have about a week to finish the exer-
cises and write them up in the form of a joint lab PolyLine displays the graph of a polyline
report. approximation to a given function.
To encourage reflection, investigation, and un-
• Sequences defined by functional recursion
derstanding on the part of the students, we re- are handled by the following four proce-
quire that the lab reports consist of three parts. dures.
In the first part, the students are to describe in
their own words the main ideas of the lab. The PlotSeq plots the points of a recursive se-
second part consists· of their answers to the exer- quence.
cises, including explanations of what they did and Recur returns only the nth value of a re-
why. The last part is a Maple worksheet contain- cursive sequence.
ing the details of their work on the lab. We note
Sequence displays the first n values of a
that requiring this format makes the labs much
recursive sequence.
easier to grade; we don't have to dig through the
worksheet to figure out what they did. ShowSeq displays a graph of the values of
Students in the Maple course also spend about a recursive sequence. It differs from
three weeks per term working in teams of three PlotSeq in that it graphs the sequence
to four students on a project. These are gener- generator and the line y = x. It then
ally more involved applications of calculus, re- connects the points of the sequence to
quiring modeling and analysis on the part of the these two curves by line segments. The
students. Recent projects have ranged from de- resulting plot is a graphical interpreta-
sign of a roller coaster loop to analysis of crank tion of the convergence of a recursive
shaft diameter - connecting rod length tradeoffs sequence.
in engine design. Each group produces a joint
• Plotting of parametric curves in two and
report, with the teams having about two weeks three dimensions is performed by the fol-
to produce a draft report, which is criticized and lowing four procedures.
returned. The teams then have about a week to
produce a final draft upon which their grade is ParamPlot animates the drawing of a two
based. dimensional parametric plot.
Students in the Maple course also have tradi- ParamPlot3D animates the drawing of a
tional homework and exams, counting for approx- three dimensional parametric plot.
imately 30% of their final grades. The five labs
SurfLoop plots a two dimensional para-
and one project per term count for the remainder.
metric curve on a three dimensional
surface.
Maple programs Loopimate animates the drawing of a
parametric curve on a three dimen-
This section provides a brief description of the sional surface. Used in the study of
each of the Maple procedures defined in the CalcP surfaces and their parameterization.
160
• Solids of revolution can be explored using • The following are related to linear and
the following CalcP procedures. higher order approximations to func-
tions, including applications like Newton's
LeftDisk graphically displays the solid of method for solving single equations.
revolution for a function approximated
by disks or washers. Newton computes the Newton series ap-
proximation for a root of a function.
LeftInt returns the volume of the solid of
revolution approximated by n disks or NewtonPlot plots the function and the
washers. Newton series approximation to the
root of the function.
RevInt displays the integral to calculate
the volume of the solid of revolution of secantline returns an expression for a line
a given function. The numerical value that intersects a given curve in exactly
can also be computed. two places.
revolve plots the solid of revolution tangentline returns the expression for a
formed by rotating a given function line that is tangent to a given curve.
about a specified axis parallel to the TanPlane returns the expression for a
x-axis. plane that is tangent to a given three
dimensional surface.
• Several procedures for studying parametric
Taylor returns the expression for a trun-
curves can be found in the CalcP package.
cated Taylor series approximation to a
In the following descriptions, "vector func-
function. Unlike the standard Maple
tion" refers to a function of a single real
procedure taylor, Taylor is a polyno-
variable, with values in R 2 or R 3. mial that can be manipulated in the
Curvature computes the curvature of a usual manner.
two or three dimensional vector func- TayPlot shows the effectiveness of vary-
tion. ing Taylor polynomial approximations.
It plots the function itself along with
NormAccel returns the magnitude of the
specified Taylor polynomial approxi-
normal acceleration along a vector
mations.
function.
normalvect returns the unit normal vec-
tor to a given two or three dimensional Examples
vector function.
In this section, we provide examples of labs and
Speed returns the scalar speed of a parti- Maple programs.
cle moving along a two or three dimen-
sional vector function.
Definition of the derivative
TanAccel returns the magnitude of the
tangential acceleration along a vector In this lab, students use the secant line proce-
function. dure from the CalcP package to investigate and
compare the algebraic definition of the derivative
tanvect returns the unit tangent vector to
as the limit of the difference quotient and the ge-
a vector function.
ometric definition as the limiting slope of secant
unitvect creates a unit vector out of a vec- lines. As the examples given below show, the
tor or two endpoint of a vectors. secantline procedure takes three arguments: an
VDiff returns a vector which is the deriva- expression or procedure f, a base point a, and an
tive of a vector function. increment h. The result of the procedure is the
Maple expression for the straight line between the
VMag calculates the magnitude of a vec- points (a, f(a) and (a+h, f(a+h)). As also shown
tor. below, the result can be displayed, plotted, and
VPlot plots the graph of a two or three di- even animated. Figure 1 below shows the result
mensional vector function. of the plot command in the example.
161
> f := proc(x) x 3+2*x+l end;
4
2.250000000 x + 1
f := proc(x) x 3+2*x+1 end
4
> plot({f(x),secantline(f,x=O,l),
> secantline(f,x=0,1.0); secantline(f,x=0,0.5)},x=0 .. 1);
> with(plots):
3.000000000 x + 1 > animate({f(x),secantline(f,x=l,l-t)},
> secantline(f,x=0,0.5); x=0.5 .. 2.5,t=0 .. 0.99);
12
10
4 +0.15 if x ~ 20
162
Figure 2: Solid of revolution and ten disk approximation.
The following Maple session shows the steps elif x < 10 then 0.15
needed to define this function and plot the solid elif x < 20 then sqrt(x-l0)/2+0.15
of revolution. Notice the quotes in the revolve else sqrt(10)/2+0.15 fi
call to delay evaluation. end:
> revolve('g(x)',x=-1 .. 30,nocap)j
> g := proc(x) if x<O then -x~3+0.15
163
wrote a procedure TayPlot that plots the func- In the labs, the students use these two commands
tion on the same graph as a set of Taylor polyno- to investigate convergence of Taylor polynomials
mial approximations. Examples are shown in the and the use of known Taylor series to generate re-
Maple session below and Figure 4, which shows lated Taylor series via multiplication, division, or
the output of the TayPlot command in the Maple substitution. For example, the series for exp(x 2 )
session. Notice the use of the numpoints param- is obtained by substituting u = x 2 in the series
eter. The TayPlot command will accept any of for exp(u), as is partially shown in the Maple ex-
optional arguments to the plot command. ample below.
> Taylor(sin(x),x=0,5); > subs(u=x 2,Taylor(exp(u),u=0,4»;
A
3 5 2 4 6 8
x - 1/6 x + 1/120 x 1 + x + 1/2 x + 1/6 x + 1/24 x
> Taylor(exp(x),x=1,3);
exp(l) + exp(l) (x - 1) + > Taylor(exp(x 2),x=0,8);
A
2 246 8
1/2 exp(l) (x - 1) + 1 + x + 1/2 x + 1/6 x + 1/24 x
3 By using Maple, it is easy for the students to ex-
1/6 exp(l) (x - 1) periment with Taylor polynomials and discover
> TayPlot(sin(x),x=0,{13,31}, for themselves, for example, the reason why the
x=O .. 6*Pi,y=-2 .. 2,numpoints=100); orders had to be different in the two commands
above to obtain the same order Taylor polyno-
mial.
-2
Figure 4: Plot of sin(x), along with the Taylor polynomial approximations of orders 13 and 31.
Vector calculus of parametric curves the Maple animation commands to show the ac-
tual motion along a parametric curve in two and
three dimensions. Some simple examples are
This topic often seems to be given short shrift in
shown in the Maple session below. Several of the
typical calculus courses. With help from Maple,
routines use the linalg package, though all will
it isn't too hard to give this the attention we
accept arguments that are lists of functions rather
feel it deserves. As described in an earlier sec-
than vectors. Notice that the curve computation
tion, the CaleP package contains quite a few
routines return either an expression if the third
procedures having to do with motion on curves,
argument is a name, or a numerical value if the
ranging from the curve computation routines
third argument assigns a value to the independent
Curvature, normalveet, and tanveet to the pro-
variable.
cedures ParamPlot and ParamPlot3d which use
164
> tanvect([cos(t),sin(t»),t); 2
[ - sin(t), cos(t) ) Aw
> r := proc(t) [t,t~2,t~3) end;
r := proc(t) [t,t~2,t~3) end 222
> TanAccel(r(t),t); A w +b
3 > NormAccel(helix(t),t);
4. t + 18. t 2 2 4 4 6 1/2
(b A w + A w)
2
4 1/2
(1. + 4. + 9. t )
t 2 2 2 1/2
> TanAccel(r(t),t=l); (A w + b )
5.879747321 > simplify(NormAccel(helix(t),t»;
> Curvature(r(t),t); 2
4 2 1/2 Aw
(9 t + 9 t + 1) # exercise 2
2 -------------------- > ellipse := proc(s)
2 4 3/2 [50*cos(s),40*sin(s)] end;
(1 + 4 t + 9 t ) ellipse := proc(s)
With Maple to do the tedious manipulations, the [50*cos(s),40*sin(s)] end
> VPlot(ellipse(s),s=-Pi/2 .. Pi/2);
students can be given exercises to work on that
> Curvature(ellipse(s),s)i
would probably not be possible by hand. Alter- 2000
natively, the students can shift their focus away
from the manipulations to the results. Below, we 2 3/2
list two sample exercises that have appeared in abs(- 900 cos(s) + 2500)
our labs.
The maximum curvature occurs at s=O.
Since the normal acceleration
1. Consider the helix is given by kappa*v~2, where kappa
is the curvature and v is the
r(t) = A cos(wt)i + A sin(wt)j + btk. speed, the result can be obtained
by solving the equation
(a) Show that the speed is constant. How
does it depend on the parameters?
(b) How do the curvature and the nor- for the maximum speed v_max.
mal acceleration depend on the param- > kappa_max:=
eters? Curvature(ellipse(s),s=O)i
kappa_max := 1/32
2. A hairpin turn on a roadway can be approx- > v_max :=
[solve(0.3*32=kappa_max*v~2,v)] i
imated as half of an ellipse, including the
v_max := [-17.52712185, 17.52712185]
major (longer) axis. If the major axis is 100 > speed_max := v_max[2]*3600/5280j
feet and the minor axis is 80 feet, what is # speed in miles per hour
the maximum constant speed at which a car speed_max := 11.95031035
can go through the turn while keeping the The hairpin curve produced by the VPlot com-
centripetal acceleration less than 0.3g? mand is shown below in Figure 5.
The Maple sessions below demonstrate how the
CalcP procedures can be used to do the compu- Conclusions
tations needed to answer these questions.
# exercise 1 The use of Maple labs and projects in calculus at
> helix := proc(t) WPI has been successful, with the department
[A*cos(w*t),A*sin(w*t),b*t) end; moving toward full adoption in the Fall of 94.
helix := proc(t) The students struggle at first, but most eventually
[A*cos(w*t),A*sin(w*t),b*t) end
> Speed(helix(t),t)i come around. With the aid of Maple, students
2 2 2 1/2 can certainly tackle problems that could not be
(A w + b ) done by hand, but we have found that there is an-
> Curvature(helix(t),t)i other aspect of using Maple that we did not really
165
anticipate. Simply stated, to use Maple to solve Institute. For the last three years he has been
problems the students first have to understand involved in restructuring the calculus curriculum
what they are doing and second to know how to there. His research interests are in the areas of
translate what they want to do into Maple com- studying how students learn and bifurcation the-
mands. For some students, both of these steps ory with symmetry. He can be reached via e-mail
are real impediments. However, we have noticed at bfarr«lwpi. edu. Michael VanGeel was a stu-
that for most students the first problem, that of dent in the new calculus course the first time it
understanding, is the more difficult problem. To was taught. The next year he was extensively
our way of thinking, forcing the students to un- involved in writing the CalcP package described
derstand what they are doing is not a bad thing. above. He has since moved on the the University
of Illinois at Champaign/Urbana, where he will
be a senior next year.
Biographical information
William Farr is currently an associate professor of
Mathematical Sciences at Worcester Polytechnic
401t - -_ _
20
10 20 30 40
-20
-40+-----
166
MAPLE AT THE UNIVERSITY OF NORTH LONDON
Graham Taylor-Russell
School of Mathematical Sciences, University of North London, London, UK
167
ii) The use of Maple in Calculus problems. One problem that has been used in each of the
Here the intention is to underpin the students' last two years is to investigate the structure of
knowledge of techniques by extended examples perfect numbers and we now reproduce the
which might not be feasible without a computer documentation issued to students undertaking
algebra system. Students without a strong this task:
mathematical background are introduced to the
Student Calculus package of Maple and are
presumably given an idea of the way the
techniques they may have only recently mastered
INVESTIGATION PERFECT
can be applied. A toolbox of techniques is thus NUMBERS
made available to them which they may use
subsequently in units requiring a knowledge of
calculus. Definition:
iii) The main section of the unit aims to The number n is said to be perfect if the sum
foster investigative skills by providing students of all the divisors of n (including 1 but not n
with intensive assignments which give them a itself) is equal to n.
grounding in the techniques of mathematical
discovery which will stand them in good stead Thus 6 is a perfect number since 6 = 1 + 2 + 3.
throughout their university career and beyond.
Each student undertakes assignments from a
bank of investigative problems and is expected The following Maple procedure tests whether
to submit a full report on at least one, the report a given number is perfect. Note that
forming a significant proportion of the marks for commands such as divisors are only available
the unit (which is assessed by means of after the number theory package has been
coursework and a practical exam). They are also loaded.
encouraged to give oral presentations on their
conclusions to the rest of the class.
isperfect:=proc(j)
Since the background of the students is so varied local k,z,divsum;
it was decided that the fairest approach was to z:=divisors(j);
choose assignments with which no student was divsum :=sum(op(k,z),k=l ..nops(z»;
expected to be familiar. The vehicle chosen for if divsum=2*j then
many of the assignments was number theory. RETURN(true) else
This was because RETURN(false); fi;
od
a) There was a wealth of problems which end;
could be specified and introduced to students
without the need for large amounts of
background lecturing. Often all that was required Note:
was a few definitions and a motivation of why
the problems might be interesting. When this The variables op(k,z) and nops(z) are Maple
was not sufficient the lecture time (which variables which record respectively the kth
previously had been devoted to practical Maple operand of z and the number of operands.
concepts) was used to introduce theory.
Thus sum(op(k,z),k=l ..nops(z»;
b) Many of the problems in this area lend
themselves to investigation by computer computes the sum of the divisors of j.
techniques.
168
EXERCISES:
n 2°-1 (2° - 1) isperfect ispri
1. Type in this procedure and check that (2 0 - 1 (2° - 1» me(n)
it produces sensible answers when you try 1
2
isperfect(6);
3
isperfect(10);
4
isperfect(28);
5
6
2. 6 and 28 are known to be the first 7
two perfect numbers. In this question we want 8
to find the next perfect number and 9
eventually we would like to make a list of the 10
first few perfect numbers in order to make a 11
conjecture about their structure. 12
13
Write a procedure incorporating the test 14
isperfect within a for loop to create a new 15
procedure that finds the first perfect number
after a given starting point. 6. Try to refine your conjecture in the
light of the information contained in the table.
169
MORE ON PERFECT NUMBERS EXERCISES
1. Add up all the digits of n. b) Show that all the perfect numbers
Call the result of this operation you have found are triangular.
digitsum(n).
c) Can you find a relationship between
2. Add up all the digits of the structure of a perfect number and the
digitsum(n). value ofk.
[This is not easy unless you try to show that n Having run the course for two years using this
=:1(mod9) instead] and similar assignments (covering Fibonacci
numbers, the Four Squares Theorem and prime
testing) the positive conclusions that can be
b) Verify the result for the first 7 perfect drawn are:
numbers.
• Students are motivated to work significantly
harder using this kind of approach. At times
this almost became a problem as there was a
danger of other courses being neglected.
B. TRIANGULAR NUMBERS
• Students appreciate that mathematics is not
a complete body of truths set down in stone
Definition: but that mathematical discovery often
proceeds by informed guesswork.
The number n is said to be triangular if
• The theoretical concepts introduced appear
n=I+2+3+ ... +k more relevant after students have struggled
to identify patterns and derive conjectures
for some number k. themselves.
170
3. The use of Maple as a 1) Find a Schreier transversal U for H
in G. This is a set which satisfies the
support tool in final year following:
projects
a) Ie E U
Students enrolled on all degree courses in the
School of Mathematical Sciences are required to
undertake an extensive project lasting either one b) U contains exactly one
or two semesters in their final year. It is expected element from each coset of H in G.
that this should involve an element of
investigative work as well as the acquisition of
theoretical knowledge and Maple has been a c) If w E U then so do all
useful tool in this aspect of the work. An left subwords ofw.
example of the possibilities is given below:
a b c a-I b- 1 C"l
Example:
UI
Suppose G = (a, b, c labc = b, bca = c, cab = a)
u2
Calculate a presentation for the subgroup
H = (ab, bc, ca ). u3
...
The problem can be broken down into four
steps: ur
171
where the u's are the elements of the • Using Maple as a computational device
transversal calculated above. allows students to encounter more
complicated examples than would otherwise
be possible.
3. Calculate the complete relation set
Suppose r' = x t x2 ••• xn E R' and define Graham Taylor-Russell is currently a lecturer in
elements u j and a j inductively as follows the School of Mathematical Sciences at the
University of North London. He received a BSc
ut = 1 in Mathematics from the University of York and
uj + t = cosrep( UjX j ) (1 ~ i ~ n) a PhD from London University in 1990. His
a j = uj xj uj + 1- t research interests are in combinatorial group
theory and the solution of equations over groups.
He may be contacted at
The rewritten version of r' is then the relation
at a 2 a3 •••• an and each a is an element of
the generating set A. School of Mathematical Sciences
University of North London
Having completed these steps we have a Holloway Road
presentation for H with generators A and London N7 8DB
relations as calculated in 4. Use the Maple U.K.
command pres to check your answers to this
and other examples. You will probably find
redundant relations in your presentation
which can be eliminated using Tietze
transformations.
172
INTRODUCING MAPLE TO FIRST YEAR ENGINEERING
STUDENTS VIA PROJECT STUDY
Ulf R"mnow
Department of Mathematics and Computer Science,
Institute for Electronic Systems, Aalborg University, Aalborg, Denmark
I will here describe an experiment in introducing Before a neural net can be used for a particular
Maple V for first year engineering students through classification job it must be "trained", Le. must
a project instead of, as traditionally, doing it in be presented with a series of test data, each one of
relation to the courses in Calculus and which consists of an element from the set of objects
to be classified together with information about
the correct classification of the given element. Via
this presentation the internal structure of the neu-
ral net is adjusted, and when the quality of the
classification performance has reached the desired
level, the neural net is ready to do its classification
job.
173
There are several types of neural nets [lJ. In the
present paper we will take a closer look at the neu-
ral net models of the Multi-Layer Perceptron type
(MLP), the general structure of which is shown in
fig. 3.
Mathematically, a trained net can be consid-
ered as a function mapping the set of objects to
be classified into the set of classifiers. However,
the construction and mode of operation presup-
pose that the domain of objects to be classified,
as well the range of classifiers, are represented as
vectors, which means that a neural net can be con-
sidered as a function W defined on a vector space
JRIL into another vector space IR" (fig. 2).
Figure 3: Internal structure of a neural net of the
type MLP.
where
1 __
2 __ ___I /k = X I-t [N(X)]Nk
Uk = Y I-t WkY - Ok, = 1,2, ... ,M.
---2
k
Neural Net
___ v
174
Setting
1·1
U
1
ap
k=M
aUM'
1·1
~ ap aUM aUk+l
aUM aUM-l ... aUk '
k = M -1, ... 1,
we have
175
Propagation Algorithm are run over and over, once By input/output at the end of the code is meant
for each element of the test data, until the desired input/output for the training phase, whereas the
level of performance is reached. And finally, in the input/output in the parenthesis is for the execu-
execution phase, only the Classification Routine is tion phase.
used. Even though there are no neuron functions in
The pseudo code of the central part of the pro- the O'th layer, the quantity CPo is introduced in the
gram for the neural net is presented below in the code: This permits us to use the back propagation
box. A few words of comments is needed to explain loop down to n = 1. The crucial programming line
the use of symbols and terms. in the code is
The expression ["']k means a k x 1 dimen-
sional array; in particular the symbol [ai]k Un f- wnfn-l (un-d - On
means the array [ai,a2,'" ,ak]. The expression
8v for n = 1. It becomes a valid instruction only if
j acobian( v, z) is presented in the text as 8z; the CPo is defined and the elements in CPo are assigned
term 'assign cP k' means that the function cP k is to the identity 'x ~ x'.
assigned to the k'th neuron function. Written out as Maple code the program looks as
follows.
The Multi-Layer Perceptron Net
> with(linalg):
input M, N i , i =O,l, ... ,M
Read in M, N[i]
P f- [HYD - YM]T[YD - YMJL Set up neuronf ct [i]
a f- jacobian(P, YM) > P := array(l .. l,
YM f- fM(UM) [1/2*dotprod(y(D)-y(M),y(D)-y(M»]);
fM f- {x ~ [cpf1 (x Tei)]NM} > delta := jacobian(P,y[M]);
aM f- ajacobian(fM,UM) > y[M] := f[M];
# Start of back propagation loop. > f[M] :=
for n = M, M -1, ... , 1 do array (1. . N[M] , [seq (phi[M] [i] (u [M] [i] ) ,
i = 1. . N[M]) ] ) ;
assign CPn > delta[M] := evalm(delta & *
Un f- wnfn-i (Un-i) - On jacobian(f[M] ,u[M]);
> for n from M by -1 to 1 do
for i = 1, 2, ... , N n do
> phi[n] := neuronfct[n]; #assign the
n'th neuron function
> delta[n] := map(eval,delta[n]);
for j = 1, 2, ... , N n - 1 do > urn] := evalm(w[n] & * f[n-l] -
~wij f- an jacobian (un,wij) Theta[n]);
> for i to N[n] do
end > Delta[Theta] En] [i] := evalm(delta[n]
end & * jacobian(u[n] , [Theta[n] [i]]»[l,l];
> for j to N[n-l] do
fn-l f- {x~ [cp~-i(xTei)JNn_J
> Delta[w][n][i,j]:= evalm(delta[n]
an-i f- anjacobian(un,un-d & * jacobian(u[n],[w[n][i,j]]»[l,l];
> od;
end
# End of back propagation loop. > od;
> f [n-l]
assign CPo array(l .. N[n-l],[seq(phi[n-l][i]
initialize Wk, Ok, k = 1, 2, .. , , M (u[n-l] [i]), i=1. .N[n-l])]);
> u[n]:= map(eval,u[n]);
input Uo, YD, (or uo) > delta[n-l]:= evalm(delta[n] & *
output YM, P, ~Wk, ~Ok, jacobian(u[n],u[n-l]»;
k = 1, 2, ... , M, (or YM) > od:
176
> phi[O] := neuronfct[O]: #assign the Educational benefits
O'th neuron function
> randomnumber := rand(-100 .. 100)/100.: When evaluating the educational benefits in re-
> for 1 to Mdo lation to the sketched project one question is cru-
> for i to N[l] do cial.
> Theta [1] [i] := randomnumber():
- Does Maple enhance students' under-
> for j to N[l-l] do
standing of the significance of Mathe-
> w[1] [i, j] randomnumber () :
matics, i.e. mathematical concepts, nota-
> od;
tions, definitions and theorems, etc. as a
> od;
tool whereby concrete, practical, techni-
> od:
cal problems are solved?
Input: u [0] and y [D]; (or u [0])
Output: y[M], P, Delta[w] [k], It is less important if Maple improves the stu-
Delta [Theta] [k]; (or y[M]) dents' ability to solve their problems from the
courses in Calculus and Linear Algebra, or even
The Setting Up phase can be rather (cpu-)time if Maple helps students to improve their general
understanding of mathematics.
intensive, mainly because of the jacobian-terms.
However this phase can be speeded up consider- What really matters here is the relationship be-
ably if we make use of the following calculations tween mathematics and the applications. Or bet-
ter, the understanding of this relationship.
ap I will explain a bit more. In using Maple to con-
YM struct a neural net, the students experience how
the matrix notation, the matrix algebra and the
matrix formulation of the chain rule for multivari-
ate functions facilitate their programming activi-
ties. They see that these are not just gimmicks
where interesting to mathematicians, but rather tools
whereby they really can operate. This means that
explaining mathematical rules, proving theorems
etc. now become interesting and even compelling
for the students.
and
Concluding remarks
o o The purpose of the above considerations is to
o o show another way to introduce a Computer Al-
gebra system to engineering students, that is via
project study.
aUk 0 aUk 0 Our experience is that Maple in this respect is
and -
awt Yj f-i a(Jkt -1 f-i received positively by the students. In my opin-
0 0 ion it is important not to integrate Maple - or
any other Computer Algebra system - into the
0 0 mathematical education proper, where mathemat-
ical concepts, definitions and methods are central.
as Maple is better introduced as an useful, but in-
k k (Jk dependent tool, when working with mathematical
u~ Wu w lNk_l Yl 1
models.
With our point of departure in this view, it is
uk k
Wil
k
w iN Yj
(Jk rather a question of inventing projects, such as the
t k- 1 J
above, which demand the construction of mathe-
k matical models. And in this respect the possibili-
k
w Nk w kNkNk_l (Jk
UNk 1 YNk-l Nk ties are immense; besides technical subjects, areas
177
such as physics and economics offer a wealth of
subjects.
References
[1] Richard P. Lippmann. An Introduction to
Computing with Neural Nets. IEEE ASSP
Magazine, pages 4-20, april 1987.
Ulf R0nnow
Dpt. of Mathematics and Computer Science
Aalborg University
DK-9220 Aalborg
Denmark
E-mail: ugriesd.auc.dk
178
ANOTHER LOOK AT LEARNING THE TECHNIQUES OF
ELEMENTARY INTEGRATION
Joseph A. Pavelcak
Department of Mathematics and Computer Science, Merrimack College,
North Andover, MA
179
Both of these supplements are good. language - problem solving requires the
Graphics is an excellent vehicle for ability to write mathematics.
pattern recognition. Practice in
problem solving, whether project size Exposing the student to problem solving
or textbook size, is important and methods and practices is generally
expected of a course in mathematics. recognized as being an expected and
important role of math courses, even
The Way It Might Become elementary math courses. Thus time
must be found for this tedious task,
One of the perennial difficulties within whether lab sessions are scheduled or
the calculus course sequence is the not. More importantly, the order of
shortage of time necessary for devoting topics comes into play, in particular,
sufficient attention to the requisite basic skills must be taught
topics. In order to introduce new tools or (practiced/learned) before and
topics, time must be taken from another concurrently with problem solving
topic or some topic(s) dropped out of the techniques, else this venture will move
sequence - which leads, of course, to too slowly and not have the proper
considerable debate. Thus when real- intellectual effect on the student.
world project problems are introduced,
a laboratory session is added, increasing Many instructors of the Calculus II
the number of contact hours, but usally integration segment, observe that
leaving the number of credits unchanged. introducing (trying to teach) techniques
of integration, imbedded as it is among
Impetus for such changes to the calculus other topics, usurps a considerable
comes from the emerging school of amount of time and, for the majority of
thought that places practice in problem students, is barely successful. Clearly,
solving at the head of the list of goals for a more methodical approach to
the course - ahead of the acquisition of integration must be set forth. Here is
basic skills. The rationale seems to be where Maple comes in.
that basic skills are a spin-off from
working through the project problems. Much effort, indeed man-years, has gone
One might be tempted, following this into the development of the processes
reasoning, to introduce, along with the which are invoked with the simple
commands needed for plotting, the upper command into Since Maple is open, in
level Maple commands diff. int, the sense that the code of the procedures
solve.fsolve, et. al. With these is accessible, we may exploit the work
powerful tools, a student has little and results of the designers. The
immediate need for basic skills, but this developers of the integration procedures
path bodes disaster for learning calculus in CAS's have imposed an order upon the
or any mathematics. integration algorithm which is efficient.
An excellent outline of the approaches to
The Way It Should Be symbolic integration used in CAS's is
given by Joel Moses in Communications
Problem solving facility is an ideal of the ACM August 1971, Vol. 14
difficult to reach and impossible to Number 8.
teach. To get started in the formulation
and subdivision of a problem, leading Following the same or similar approach
toward a (possible) solution, the student in the classroom presentation of the
must be comfortable with and capable of calculus, due to the efficiency of the
symbolic manipulation i.e. basic skills. method, will reduce the time currently
Mathematics is a language. As is needed to cover the topic, as well as
characteristic of languages, it takes a lot bring order to the confusion experienced
of practice before one can write in a
180
by many students in this part of the
course.
181
IV - Integration by parts. This
technique is based upon the derivative of Not all of the special integration 'tricks'
a product. The procedure intparts should be considered, since the text
from the student package is used. The gives no rationale, simply presents
student determines the factors of the these as complicated mechanical
integrand, selecting one of the factors procedures. These procedures require
for differentiation, i.e., u in: time, time which can be spent more
productively on topics such as
numerical techniques and curve fitting.
JUdv = uv-fvdu This permits the introduction of
problems, absent from the integration
chapters, for which there is no method
Invoking intparts returns the right- in the integration process tree. Such
hand side of the above equation. The problems need more attention since
student must decide how to proceed. textbooks tend to leave the impression
With the aid of Maple, trial and error that closed forms exist for all integrals.
tests can be performed rapidly. This
experimentation is an important part of The tools available in Maple will
the learning process - repetition. facilitate the learning process, but must
be used judiciously. The hope is that the
interest of the student will be tweaked to
V - Integration of rational integrand by the point that he/she will investigate the
partial fractions. Investigation of the procedures of Maple more thoroughly.
Maple procedures is recommended to the
student, since by this time he/she is
familiar with the procedures used above Appendix
and should be comfortable with the
idiosyncrasies of Maple. Through Implementation overview.
experimentation the student is expected
to find that the integration of rational In the illustrations that follow it is
functions is a difficult problem, assumed, for purposes here, that the
involving factoring procedures. student knows that the integration
operator is linear. Therefore only
All of the above require some pencil and products are used.
paper work. The algorithms are
presented with examples then the Clearly there needs to be far more
student uses Maple. explanation of the Maple operators than
is given in the appendix. However, I
believe it would not be very extensive.
Conclusion Practice is what students need and with
Maple taking care of the mechanics, the
Extracting the integration from the methods as methods will be seen more
chapters in which it is imbedded and easily. However, a major concern with
presenting the process for study in a this approach is the fact that our
unified manner will improve the students are weak in algebraic
learning of the algorithms both in time manipulation.
and retention, because the student will
see the pattern, which leads to It is my hope that this approach will
understanding. That pattern is a save some time which can be used in V
decision tree. A test is made on the (partial fractions) to clear up some of
integrand to determine its type which those difficulties with algebra. There
determines the next step (branch) in again, Maple can be used as a tool for
the process. drill.
182
Appendix 2
Illustrative Examples
I: Integration of the form c*xAn, n <> -1. The two commands introduced are 'match'
and 'subs' (substitute). The first Maple command below is 'Int' (Inert integration).
It is not used in the procedure, it simply displays the the integral.
> V',
{C= 1, Ex= S/2}
Ans := 2 x"Yz
7
A procedure can be written to generalize the above. The students are expected to improve
that procedure, e.g. include the case for n = -1. A starter is "Integrate".
Y +1
183
II: Here the student uses his/her knowledge of differentiation to generate a table of
antidifferentiation formulas. The table can be as comprehensive as the student wants to
make it. Below is an example table and its use.
It is pointed out that an 'else' clause can be included in the "Integrate" procedure, which,
along with a table similar to this one, would give the student a fairly good integration
routine.
Some examples.
> IntSet[sin](x);
- cos(x)
> IntSet[sec*tan](u);
sec(u)
> IntSet[tan](X);
- In( sbs(X»
> IntSet[sqrt](x-l );
~(X_l)3/2
3
> IntSet[sec](x+4);
In(abs(sec(x+4) + tan(x+4»)
Questions for the student: Is it correct to use any argument in the above integration by
table lookup? What, if any, are the restrictions? Use Maple 'int' to check.
184
III: Substitution is based upon the chain rule in differentiation. The student is asked to
perform some pencil and paper examples in a stepwise fashion, then do the same with the
help of Maple.
2 3
Integrand:= 5 x sin(x )
true
> V',
{Exx = 3, C = 5, Ex = 2}
Pow:= 3
Div: =3 x 2
true
5 3
Ans := - - cos(x )
3
To write a general Maple procedure for this, requires learning more of the language
than we expect of the student. Perhaps some will be interested enough to try.
The student must specify the conditions under which the above algorithm will work.
IV: Integration by parts is based upon the derivative of a product. The student will
perform trial and error experimentation using the Maple 'intparts' to do the mechanical
work.
Ju dv = f
uv - v du
185
An approach usually suggested is to chose that part of the integrand which you know how
to integrate for dv, the remainder is then u. Alternatively, chose that part of the
integrand for u , which, upon differentiation becomes simpler.
Some examples.
1/2 exp(x) x
2
- II/2exp(x) x dx 2
Poor choice for u, since the remaining integral is more complicated than the original.
xexp(x) - Iexp(x)dx
.
arcsm(x) x -f(I-x)
x
2 1I2 dx
The student will need to apply these methods to perform the remaining integrations.
186
WORKSHEETS: CAN WE TEACH MATHEMATICAL
ALGORITHMS WITH THEM?
Michael Monagan
Departement Informatik, ETH Zurich, Switzerland
187
The question being asked in this paper is: Is to compute the eigenvalues of a square
there any role for a CAS in teaching students matrix
mathematical procedures (algorithms)? Can > restart; # clear all variables
this be done effectively through worksheets? > with(linalg,matrix,det,nullspace);
It appears to be considerably more difficult to
use a CAS to teach an algorithm, than just to [det, matrix, nullspace]
'do' a calculation and look at the answer.
Perhaps the answer is: yes, good students > A := matrix([[a,b],[b,a]]);
would profit from this exercise, but average
students would find it difficult.
188
-a + A -b of local variables should not be avoided by
-c ] not declaring them to be local. That would be
C:= -b -a +A -b bad programming. Since the concept of local
[ variables is present in every programming
-c -b -a +A language, and will have been met by every
> P := det(C); student who has taken an introductory course
in programming, this level of programming
2 3 language knowledge should be considered
p := -a 3 + 3 a2 A- 3 a A + 2 a b2 + A
acceptable for a mathematics class.
-2Ab2-2cb2+c2a-c2A The following example arises in the study
of Huckel molecular orbitals in organic
> p := factor(p);
chemistry.
p := ( -a + A+ c) > A := matrix([[a,b,O,O],[b,a,b,O],[O,b,a,
2 b],[O,O,b,a]]);
( A - 2 a A- c A+ a2 - 2 b2 + c a )
a b o o
> solve(p=O, lambda);
b a b o
A .-
·-
a - c, a + !2
c +! 2 ' Jc 2 + 8 b2 o b a b
o o b a
a+!c-!Jc2 +8b2 > eigenvalues(A);
2 2
189
understand it better, and you will be able to
L
n
use the same technique to integrate a special
a;(X) function g(x) multiplied by any rational
F(x) = P(x) + function once you know how to integrate
d.(x) g(x)/x and g(x)*x.
I
;= 1
where P(x) is a polynomial and d[i](x) are Recall that the sequence of steps is
the factors of d(x), the denominator of 1: Split f(x) into a polynomial p(x) and
F(x), where deg(a[i](x)) < deg(d[i](x)). proper rational function r(x)/d(x) with
The factors d[i](x) must be pairwise deg(r(x)) < deg(d(x».
relatively prime, Le. GCD(d[i](x),dU](x)) = 2: Factor the denominator d(x) into linear
1 for all k>j. or perhaps quadratic factors with real
The problem is the mechanics and algebra coefficients.
needed to DO a partial fraction > d(x) = product( d[i](x)l\e[i], i=1 ..n );
II
decomposition. Even a relatively simple n
problem, such as this one
> (2*xI\4-4*xI\3+3*xI\2+1)/(xI\3-2*xI\2+x d(x) = d;(x/;
) = 2*x+1/x+21(x-1 )1\2; ;= 1
L L"
1 1 I\j, j=1 ..e[i]), i=1 ..n );
2x+-+2 2 n
~=
x (x - 1)
would be a real challenge for most students a,jx)
to get right. Consequently, many instructors d(x) d.(xY
don't cover partial fractions very well. And I
there is no way that we can ask students to ;= 1 J= 1
tackle a realistic problem like this one where deg(a[i,j](x») < deg(d[i](x».
> f := (2*xI\4-4*xI\3+3*xI\2+1)/(x 1\ 3-x 1\ 2* 4: Construct a system of linear equations
b-2*xI\2+x*b*2); to solve. Solve for the unknowns ali] and
substitute the solutions into (3).
2x4-4x3 +3xl+ 1
f·----- --
.- x3 - xl b - 2 x 2 + 2 x b For example, let us step through this
problem
> f = convert(f,parfrac,x); > f := (2*xI\4-4*xI\3+3*xI\2+1)/(xI\3-xI\2*
2x4-4x3+3xl+l 1 1 b-2*xI\2+x*b*2);
-------=2x+2b+--
3
x -xlb-2xl+2xb 2bx 2x4-4x3 +3xl+ 1
f·----- --
13 1 .- x3 - xl b - 2 x + 2 x b
2
3 ~ - 4 b3 + 1 + 2 b4 n := 2 x4 - 4 x3 + 3 xl + 1
+
b(-2+b)(x-b) d := x (xl - x b - 2 x + 2 b)
I believe we can teach students more The rem and quo functions do polynomial
effectively how to do this using a CAS. Of long division. They compute the quotient
course, I am assuming we consider it useful to and remainder.
teach the students the method. Many students > p := rem(n,d,x);
will tell us that if the system can do it, why
should I bother to learn how to do it? To this p := (3 + 2 b2 ) xl - 4 X b2 + 1
I reply: if you learn how to do it, you will
> q := quo(n,d,x);
190
q:= 2x + 2 b
> d := factor(d); SOlS:={A=!~,B=-~
2b 2 -2
1,
+b
d := x (x - 2) (x - b) 4
3 b2 - 4 b3 + 1 + 2 b )
Thus to integrate f(x) we have C=-------
> Int(f,x) = Int(q,x)+lnt(p/d,x)j b (-2 + b)
> subs( sols, ANSWER );
2.0-4x3+3X2+ 1
-------dx= 1 1 13 1
fx3-x2b-2x2+2xb -- -
2bx 2 (-2+b)(x-2)
3b2-4b3 + 1 +2b4
f2X+2bdx +
b ( -2 + b) (x - b)
+
(3 + 2 b
2
) x2 - 4 X b2 + 1
To do this example in Maple we have to learn
several Maple commands and be able to use
f x(x-2)(x-b)
dx them effectively. This is an impediment. But
once the set of commands is put down on
paper, the student and instructor can take this
The answer that we are looking for must example and solve their own problems.
be of the form
> ANSWER := A1x + B/(x-2) + C/(x-b); How does this activity of working through the
steps of an algorithm differ from writing a
ABC
ANSWER := - + - - +-- program? If we want to write a program, we
x x-2 x-b would have to program the construction for
the formula for the ANSWER and then the
Equating the answer with p/d. mUltiplying construction of the equations. This would
through by the denominator we have have to contemplate an arbitrary number of
> e := A*(x-2)*(x-b)+B*x*(x-b)+C*x*(x-2 factors d[i]. This is where the programming
) = pj is tricky. We did this by hand in the
worksheet. We just wrote down the form of
e := A (x - 2)( x - b) + B x (x - b) the ANSWER. We didn't have to think about
+Cx(x-2)= how to write a program to construct it. This is
the principle technical reason why I feel that
(3 + 2 b2) x 2 - 4 Xb2 + 1 the worksheet is a better medium for teaching
an algorithm than a program. It is simpler. It
Grouping the all coefficients of xl\i avoids the tricky parts of programs because it
together, we have provides the flexibility of mixing steps done
> e := collect( Ihs(e)-rhs(e), x )j by hand, and computations done by Maple.
e := (A + C - 3 - 2 b2 + B) x2 From the student's point of view, this
approach is better than seeing a program
+ ( -B b + 4 b2 - 2 A - A b - 2 C) x because the student always sees the steps
being done. The student is free to step
+2Ab-l through them interactively. This reinforces
This must be identically zero. Thus each the algorithm without hiding the algorithm in
a black box which happens when you write a
coefficient must be zero.
program.
> eqns := { coeffs(e,x) }j
eqns := { -B b + 4 b2 - 2 A - A b - 2 C, Series Solutions of Linear
2
A + C - 3 - 2 b + B, 2 A b - 1 } ODE's Worksheet
> sols := solve( eqns, {A,B,C} )j Suppose we are given the following ODE.
> restartj # clear all variables
> ode := diff(y(x),x$2) + x*diff(y(x),x) +
191
xJ\2*y(x) = 0;
+ (12 a4
+ 22 a ) Xl
a +0
ode :=(:>(X))+x(:xY(X») + ( 6 a3 + a l ) x + 2 a 2
+xl y(x) =0 We then discard terms of degree higher
than 3. They are not correct as they
How can we compute a Taylor series depend also on higher order terms.
solution? Let s(x) be the Taylor series > r := rem(r,xJ\4,x);
solution for the ODE.
> sex) = Sum( a[k]*xJ\k, k=O..infinity ); r := (20 as + 3 a3 + aI ) x3
L ak.xk
00
+ ( 12 a4 + 2 a2 + ao) xl
s(x) =
k=O + ( 6 a 3 + a l ) x + 2 a2
One approach that will give us the first
Solving for the unknown coefficients a[2],
few terms of s(x) is to truncate the series
a[3], a[4], and a[5] in terms of a[O] and
s(x) and substitute it into the equation
a[1] (which themselves depend on the
symbolically
initial conditions of the ODE)
> s := sum( a[k]*xJ\k, k=O..5 );
> eqns := {coeffs(r,x)};
s := ao+ a l x + a2 + a x4
a ~34
xl +3 eqns := {6 a + a , 12 a + 2 a + a
3 I 4 2 0'
+a s x5
20 as + 3 a3 + ai' 2 a2 }
> r := subs( y(x)=s, ode ); > sols := solve(eqns,{a[2],a[3],a[4],a[5
sols := {a = - a ,a = - ! a
s 40 I 3 6 I'
~
%1 := a + a I x + a2 x2 + a3 x3 + a4 x4
12 a =o}
=-~a
o
a4
+ as x5 0' 2
r := as x7 + a4 x6 + (5 as + a3 ) x5 r := -a x - a xl - - a
1
x3
1 0 2 1
+(4a4 +a2 )x4
1 xl--a
+x ( a --a 1 x3--a
1 xA )
+ ( 20 as + 3 a3 + a1 ) x3 I 2 1 3 0 8 I
192
+a i-- 1 + k)k+a xkk2
xl (ao + a l x - ~6 a 1 x3 - ~
I+k k+2
+ a .0
12 0 +3ak 2xkk+2a xk
+ k+2
-~a
40 1
xS):::::O +6a
k-2
i- k - 4)+2a
-l+k
i-- 3 + k)
193
formula Here is how we can use these three facts
> restart; # clear all variables to compute the GCD of 38 and 24.
> aIb+c/d = (a*d+b*cV(b*d);
GCD(38,24) = GCD(14.24) = GCD(24,14)
a c ad+bc GCD(24.14) = GCD(10,14) = GCD(14.10)
-+-= GCD(14.10) =GCD(4,10) =GCD(10.4)
b d bd GCD(10,4) = GCD(6,4) = GCD(2,4) = GCD(4.2)
GCD(4.2) = GCD(2.2) = GCD(O,2) = GCD(2.0) = 2
If we apply this formula to 3/4 + 5/6 we
get 3/4 + 5/6 =(3x6+4x5)/(4x6) =38/24. When Euclid originally wrote down his
The answer is correct, but it is not method, he did so in words, because he
simplified. We can cancel out a factor of didn't have a better language in which to
2 from the the numerator 38 and the express his method. It took him about a
denominator 24 to get 38/24 = page of Greek to describe his method.
(2x19)/(2x12) =19/12. Maple does this We can do better with a programming
simplification automatically. language like Maple
> 3/4+ 5/6; > GCD := proc(a,b)
19 > if a<b then GCD(b,a)
> elif b=O then a
12 > else GCD(a-b,b)
The problem Euclid was trying to solve is > fi
the following. How can we find the > end:
"greatest" integer that divides both the > GCD(38,24);
numerator and the denominator of a
fraction? Alternatively, how can we find 2
the "greatest common divisor" of two Now there are three things that one must
integers a and b? We denote this think about when writing a recursive
quantity by GCD(a,b). program like this. The first is, will it stop?
Clearly this program will stop only if b
One way to compute the greatest becomes O. Can you argue that b must
common divisor of two integers a and b is eventually become O? What is Euclid's
to factor both integers into prime factors. key idea here? The second is, if the
It is easy to see what the GCD is when procedure does stop, is the output
you have the factorizations. correct? In this example, this is clear
Unfortunately, the problem of factoring because each branch of the if statement
integers is known to be a hard problem, simply implements one of the stated
that is, an efficient method is not known, identities.
and is believed by many experts not to The final thing to consider is whether the
exist. About the best we can today on the program is efficient. Whereas a
fastest computers using the best known mathematician might be happy with the
methods for factoring integers is to factor above program, a computer scientist
100 digit integers. But we need not factor would not. What happens when we run
two integers if we want to compute their the program on GCD(1QA10,1)? It
GCD! Euclid has a better method. His repeatedly subtracts 1 from 1Ql\1 0 until it
method or algorithm is based on the reaches zero. This is a lot of steps!
following three observations What Euclid's algorithm is really doing is
computing the remainder of the integer a
1: GCD(a,b) =GCD(b,a), e.g. GCD(4,6) divided by b by repeated subtraction
=GCD(6,4) =2 instead of long division. Let us modify
2: GCD(O,a) =a, e.g. GCD(O,2) =2 fact (3) so we can use long division
3: GCD(a,b) =GCD(a-b,b), e.g.
GCD(6,4) =GCD(2,4) =2 3: GCD(a,b) = GCD(irem(a,b),b), e.g.
=
GCD(lO,4) GCD(2,4) 2 =
You may want to try to prove fact (3).
194
We arrive at the normal version of that Maple can display are limited. Maple
Euclid's algorithm that is used in Maple does not support a rich enough set of
and many other computer algebra mathematical characters to cover all
systems. The irem function in Maple mathematical disciplines. These limitations,
computes the remainder of two integers though annoying, will eventually be removed
using long division as Maple's mathematical typesetting
> GCD := proc(a,b) capabilities are improved.
> if a<b then GCD(b,a)
2: A serious limitation is the difficulty of
> elif b=O then a manipulating parts of formulae. Suppose we
> else GCD(irem(a,b),b) are given the expression
> fi > e := 1 + alphaJ\21sqrt(Pi)*x - alphalsq
> end: rt(Pi)*x + alphaJ\3/sqrt(Pi)*xJ\2 - alph
This Maple procedure is acceptable. It alsqrt(Pi)*xJ\2;
allows us to compute efficiently the GCD
of integers of hundreds of digits in size. rl X ax a 3 r- ar-
However, it is recursive, and because of
this it keeps all the intermediate integers
e '-1 + - - - - + - - - - -
.- j; j; F j;
computed in the remainder sequence How would you simplify the above
around before it can finally return the expression as a polynomial in x ? In this case
GCD. This requires a lot of memory. In we can use the collect command to group
this case, however, this problem can be together all coefficients powers of x
eliminated by rewriting the program in a > e := collect(e,x);
e:=(~- F)h(F-F}+l
loop. This is in fact how it would be
implemented in most systems.
> GCD := proc(a,b) local c,d,t;
> C := a; d := b;
> while d <> 0 do Collect does not work, though, if we want to
> t := irem(c,d); c := d; d := t; collect in sqrt(Pi). To simplify each
> od; coefficient, however, the collect function
provides the option of allowing us to apply
> c
any function to the coefficients.
> end:
> collecl(e,x,simplify);
> GCD(10J\60,2J\200);
1152921504606846976 a (a 2 - 1) xl a ( a-I) x
As an exercise, show that the new
j; + j; +1
program is correct. Hint: try to argue that
when the condition d <> 0 is tested each The following I find particularly difficult to
time round the loop, that GCD(c,d) = do using Maple. Select the coefficient alpha
GCD(a,b) holds. of p*yrr in the expression
> 1+alpha*P*Vrr - beta*PJ\2*VJ\2fTJ\2;
Discussion a PV ~ p2 V2
We list a number of problems, limitations and
1+ T 12
recommendations that we have found in Alternatively, how do you replace all
presenting algorithms using worksheets. occurrences ofP*yrr by R, say, in this
Some are problems with Maple, not expression to obtain
worksheets, which can be repaired. Others
are problems inherent with using worksheets.
> 1 + alpha*R - beta*RJ\2;
1 + a R - ~ R2
I: Maple worksheets are presently limited in
that we cannot write mathematical formulae lt is these manipulations that often limit the
in the text regions, and secondly, the formulae usefulness of worksheets. Note, even if
Maple provided a way to select and edit parts
195
of expressions with the mouse, this is not Maple doesn't use a canonical order, what is
helpful. A worksheet must consist of only opO,f) in your Maple session might not be so
Maple commands. Fortunately, in a when your students run your worksheet.
worksheet you can type in the answer you Note: you can use the sort command to order
need, if necessary. That is exactly what a the terms of a polynomial.
textbook does. And then you can continue.
This is what we did in the first example for Conclusion
the partial fraction example. We didn't know
how to create the equation to be solved using
a Maple command. We just typed it in. In The proposal in this article is to use
the collect example above, it doesn't matter worksheets to present mathematical
that we don't know how to extract the algorithms. The algorithm would be
presented in English, as in a textbook,
coefficient alpha, we can simply type it in.
together with a worked example where all
steps are shown. This can be done either live
3: Another difficulty is not being able to get
on a computer, or dead, on transparencies or
Maple to produce the answer that YOU want.
For example, Maple will simplify (-8)"'0/3) paper. The proposal not does insist that an
to be a complex number, and refuse to algorithm be presented as a program. There is
simplify sqrt(xI\2*y) to be x*y. a big advantage in simply presenting an
algorithm by showing the sequence of
calculations done for one or two examples. In
> simplify( (-8)1\(1/3) ); cases where the algorithm is simple, as in the
1 +I}3 eigenvalues and Euclidean algorithm
examples, it is usually very good to present a
> simplify( sqrt(xJ\2*y) ); program. In other cases, such as the partial
fraction example, it would be an impediment.
Jx2 y
How can I get Maple to do what I want here, Finally, one word of advice for those writing
namely, to return -2 and x*sqrt(y)? The worksheets. Always show the output of all
commands, if they exist, may not be easy to commands if you intend to put the worksheets
find. This is an inherent problem. Can Maple on paper or transparencies. It is difficult to
provide a command for everything follow the method if you can't see what those
manipulative that you might want to do? The commands are doing, especially if the
argument that the programming language commands are manipulative and not part of
provides the flexibility to effect the actual algorithm.
transfonnations not provided is simply not
valid. Many are simply difficult to program.
Thus I expect difficulties like this to remain
for many years. Incidentally, you can get The author Michael Monagan did his Ph.D. at
around these two common difficulties in the University of Waterloo in computer
Maple V Releae 3 as follows: algebra in 1989. He is presently Oberassistent
> readlib(surd): at ETH Zurich. He is a member of the Maple
group, an author of the Maple books, and
> convert( (-8)1\(113), surd );
author of the column "Tips for Maple Users"
-8 113 in the Maple Technical Newsletter.
> simplify( II ) ;
Dr. Michael Monagan
-2 Institute for Scientific Computing
ETH Zentrum,
> simplify( sqrt(xJ\2*y), symbolic ); CH 8092 Zurich
xh Switzerland
monagan@inf.ethz.ch
4: Avoid the op command in worksheets. The
op command (for extracting the ith operand of
an expression) depends on the order of the
tenns in sums and factors in products. Since
196
IV B. MAPLE IN SCIENCE AND THE APPLICATIONS
COMPUTER ALGEBRA AS A TOOL FOR ANALYZING
NONLINEAR SYSTEMS
Diana Murray
Physics Department, SUNY, Stony Brook, Stony Brook, NY
Nonlinear differential equations in the form of where x and G are n-dimensional vectors and A
linear systems with small nonlinear perturbations is a constant nxn matrix. The method of normal
are useful in modeling a wide range of physical forms invokes a change of the dependent
variables to transform the original equations of
motion into simpler ones that more clearly depict
the interaction between the linear aspect and the
nonlinear perturbations and the resonances which
arise due to this interaction. The transformations
are generated in the neighborhood of a fixed
199
point of the system. These normal form With the method of normal forms one seeks a
calculations are algebraically severe and polynomial near-identity coordinate
extremely difficult and tedious to perform (at transformation
least correctly) by hand. Maple, with its
Z= U+E Tdu,U*)+1> 2 T2 (u,u*)+O(g 3) (3)
symbolic, numerical and graphical capabilities. is
a natural and indispensible tool in such in which the dynamical system takes a simpler
investigations. This paper will illustrate through form. The variable u is the zeroth-order
simple examples the method of normal forms approximation to Zand satisfies the normal form
(NF) and its capacity to reduce dynamical
equation:
systems to compact forms. We will also discuss
du .
-=-IU+g U ](u.u*)+g-~ 0 (I» 3
(4)
the application of procedures written in Maple to dt
U~+
-
perform high-order perturbation calculations and
to analyze the results numerically and As we will demonstrate. there is a (well-known)
graphically. lack of uniqueness associated with the zeroth-
order approximation that can be exploited to
We will explain the essential elements of NF by construct the resulting normal form in a number
analyzing the unforced Duffing equation: of ways. Substituting eqs (3&4) into eq (2), and
collecting terms in each order of the expansion
parameter. € • convert the nonlinear differential
equation into a series of equations that can be
The frequency of oscillation of this conservative solved recursively for the polynomials, Tj , and
system is a function of the small parameter € and
the normal form terms, U i :
is determined from the first integral. the energy:
where the asterisk denotes complex conjugation. Taking a closer look at the action of the operator
In this case the diagonalization provides a further L, it is seen that the transformation polynomial
simplification as the results for the second associated with order p cannot be used to
transformed variable, z*. are simply the complex
annihilate a monomial ofthe form uP+! u *P in
conjugation of those for z.
200
the order p calculation. These monomials are choice, referred to by Bruno as the
called "resonant" monomials; they have the same "distinguished" transformation [4]. results in the
phase as the zeroth-order approximation u: fewest number of monomial terms in the near-
identity transformation and, as will be shown
Lou=Lo(u p+1 u*p)=O.
below. smooth and uniform convergence of the
Herein lies the origin of the nonuniqueness of the expansion.
normal form [4.5]. Although a resonant
monomial in Tp cannot affect the order p Since the goal of performing a normal form
analysis is to obtain simplified equations of
calculation, it will stategically appear in higher
orders offering the investigator the opportunity to motion. one may choose each f j to annihilate the
endow the normal form with one of several corresponding V i+! resulting in a "minimal"
desirable properties. The idea of a "tailor-able" normal form (MNF) [7]. Choosing
zeroth-order approximation will become clear by
examining the results of the Duffing calculation: 17, f ,= -131
fI = - - , etc., resu Its III
. the
64 - 8192
following normal form for an order n calculation:
3i ,
VI = --u- u*
8 ' du .
-=-IU-8-U
3 i 2 U *+ 0 (8 n+1 ).
3 U *2 - -Iu *3 + F (u u *) U
1 3 --u dt 8
'T'
=-u
Writing u =p exp( - i ~ ) where p is the
1,
I 16 16 32 1
201
been graphically tested with Maple. When a
calculation is performed to a prescribed order, n. TnTn *
it is found that the mismatch of the MNF choice Rn/O -
-
--
2n TT- *
is the least. The exact solution x(t) of the P 0 0
differential equation in eq (I) is replaced by the for n = 3.....8. The magnitude of each successive
various normal form approximations which obey transformation polynomial decreases, indicating
the equation through order n. What is left over. that for E < I and for intitial conditions
the mismatch. is of order n+ I: sufficiently small [9]. the series will indeed
converge.
202
1001 , ....
H = - (x- + p~ ) +- (x 3 + p.l ) + X + P + X p- amplitude equation dp = - ~ I> p3 has a simple
0
2 3 dt 8
where x is the position and p is the momentum of closed-form solution:
the particle. Our collaborator performed the Lie
transform calculations on a Cray supercomputer.
We were able to keep pace. running our Maple
procedures on a Sun workstation. For these types
p( t) =--,==P=o,===
3 0
transforms.
The method of normal forms is similarly applied
In dissipative systems [11]. there is amplitude as
to systems whose perturbations have Taylor series
well as frequency updating. Consider the simple
expansions. The pendulum with cubic damping
system with cubic damping:
2
dx dy , d x dx 3 .
-=Y -" =-x-I>y- -0 +(-) +SIl1X =0
dt 'dt . . dt" dt
Performing an analysis similar to the one is also dramatically simplifed under MNFs.
outlined above for the Duffing equation results in Considering only small amplitudes, we expand
the following normal form: the sine function and introduce the scaling
x ----;, ~ x to obtain
du . 3, 0 3
-=-IU-I>-U-u*+I>-(-(f -f*)
dt 8 8 1 1
27 i 3 0 3 3 0
+-) U u*~ +8 (--(2 f1- +f1 f l *-3fo +fo*).
We find that the usual choice leads to amplitude
256 8 - -
27 i 567 and phase equations that are both updated in each
+-(f +[*)--_)U''U*3+0(1)'') order, whereas MNFs yields the greatly simplified
128 1 1 8192
equations:
With the usual choice, through sixth order in I> •
dp =_l> p3+J..-1>2 p5. d~=I_J..-f>p2 exact
one obtains amplitude and phase equations that dt 64 dt 16
are updated in alternating orders and are to all orders.
calculationally quite unwieldy:
For perturbed harmonic oscillator equations such
as those discussed. the reducing power of MNF's
is ubiquitous. Further examples are listed in
Table 2.
203
Fig. 5a depicts the phase portrait associated with Acknowledgement: D.M. is grateful for the
the exact system. Although the components financial support of the Institute for Pattern
initially increase despite their negative Recognition at SUNY Stony Brook.
eigenvalues. they eventually decay towards the References
stable fixed point (the origin). The initial
condition is outside the basin of attraction of the 1. V. I. Arnold, Geometrical methods in the
stable fixed point. As seen in Fig. 5b. a low- theory of ordinary differential equations,
order normal form result is a poor approximation Springer-Verlag, NY (1988)
to the exact solution. Using computer algebra it 2. J. Guckenheimer and P.J. Holmes, Nonlinear
is simple to perform an "infinite" order oscillations. dynamical systems and bifurcations
calculation and actually determine the solutions of vector fields, Springer-Verlag, NY (1983)
to the original system in closed form: 3. S. Wiggins, Introduction to applied nonlinear
dynamical systems and chaos, Springer-Verlag,
u
x = r,--: v = -.-v were
h u an d v are gIVen
. NY (1990)
vl-v . I-v 4. A.D. Bruno, Local methods in nonlin,tar
by the normal form equations: differential equations. Springer-Verlag: Berlin
(1989)
du 1 dv 1 1 ~ 5. M. Kummer, How to avoid secular terms in
-=--U' -=--v+-u-
dt 10' dt 5 2 . classical and quantum mechanics, Nuovo
Cimento, IB. 123 (1971)
The hope in performing an analytical 6. RH. Rand and D. Armbruster, Perturbation
perturbation expansion calculation is to derive a methods, bifurcation theory and computer
qualitative understanding of the dynamics of the algebra. Springer-Verlag, NY (1987)
original system from the transformed, simplified 7. P.B. Kahn and Y. Zarmi, Minimal normal
equation of motion (the normal form). For forms in harmonic oscillations with small
example, one may seek to construct a phase nonlinear perturbations. Physica D 54, 65-74
portrait for the system or to perform a bifurcation (1991)
analysis [12]. We have shown that by exploiting 8. P.B. Kahn, D. Murray and Y. Zarmi, Freedom
the nonuniqueness associated with the method of in small parameter expansions for nonlinear
normal forms we are able to handle a wide variety perturbations, Roy. Soc. Proc. A 443, 83-94
of weakly perturbed nonlinear systems in a (1993)
number of ways. In particular, implementing 9. E. Forest and D. Murray, Freedom in minimal
minimal normal forms yields strikingly simple, normal forms, Physica D, to be published (1994)
compact equations of motion. Conceptually and 10. A.J. Dragt and J.M. Finn, Lie series and
computationally it is desirable to have the invariant functions for analytic symplectic maps,
amplitude and phase equations fixed early in the 1. Math. Phys. 17,225 (1976)
calculation. This simplicity coupled with the 11. D. Murray, Normal form investigations of
computational power of Maple allows one to dissipative systems, Mechanics Research
investigate a number of complex, but important Communications, to be published (1994)
issues including 12. J.D. Crawford, Bifurcation analysis, Rev.
- convergence properties of the near-identity Mod. Phy. 63. nO.4. 991-1037 (1991)
transformation
- dynamical systems for which one needs to Diana Murray (murray@mathlab.sunysb.edu) is
develop an approximate solution valid for long expected to receive her PhD in physics from
times SUNY Stony Brook in August 1994. Her
- the transient motion in multidimensional research interests include the application of
dissipative systems (see ref. 11 for an example) perturbation expansion methods to nonlinear
- the effect of truncating modes in a dynamical systems and nonlinear time series
multidimensional system. analysis.
This last point and the extension of the analysis
to higher dimensional problems will be described
elsewhere.
204
TABLE 1
Comparison of exact and MNF results for the frequency of oscillation due to the Hamiltonian of eq. 6.
TABLE 2
Some simple perturbed harmonic oscillator systems and their minimal normal forms (exact to all orders):
X+X+l::X 2 =0 u=-iu+l::25i/12u2 u*
205
Figun: I a 2nd ordl:r
mismatch of thl: nonnal
fonn apprOXImatIOns for
the Dulling equatIOn
1.1 usual
2'j canoni..:al
3', zero order 11ll! \'11
..:onJitlOns
4) \1NF a
206
Figure 2b:11h~
converg~ncc ratio R2
c
0::
207
Figure 4 Rn/O for MNF
-
,-...
>-
- 3
X(t)
t
•
208
MAPLE V AND GEOMETRICAL OPTICS: ABERRATION
COEFFICIENTS IN ARBITRARY OPTICAL SYSTEMS
Eisso Atzema
CAN/RIACA, Amsterdam, The Netherlands
209
surface, the emphasis in this paper will be on the
use of Lie transformations for the optical transition
through several surfaces. As far as we know this
topic has not been systematically considered yet.
In the following, first the basic concepts in geo-
metrical optics and the ideas underpinning aberra-
tion theory will be sketched. After this, an outline
will be given of the principal ideas underlying the
Lie approach to geometrical optics. Also, its im-
plementation in computer algebra software will be Figure 1: An optical system
discussed. Finally, some illustrations of the possi-
ble applications of the software to geometrical op-
tics will be provided. All programming is done in surfaces of this system by F 1 through F n . The
Maple. It has not yet been attempted to write soft- medium between F i and F i +1 will be denoted by
ware that is maximally efficient. The principal goal Mi. The medium in front of the first refracting
of this paper is to give a first impression of how com- surface is Mo. Mo will be referred to as the object
puter algebra can be used in the case of geometrical space. Likewise, M n is the medium behind the last
optics. refracting surface and will be referred to as the im-
age space. The index of refraction of a medium Mi
is J.Li. Furthermore, we assume that refracting sur-
2 What is geometrical optics about? faces are intersected perpendicularly by one single
line, the optical axis. The distances between sur-
Classically, geometrical optics is divided into the faces Fi and Fi+1 are denoted by di . For every Fi ,
fields of the optics of reflection and that of the op- there are two reference planes with respect to which
tics of refraction. Underlying all theory in these the incident and the excident rays are defined. We
two fields are the laws of reflection and refraction, will denote the distances of these reference planes
respectively. According to the former, any light ray for a surface Fi as measured along the optical axis
that is reflected at a surface is reflected under an by e~ and <, respectively. An exception will be
angle of excidence which is equal to the angle of made for the distances of the most outlying refer-
incidence. The angle of incidence could be defined ence planes. The distance from the reference plane
here as the angle of the incident ray with the nor- before the system to F 1 will be denoted by eo, that
mal to the surface at the point of incidence. In a of the plane behind the system to F n by en' All
similar way, the angle of excidence can be defined. lengths are measured in the direction from Eo to
Both the case of refraction and that of reflection are En. It will be assumed that the reference planes
covered by between two surfaces coincide. We will denote the
coinciding planes between F i and Fi+l by E i (see
Theorem 1 (Snell's law) Suppose we have a re- fig. (1)).
fracting surface F. Let us denote the medium in Finally, we will coordinatise the space of the op-
front of F by Mo. Likewise, the medium behind tical system with orthogonal coordinates (x, y, z),
the surface is denoted by MI' We assign so-called with the z-axis coinciding with the optical axis. In
indices of refraction J.Lo and J.Ll to M o and M 1 , re- all reference planes, we will use the x,y-coordinates
spectively. Furthermore, let us denote the angle of induced by the x, y, z-coordinates of the ambi-
incidence of an incident ray by ~o. Similarly, ~1 de- ent space. The direction of a light ray departing
notes the corresponding angle of excidence. Then from a plane E i will be indicated by a vector Si =
for the case of refraction, one has
(ai,13i,'i) with ISil = 1.
sin(~o) : sin(~d = J.Lo : J.Ll·
With this notation, any incident ray is characterised
In the case of reflection, the same law applies, where by a pair (io, iTo) with respect to Eo, where io =
one has to choose J.Li such that J.Lo + J.Ll = 0 (xo, yo) are the coordinates of the point of inter-
section of the ray with Eo and the vector iTo is
In this paper, we will deal with the refraction of formed by the first two components of the vector
systems of rays at a series of surfaces. Such a se- So = (ao, 130, 10) indicating the direction of the light
ries is called an optical system. We will denote the ray. In order to emphasise the link between geomet-
210
rical optics and mechanics, we will write iio for xo; Writing iii := Xi and Pi := J1i(Ti, we thus obtain
to indicate the direction of the light ray, we will
_ _ + (J10 - J1d . iio
use Po = J100"0. Thus, any incident light ray will iiI = iio, PI = Po R .
be given by a pair (iio, po). In the same way, any
excident ray is characterised with respect to En by These linear expressions describe the refraction of
a pair (ijn,j5 n ). We will denote the space of incident paraxial rays at a surface. Put geometrically, these
directions Po by Fo. The space of excident direc- equations describe how the coordinates iiI, PI of a
tions will be referred to as Fn . Thus, the transition refracted ray with respect to the tangent plane of
of the incident light rays through the optical system the refracting surface relate to the coordinates iio, Po
gives rise to a map of the incident ray with respect to the same tangent
plane.
Note that it is also possible to describe the re-
lation between the coordinates of the incident and
This map will be called the optical map for the sys- the excident rays with respect to planes other than
tem. Ultimately, all properties of an optical system the tangent plane. Indeed, suppose we have a ref-
can be expressed in terms of the properties of its erence plane Eo parallel to the tangent plane with
optical map. a distance eo to F. Then, it is easily verified that
for one and the same ray
2.1 Paraxial Optics Po =P, iio = ii + (eo/ J10) . p.
For small angles of incidence at an optical system, A similar relation applies to the relation between
the angles of excidence will be small as well. This the coordinates of the refracted ray with respect to
gives rise to the so-called theory of paraxial optics. an arbitrary reference plane E l and its coordinates
The basic idea here is the following. Suppose we (iiI, PI) with respect to the tangent plane at the
have a system of refracting surfaces centred around vertex of the refracting curve.
an axis, such that the axis intersects all these sur- The above relations are linear. Therefore, the
faces perpendicularly. Then, all incident paraxial relations between the coordinates of an incident ray
rays, i.e. all rays very near and almost parallel with respect to a reference plane Eo and those of
to this axis, will still be paraxial after transition the excident ray with respect to a reference plane
through the system. For the refraction of these rays E l will be linear as well. In fact, we have
at a surface F of the system, this means that we can
Theorem 2 Suppose we have an incident system
now approximate Snell's law by a more convenient
of paraxial rays which are refracted at one surface.
expression. Essentially, we consider the linear part
Let the coordinates of an incident ray with respect
of the optical map only.
to a reference plane Eo at distance eo from the re-
fracting surface be (iio, po), with (iiI, PI) those of the
Let us restrict to spherical refracting surfaces. In corresponding excident ray with respect to a plane
this case, we may assume that the axis of the system E l at distance el. Then, up to the first order,
is the z-axis. The tangent plane at the vertex of the
refracting surface F can be taken as the x, y-plane.
Up to the first order, the equation of the refracting
surface will now be of the form
x2 + y2
z=
2R where Ci = e;j J1i and R = R/ (J10 - J1d·
where R is the radius of curvature of F. For an It is now easily verified that for all reference planes
incident paraxial ray with optical direction 0"0 and Eo there is a reference plane E l such that pencils
corresponding excident ray with direction 0"1, both of rays departing from a point on Eo will unite on a
O"i will be very small. Likewise, the lengths of the point of E l after refraction. Such pairs of planes are
vectors Xi will be small. It is now not too difficult called conjugate planes. The kind of transformation
to check that, up to the first order, Snell's law is between the reference planes induced by transition
equal to the condition through the optical system is a dilatation and the
dilatation factor is called the magnification of the
optical system with respect to the reference planes.
211
2.2 Aberrations the extension to more general cases is straightfor-
ward. Suppose we have a refracting sphere F given
Note that the preceding only applies to the case of by the equation
paraxial optics. In general, the rays departing from
one point will not unite into one point again after 1 2 2
Z = P(x,y) = 2R(x +y ) + .... (1)
refraction. Indeed, it can be shown that if this can
be achieved, then the magnification of the system The normal at a point x of this surface will be in-
has to be either 1 or -1 for all conjugate planes (see dicated by s = (-P",,-P , l) = (51,82,-1), where
y
[2]). This situation can, for instance, be achieved by P", and P are short for the derivatives of P with
y
using mirrors only. In the case of general systems respect to x and y, respectively. Furthermore, we
we have to count on deviations from the perfect im- assume that the reference planes Eo and E both
1
age. These deviations are called the aberrations of a lie at the top of F. The coordinates of the inci-
system. Essentially, the principal task of geometri- dent light rays will be indicated by (iio, Po), those
cal optics is to find means to measure the deviation of the excident rays by (iiI, pd. Finally, we will
from the perfect image and to reduce these aber- indicate the point where the incident ray impinges
rations to a minimum while retaining the desired
on F by the coordinates ij = (Q1' Q2 , Q3). It now is
magnification of the system. not difficult to see that the coordinates of ij can be
A good measure for these aberrations is pro- determined up to any order with the help of basic
vided by the coefficients of the higher-order terms perturbation theory. In fact, let us parametrise an
of the optical map of the system. For this reason, incident ray £ by
these coefficients are also called aberration coeffi-
order. In fact, it can be easily shown that because After substitution of this parametrisation into the
of the rotation symmetry, the (2n + 1)th-order part equation (1) for the refracting surface, we now ob-
of the Taylor expansion of M is of the form tain an equation of the form
L ((abc, (iio,po))UaVbc c,
a+b+c=n,
where Zl is a function of iio and Po only and Z2 is
where a, band c are integers 2: 0, (.. ) denotes the
quadratic in iio and Po. Rewriting gives us
standard inner product, (abc is a 4-tuple of numbers
and U=(iio, iio), V =(iio, Po) and W =(Po, Po) are the
rotation invariants.
In the following, we will discuss how these aber- where Z3 is a function of iio and Po only and Z4 is
ration coefficients may be computed for a given sys- quadratic in iio and Po. Consequently, let us denote
tem with given reference planes. the Taylor expansion of A around the origin and up
to order m by Am, while Am denotes the mth-order
part of A. Then,
3 The computation of aberrations
212
where s is the normal at the point of impingement where adO(g) is the identity map.
of the ray. The first of these equations is a vector
formulation of Snell's law. The second relates the In general, the series on the right-hand side can-
point where the incident light ray impinges on F to not be formally computed, neither can an arbitrary
the point of excidence. Together with the expres- function on an even-dimensional space always be
sions for ij up to a given order, these two relations written as a Lie transformation. However, for our
suffice to determine the optical map up to one order purposes the following suffices. Suppose we have
less. In fact, suppose we have determined (iil,jh) a Lie transformation. We can extend the domain
up to order nand ij up to order n + 1. Then, the of this transformation to a 2n-tuple of functions by
first equation yields ih up to order n + 1, while the applying the Lie transformation to the components
second one gives iii up to order n + 1. Some care is of the tuple. Then, we have
needed for the lowest order cases, but even in the Theorem 3 Let M be a symplectic diffeomorphism
first-order case, everything turns out to work prop- from JR.2n to JR. 2n, such that its Jacobian Jac(M)
erly. Thus, it is not difficult to write a short com- can be written in the form J ac( M) = exp( J S),
puter algebra procedure which computes the optical where J is the antisymmetric 2n x 2n matrix de-
map for one refraction up to arbitrary order. (For fined by
a similar approach, see [5], pp.124-133.)
(-~n 10 )
Once the optical map is obtained for one refraction,
and S is a symmetric 2n x 2n-matrix. Then, for any
there should not be any difficulty in obtaining the
given order m, there is a function M : JR.2n -+ JR.
optical map for more refractions. In fact, we only
such that, up to order m,
need to compose the individual optical maps and
truncate the resulting map after the required or-
der. In practice, however, the relative substitutions
give rise to expressions which contain a large num- Proof see [4],p.2217 o
ber of terms higher than the one required. Only
at the last moment these terms are discarded. The Since the optical map is symplectic (see [7]) and
result is that the internal memory of Maple is used since it can be checked that it has the required prop-
up long before the program has arrived at the final erties, we have
expressions (so-called intermediate swel0.
One way to obviate this problem is to make use Corollary 1 The optical map for an optical system
of the fact that M can be written as a Lie transfor- can be expressed in terms of a Lie transformation.
mation. In order to see what this means, we first In particular, for any optical "!:!!:p M : Eo x Fo f-+
need En X Fn , there is a function M on Eo x Fo such
that
Definition 1 Let g be an infinitely differentiable
function acting on a space JR.2n = {(ii, p)}. Then, -)
e ad(M)(-qo,Po = M(-qo,Po-)( = (-qn,Pn
-)) .
the 'adjoint operator' ad(g) is a function that maps
any infinitely differentiable function f to another For a general optical transformation, M will be hard
one according to to compute. For the optical map of one refract-
ing surface, however, the Lie transformation can be
ad(g)(f) := ~ 8g 8f _ 8g 8f. computed rather easily. Indeed, we already know
L..J
i=l 8p·1. 8q·1.
8q·7. 8p·t how to compute qll, the first component of iih up
to order m. Now, suppose we have computed M up
The adjoint operator can now be used to define a
to order m. Let us denote this part2f M by Mm.
Lie transformation.
We will denote the m-order part by Mm. For other
Definition 2 Let Coo be the space of infinitely dif- series, the same notation will apply. Then, we have
ferentiable functions. Suppose g is a Coo -function
acting on a space JR.2n. Then, the Lie transforma-
tion ead(g) of g working on Coo, the space of in-
Since [M2 , qOl] = 0, it follows that
f: i:
finitely differentiable functions, is defined as
ead(g) := L ":fadi(g),
001
t.
i 2 m l
1!ad (M )([M + , qod) ~
i=O i=O
213
qll - ead(Mm)(qod. Corollary 2 For a sequence of optical transforma-
tions M 1, ... , M n with M := M n 0 ... 0 M 1, we have
This allows us to compute [M m +1 , qod. In fact, the
left-hand side of this equation may be viewed as a
~ w applied to M 2 , which in turn is applied to
[Mm+! , qod. In other words, we have Thus, we have obtained an analogue of the matrix
formulation of paraxial optics. As in the case of
paraxial optical, it is better to split up the refrac-
tion at one surface in three parts. First we con-
The map w(M2) is called the derivative of the Lie sider the transformation induced by the "flow" of
transformation of M 2. Derivatives of Lie transfor- the rays from an arbitrary reference plane Eo to the
mations are invertible and we have reference plane E tangent to the refracting surface.
Secondly, we compute the transformation induced
by the refraction with reference to E and finally we
consider the flow from E to an arbitrary reference
plane E 1 .
where B i denotes the ith Bernoulli number (See [1],
All three of these transformations can be written
p.90, ex.3b with V = Id.). Upon closer inspection,
as a Lie transformation. In fact, we already know
we see that
that the actual refraction can be written as a Lie
aMm+1 transformation. Furthermore, we easily verify that
[M +!, qod = - a - -
m
POl
a Lie series of the form
214
have only discussed the geometrical optics in opti- order m. In order to do so, we first have to ex-
cally homogeneous media. Clearly, it is also possible pand the parametrisation of :F up to the desired
to develop a geometrical optics of non-homogeneous order and to compute pin. 3 [mJ up to order m.
media. For this kind of geometrical optics, however, Next, we compute lambda, the parameter in the
the rays are no longer straight lines and the straight- parametrisation of £, for the point of intersection
forward approach sketched in the preceding will no of £ with:F. The procedure to do so has been
longer work. In contrast, the Lie approach can be outlined in the main text. We immediately see
easily generalised to non-homogeneous media. that lambda [[OJ J and lambda [[1] J, the zero-th
and first-order part of A, are equal to zero. We take
these values as our point of departure. The coor-
4 The Computer Algebra dinates q_imp. i [mJ are now easily determined, as
are the coordinates s. i [m-1] of the normal to :F at
In this section, we will say something more about
the implementation of the methods described above q
to compute the optical map for an optical system Our next step is the computation of the coordi-
formed by several spherical surfaces in a modern nates qex. i [mJ and pex. i [mJ of the excident rays
computer algebra system. We have chosen to use up to order m with the help of the two equations (2)
Maple V Release 2 for programming because the and (3). We first use (3) to determine the qex. i [mJ.
package is easy to use, efficient, and sufficiently After this, we use (2) to determine pex. i [mJ. In
powerful to do all the required computations. All order to keep these computations manageable for
calculations were done on a Silicon Graphics Chal- Maple, we have to truncate and collect the expres-
lenge L with two 150 Mhz R4400 MIPS processors, sions we are dealing with as often as possible. Thus,
128 MB internal memory, and 256 MB swap space; we have for the computation of pex. i [mJ the code
computer times are in seconds. However, many of
>for j to 2
these computations are still feasible on less powerful
>do
computers as well. Because of lack of space, we will
> pex.j[iJ:= pin.j -
concentrate on the general design of the program
«pin.1 - pex.1[i-1J)*s.1[i-1J +
and the results obtained so far. We only give very
(pin.2 - pex.2[i-1J)*s.2[i-1J -
few details concerning the actual code.
(pin.3[i-1J-pex.3[i-1J»*
s.j[iJ*s_inv[iJ;
4.1 A Single Refracting Surface > pex.j[iJ:= collect(mtaylor
(pex.j[iJ ,[qin.1,qin.2,pin.l,pin.2J,
The optical map M for a single refracting sphere :F i+l), [qin.1,qin.2,pin.l,pin.2J,
can be relative easily computed up to a rather high normal,distributed);
order. Once M is obtained, there is no problem in >od;
obtaining the corresponding corresponding function
M in the exponent of the Lie transformation. Since the expressions just computed have to be rota-
A minor difficulty resides in the symbols we can tion-symmetric, we can write them in a more com-
use. Because of the limited range of characters in pact form with the help of the rotation invariants U,
Maple, we have to be careful in choosing our nota- V and W (see p.4). For qex. 1 [3] we thus obtain
tions, so as not to loose all relation to the standard
mathematical notations. In the program, we refer > qex.l[3J:= simplify(expand(qex.l[3J),
to the variables in the object space by adding in {U=pin.1-2+pin.2-2, V=pin.l*qin.l+
(of 'incident') and by adding ex (of 'excident') to pin.2*qin.2, W=qin.1-2+qin.2-2},
the variables of the image space. Components of an [qin.l,qin.2,pin.1,pin.2,U,V,W]);
expression will be indicated by . i. Thus, we write
pin. i, pex. i, muin and muex. Furthermore, we will qex.1[3J : = qin.l + (- muin + muex).
write M[nJ for M n . The expression M[[nJ J will cor-
respond to Mn. Other notations will be explained ( R pin.l W + muin qin.l W )
when introduced.
We start by computing the expressions for the / 2
coordinates q_imp. i [mJ of the point of impinge- / R muex muin
ment ij of a rayon the refracting surface up to /
215
This result is in accordance with the expression
found in the literature (cf. [14], p.64, where the 2
eikonal for a spherical surface is computed up to 12 mu.O R.1 mu.1 + Wmu.O mu.1 +
the fourth order. Switching from the eikonal to the
optical map gives the expression above.) 2 2
The Lie transformation M for one single refrac- Wmu.O + Wmu.l + 6 R.1 V mu.O +
tion M can now be found by following the proce-
dure explained in the main text. To shorten the / 3
procedure, we have defined new routines AD(f ,g), 6 R. 1 V mu. 1) / (R.1 mu.O mu.!)
EXP(f ,g,m) and LIE_DERV_INV(f ,g,m). It will be /
clear what the first of these three does. The second As far as we are aware, this result has not been
computes the Lie transformation of a function f given in this explicit form in the literature yet.
applied on 9 up to order m in the variables qin .1, The above procedures to compute the optical
qin.2, pin.l, pin.2. The last one computes the
map M for one surf~e up to order m and its corre-
derivative w(j)-l of a Lie transformation applied
sponding exponent M in the Lie transformation up
on 9 up to order m in the variables qin .1, qin. 2, to order m + 1 turn out to be reasonably efficient.
pin.l, pin.2.
In the following, the statistics are given up to lOth-
The procedure outlined in the main text requires order. Simplification with the help of U, V and W
that we alreadLhave the expression for the second- has been omitted.
order part of M. However, it can be easily verified
with the help of the formulae on p.3 (see also [5], run-time statistics for one refracting surface
p.112), that Time (in seconds) Memory (MB)
m M M M M
3 0.7 1.4 0.8 0.8
5 3.3 6.6 1.1 1.6
After we have obtained Mtilde [[i-l]], we can now 7 23.6 64.0 2.9 4.7
obtain the next-order part as follows. 9 142.1 495.3 13.6 19.5
This table shows that the computation of the func-
> qex.l[l,i-l]:= select(x->
tion M for one refracting surface soon becomes very
> degree(x,[qin.l,qin.2,pin.l,pin.2])<i,
time consuming. To compensate for this, the com-
qex.1[l ,m]);
putation of the optical map for several refractions
> lie_derv[qin.l,i-l] := qex.l[l,i-l] -
with the help of Lie transformations turns out to be
EXP(Mtilde[i-l],qin.l,i);
more efficient than straightforward substitution.
> lie_derv[[qin.l,i-l]]:= select(x->
degree(x,[qin.l,qin.2,pin.l,pin.2])=i-1,
lie_derv[qin.l,i-l]); 4.2 The case of several surfaces
> DMtilde[[pin.l,i-l]]:=
A routine for straightforward composition of sub-
LIE_DERV_INV(Mtilde[[2]],
sequent refractions at a number of surfaces is now
lie_derv[[qin.l,i-1]],i-l);
no longer any problem. We start by switching to
the optical map for arbitrary reference planes. It
The expression M.1 m+ 1 can now be directly com-
is easy to verify that the formulae we need for the
puted by integrating DMtilde [[pin. 1, i -1]] with
transition from a reference plane E x F to a plane
respect to pin. 1. This, however will not give the
E' x F' are of the form
whole of the expression and a symmetry argument
has to be applied to find the terms not depending q~ = qi + l . pi! P3 i = 1, 2.
on pin. 1. The expression M.2 m +1 can then be de-
termined in a similar way. Special care has to be Thus the new coordinates may be computed as
taken to get the signs correct. In the case of i = 4, follows. The first loop is for the reference plane
we thus find in the image space, the second for that in the ob-
ject space. Note that the optical direction does not
Mtilde[4] change under the first shift of reference plane. Af-
2 ter this, we can simply compose the optical maps
- 1/24 (mu.O - mu.l) W (6 R.l U+ we have obtained.
216
The procedure for the Lie transformation looks [12], p.225. The particular lens we used consists of
similar. We start with the Lie transformation for four lenses and hence eight refracting surfaces. An
the flow from the last refracting refracting surface element of symbolic computation is retained in that
to the final reference plane and then go backwards. we have not specified the position of the reference
The last transformation is that of the flow from Eo planes in the object and the image space. For the
to the first refracting surface. other variables, we used the following specifications
>R.1:= 0.53000: R.2:= -4.60000:
It is interesting to compare the cpu-times and mem- >R.3:= -1.39700: R.4:= 2.40000:
ory that both methods need. In the following ta- >R.5:= 0.59500: R.6:= -0.42200:
ble, we have listed the respective cpu-times for the >R.7:= -0.38000: R.8:= -1.61000:
computation of the 1st-order optical map for w re- >
fracting surfaces. Simplification with the help of U, >mu.O:=l: mu.1:=1.517: mu.2:=1:
V and W has been omitted. As before, in the case >mu.3:=1.620: mu.4:=1: mu.5:=1.517:
of the Lie Transformations, only one coefficient (ql) >mu.6:=1: mu.7:=1.620: mu.8:=1:
has been computed. >
run-time statistics for w refracting surfaces >d[l] :=0.19500: d[2]:=0.02565:
Time (in seconds) Memory (MB) >d[3] :=0.05000: d[4] :=0.37050:
w subst. Lie series subs. Lie series >d[5]:=0.17000: d[6] :=0.00940:
3 0.6 0.8 0.1 0.1 >d[7]:=0.05000:
4 1.2 1.3 0.1 0.1 In the following table, we have listed the respective
5 5.0 3.3 1.2 0.8 cpu-times for the computation of the mst-order op-
6 28.0 10.8 3.3 1.3 tical map for the Petzval lens. Simplification with
7 192.4 45.1 11.8 4.3 the help of U, V and W has been omitted. In the
8 - 227.9 - 17.6 case of the Lie Transformations, only one coefficient
has been computed.
Obviously, in the paraxial case considered here, we
only have to do with simple linear transformations run-time statistics for a Petzvallens
and no advanced theory seems to be needed. How- Time (in seconds) Memory (MB)
ever, even for paraxial optics some of the advan- m subs. Lie series subs. Lie series
tages of the Lie method that we hope to find come 1 2.8 1.0 0.9 0.1
to the fore. At first, the Lie transformations are 3 - 5.2 - 1.2
slower than straightforward substitutions, but from 5 - 37.0 - 1.5
the start they are more efficient with respect to 7 - 150.8 - 6.6
memory. For w large enough, the Lie method be- 9 - 1063.1 - 12.4
comes faster as well. For w = 8, the substitution
Already for the first-order aberrations, the substitu-
program crashes because of an object-too-large-
tion method fails. The program is able to compute
error. For higher-order optical maps, the compu-
the transition through the first seven surfaces, for
tations in both cases require enormous amounts of
which it needs about 4000 seconds. For the eight
time for w > 2; we have not checked which of the
surfaces of the Petzvallens, however, Maple crashed
two methods is faster. For two surfaces and the
on an object-too-large-error. Clearly, the Lie
third-order optical map, substitution requires 13
method does much better here. In fact, at least for
seconds, whereas the Lie transformation requires 5
the lower-order aberrations, it still does not crash
seconds.
as more variables are left unspecified. This gives us,
for instance, the possibility to move a lens along the
4.3 A Petzval Lens optical axis. With the help of the expression thus
When most of the parameters of an optical systems obtained, a further optimalisation of the design of
are specified, both the substitution method and the the Petzval lens can be achieved.
Lie method become much faster and we are able to
deal with larger systems as well. In order to show 5 Conclusions
what our software is able to achieve in this case, we
have computed the optical map for a so-called Petz- From the above examples it is clear that computer
val lens, where we have taken the specifications from algebra can be used to compute the aberration co-
217
efficients for an optical system. It is too early to say [8] A. Heck & M. Biemond, "Computer Algebra
anything about which of the two methods we intro- and Geometrical Optics I: The Eikonal of a
duced is most efficient. In both cases, the program Single Refracting Surface." In: H. Appiola, M.
can probably be considerably improved. In both Laine and E. Valkeila (Eds.), Proceedings of
cases, we used a step order one for our approxima- the Workshop on Symbolic and Numeric Com-
tions. Since all even order aberrations vanish in puting, Helsinki 1993. Research Reports - Rolf
the case of rotation-symmetrical systems, it seems Nevanlinna Institute B10 (1994): 127-138.
plausible that a step order of two is feasible as well.
Furthermore, no optimal use of the symmetries has [9] A. Heck & M. Biemond "Computer Algebra
been used yet. Finally, it still has to be investi- and Geometrical Optics II: The Eikonal of a
gated whether the combination of the mtaylor and Symmetric Optical System." (to appear)
collect functions are really the most efficient way [10] M.B. Monagan "The Collect Function in Ma-
to deal with Taylor series. ple," Maple Newsletter 4 (1989), pp.17-19
Regardless of the current state of our software,
the computation of fully symbolic expressions turns [11] J. Sanchez Mondragon & KB. Wolf (eds.), Lie
out t9 pose particular problems. In the case of only Methods in Optics. Proceedings of the CIFMO
a small number of unspecified variables, however, - CIO workshop held at Leon (January 7-10,
computer algebra can be fruitfully used in combina- 1985) (Springer, 1986) (= Lecture Notes in
tion with Lie transformations in order to compute Physics 250.)
such expressions as are relevant for the design of
[12] W.J. Smith Modern Lens Design. A Resource
optical instruments.
Manual (McGraw-Hill, 1992)
218
SOLUTION OF BANDED LINEAR SYSTEMS OF EQUATIONS
IN MAPLE USING LU FACTORIZATION
219
by > od;
~:]
Now we can ask Maple to solve for the unknowns in
[L] and [U].
[A] = [: : : > solve ({eqns}, {unknowns});
1
-1 0 -1 3 = 6 - U12
U1,l' ,
= ...
Now we are looking for a factorized form [A] = [L)[U],
where three lines omitted
Lu o 0
Ua,a = Ua,a, U~,~ = U~,~ }
L 21 L 22 0
[L] = Lal L a2 Lu
[ The solution is not unique! This is because the number
Lu L~2 Lu of unknowns is larger than the number of equations.
Let us use Doolittle's assumption Li,i = 1 to choose a
and unique solution.
Uu U12 Un > for i to 4 do
U22 U2a > for j to 4 do
[U]= : o Uu > if i"j then L[i,j] :=1 fi
[ > od
o 0 > od;
This can be done in Maple as follows. We r~prepare the equations and unknowns by exe-
cuting the same commands as before. We then re-solve
> 1 := array (1. .4, 1. .4, for the unknowns in [L] and [U].
> [ [ 6, 2, 1, -1],
> [ 2, 4, 1, 0] , > solve ({eqns}, {unkno1ms});
> [ 1, 1, 4, -1],
> [-1, 0, -1, 3] ] ) ;
2
-3' U.~, ~ = ...
6 2 1 -1
one line omitted
1 0
-9}
2 4
A .-
·-
1 1 4 -1 L~ ,a = 37
-1 o -1 3
The following is one way to define the matrices [L] and > assign (n);
[U). > print (L);
> L := array (1. .4, 1. .4): 1 0 0 0
> U := array (1. .4, 1..4): 1
> for i to 4 do 1 0 0
3
> for j to 4 do 1 1
> i f (j-i»O then L[i,j] :"0 fi; 1 0
6 5
> if (i-j»O then U[i,j] :"0 fi; -1 1 -9
> od 1
6 10 37
> od;
Now we prepare the equations and unknowns.
> print (U);
> eqns :.. lULL:
> unknollns := lULL: 6 2 1 -1
> LU := evalm(L a. U): 10
0 -, 1
2
> for i to 4 do 3 3 3
> for j to 4 do 37 -9
0 0
> eqns : .. eqns, LU[i,j] .. l[i,j]; 10 10
> if not type(L[i,j], nuaeric) then 191
0 0 0
> unkno1ms:=unknovns, L[i,iJ 74
> fi;
> if not type(U[i,j], nuaeric) then
It is easy to check that [A] = [L][U]. Executing the
command evalm(l - U*U) yields the zero matrix.
> unkno1ms:=unknovns, U[i,j] Thus the 16 entries of [A] can be used to determine
> fi; 16 of the 20 unknowns in [L] and [U]. If a unique solu-
> od tion is desired, four additional arbitrary conditions on
220
the entries of[L] and [U] are needed. Different choices full matrix, a savings of 93%. The 12 unnecessary zeros
of the additional arbitrary conditions are due to Crout, visible in [A] are thus of no consequence for large n.
Doolittle and Choleski. Crout's method uses Uii = 1, The second way to store banded matrices efficiently
while Doolittle's method uses Lii = I, and Choleski's is to define this array using a user-defined index func-
method (for symmetric matrices) uses Lii = Uii. The tion. This will be discussed in the following section.
method used in this study is Doolittle's factorization.
Of course, we do not wish to solve a system of non-
linear equations every time we want to factorize a ma- Banded Arrays and User-Defined Index Func-
trix, and of course this solution has already been done
tions in Maple
for us. The solution process is in fact just Gaussian
The elements of arrays are stored somewhere in mem-
elimination. For a detailed description of the actual ory. Typically in Fortran there is a definite amount of
algorithm, see for example [3].
space (say eight bytes) alloted for each matrix entry,
and a contiguous block of memory is set aside at com-
Banded Matrix Definition and Storage pile time containing n 2 of these eight-byte blocks for
a given n x n matrix A. Elements of the matrix are
If a matrix [A] has nonzero entries in the qlh super- stored and recovered by first computing the address of
diagonal, then the upper band width of [A] is at least q. the eight-byte block corresponding to Ai; by an index-
Similarly the lower band width p can be defined. The ing function such as base address +8(n(i-l)+i). This
total band width bw can be defined as bw= p + q + 1. expression allows you to find the value of the matrix
There are at least two ways to deal with the stor- entry Ai; in storage, or to place a new value there.
age of banded matrices in Maple. The first is to store In Maple, matrix entries need not take a fixed amount
them in a modified indices format to minimize the of space. Thus it would be very difficult for the pro-
memory requirements, so that most zero terms are not grammer to explicitly calculate where each entry Ai;
stored. This method is commonly used in FORTRAN is. Maple provides some indexing functions built in to
programs. For example, consider the matrix [A] of di- Maple, based on its mechanism for tables. This effec-
mensions n x n = 8 x 8, upper band width p = 3, lower tively separates the programmer and the user from the
band width q = 3 and total band width bw= 7 defined details of just where the matrix entry is to go. This
below. "information hiding" allows for great ease of use and
power.
An A 12 Au Au 0 0 0 0
Maple provides built-in indexing functions for sym-
A 21 A 22 An A 24 A 26 0 0 0 metric matrices and for sparse matrices, and some oth-
ers. You can simply tell Maple that a matrix is sym-
A 31 A 32 A 33 A 34 A 36 A 36 0 0 metric, and it will only store half the matrix (roughly),
Au A 42 Au Au A 46 A 46 Au 0 giving a great savings. If you tell Maple that your ma-
trix is sparse, Maple will store only those entries you
0 A 62 A 63 A 64 A 66 A 66 A 67 Au explicitly create, returning zero for all uninitialized en-
tries (without actually creating storage for all those ze-
0 0 A 63 A 64 A 66 A 66 A 67 A 68
ros). There is no built-in indexing function for banded
0 0 0 An A 76 A 76 A 77 A 78 matrices. We can, however, write our own.
The syntax for doing this in Maple V Release 2 and
0 0 0 0 A 86 A 86 A 87 A 88 earlier was to create a function 'index/<blah>' which
required three formal parameters:
The modified indices format of this matrix is defined
by [A] where A = array to which index function
is to be applied
0 0 0 An Au Au Au index = [i, i] is the reference to the desired entry
0 0 A 21 An A 23 A 24 A 26 is-LHS = boolean variable
= true if A[ij] is being assigned to
0 Au A 32 A 33 A 34 A 36 A S6 = false otherwise
Au A 42 Au Au A 46 A 46 Au
[A] =
A 62 A 63 Au A 66 A 66 A 67 Au It is not completely straightforward to pass extra
arguments such as the band width to the indexing func-
A 63 A 64 A 66 A 66 A 67 A 6S 0 tion. A global bandwidth variable is not suitable be-
A74 A76 A 76 A77 A 78 0 0 cause we may want to use different band widths for
different matrices in the same session.
A 86 A S6 A 87 Ass 0 0 0 We used a simple trick to deal with this situation
in the Maple V Release 2 implementation. The band
For this example it looks as though not much space width of the array was parsed from the index function
has been saved. However, that is due to the small name <blah> which must have the format "band???"
size of the example. If we used this scheme on a 100 where the "???" represents a number for the band
by 100 matrix, of bandwidth 7, then [A] would have width. The statement used to parse the name for the
7 x 100 entries compared with 100 x 100 entries in the
221
bandwidth is and assigns the result to 'index/band<
> bv := traperror (sscanf (lIIy_index_fcn, programs are available by anonymou!
> 'index/bandti ')[1]) ; ple.apmaths.uwo.ca in the subdirectory
The indexing function used this statement on its BandIndexFcn := proc(D:posint,q
own name to find out what the bandwidth is. This in- assign( 'indexlband~.p.'-'.q,
formation was thus associated directly with each ma- sUDs('index/band/lover'7,p,
'index/band/upper'=q,
trix. ~rOC(indicesftabl) local
1 := indices 1];
We found it helpful to have a procedure BandlndexFcn, j := indices 2];
which automatically created an index function for a t The nUlllber of actual argumen'
given bandwidth. The argument for this procedure t distinguishes assignDlent frol
if nargs=2 then
was the index function name written in the format if tTPe(indices,list(i
"band???" where ??? is the total band width bv of the (1-j > 'index/bandl
j -1 > 'index/band/,
matrix. An example showing the use of this procedure o
to create an index function for tridiagonal matrices is e18e
eval(tabl[op(indices
given below. fi
elif tfpe(indices,list(~
> BandIndexFcn (band3); (1- j > 'index/bandl
j-1 > 'index/band/I
OK .•. Band Index Function, band3, is created ERROR( 'band vidth',' ~
'index/bi
> 1 := array(band3, 1 •. 6, 1 .• 6); 'exceede.
else
1 := array(band3, 1 .• 6, 1 ., 6, []) tabl[op(indices)] := I
fi
end»;
> print (1); 'indexing function band' .p. '-'.c
end:
A1,1 A1,2 0 0 0 0
The basic mechanism of the new ind.
A2 ,1 A 2 ,2 A 2 ,3 0 0 0 is that if they are called with three a:
0 A3,2 A3,3 A 3,. 0 0 assignment is occurring; while if they
only two arguments, then the value of tl
0 0 A.,3 A.,. A.,s 0 wanted. Recursive use of the various pc
0 0 0 As,. As,s As,s functions is automatic-the table that
this indexing function has had one inc
0 0 0 0 As,s As,s name (band<p>-<q» stripped from its :
ther references are made with respect t
The advantage of doing this over the FORTRAN-style indexing functions, if any. IT there are 1
modification discussed earlier is that Maple's other lin- in table indexing is used. This provide
ear algebra routines work directly with this form: we way to define matrices with more than
can add, subtract, multiply, and divide banded matri- Remark. A matrix A with a band inc
ces formed in this way (though the result is not known defined by the procedure above will retu
to Maple to be a banded matrix and hence will be full evaluate Aij where i or j is outside the
of unnecessary zeros on occasion). Utilities such as matrix. We could correct this by testin
rovdim and print also work. the indices i and j are inside the bounds.
we prefer not to do this, since any prog
Indexing Functions in Maple V Release 3 to the matrix outside the bounds is if
(though it is possible that by returnin
The indexing functions have completely changed in allow the program to compute correct I
Maple V Release 3, so the first indexing procedure we This is in keeping with the seemin@
wrote no longer works. However, the first method, that the new indexing functions, which alle
of mimicking the FORTRAN storage of a banded ma- get him- or her-self into trouble by mil
trix, had the happy advantage of being directly portable ible indexing functions. For example, '
to Maple V Release 3. matrix both sYJllllletric and antis)'llllll'
We have re-written the indexing function approach, functions, and then the results of print
with the kind assistance of Jerome Lang and David the ordering of the indexing functions.
Clark. The indexing functions in Maple V Release 3 gard this as a bug, but rather as a II
are far superior-we can now have matrices with more which requires concomitant care on tJ
than one indexing function, so we can very simply and user.
easily define a symmetric banded matrix, for example.
Because the new indexing functions are so different It is useful in programs to determinf
from before, we feel it is worthwhile to include the code trix object what its bandwidth is. We 1
here. trick from the previous implementation
Here is the code to create an indexing function for this, by scanning the index function naJ
matrices with (p, q) bandwidth (that is, p nonzero sub-
diagonals and q nonzero superdiagonals). It uses sub-
stitution of the global variables 'index/band/lover'
and 'index/band/upper' into a template procedure,
222
bandvidth := proc(A:array) local idxfnc,nj We can solve this system by solving L1I = band Uz = 11
idxfnc := [linalg[indexfunc](A)]; in turn. This method is encoded in bandsolve.
idxfnc := select{
(p -) substring(p,1 .. 4)=".band),idxfnc); > x := bandsolve(F,b)j
if 1dxfnc=[] then
n := linalg[coldim](A)-l; -97936493 827068483 -35165237
[n,n] z '- [ 96643926 '483219630' 48321963'
else
sscanf(idxfnc[l],'bandXd-Xd') 18382928 17187770]
fi
end: 16107321' 144965889
Finally, explicit creation of the indexing function
is a chore best done automatically. If a user wants a We verify that the solution is correct by examining the
banded matrix, she or he simply asks for one, and the residual. This is always recommended. See the section
following procedure will create the necessary indexing on accuracy, below.
function if it has not already been done. > evalm(At*x - b);
bandmatrix := proc(p:integer,q:integer) [0,0,0,0,0]
local bandidx;
bandidx := 'band'.p.'-'.q;
if not assigned('index/'.l>andidx) then Maple has some advantages over purely numerical sys-
BandlndexFcn(p,q)
fij tems. For instance, one can compute the residual at a
array(bandidx,args[3 •• nargs]) higher precision than that used for calculation, if that
end:
is necessary (here we used exact arithmetic and so the
Here are some examples. We first create a random residual is exactly zero).
5 by 5 banded matrix, with one subdiagonal and one Another advantage is that we can experiment with
superdiagonal (so the matrix is tridiagonal). The rou- the use of 00. In the routine bandecolllp, we chose to
tine randband is a simplistic random banded matrix replace zero pivots with 1/00. Since we were not going
generator procedure contained in our package but not to exchange rows, a zero pivot normally means termi-
detailed here. nation, but we thought we might see what happened
> A := randband(1,1,1 •• S,1 •• 5)j if we let Maple handle this (hopefully rare) case sym-
-85 -55 0 0 0 bolically.
> B := bandmatrix(1,1,1 •• 2,1 •• 2,[[O,1],[2,O]]);
-37 -35 97 0 0
A·- 0 50 79 56 0
B= [ : : ]
0 0 49 63 57
0 0 0 -59 45 This matrix obviously has a zero pivot.
> c := linalg[randvector](2)j
We have also written two simple routines for LU factor- c:=[77,66]
ization and solution of banded linear systems, based on
Algorithms 5.3.1-5.3.3 in [3]. The routine bandecolllp
computes the factorization, and returns the results in
-:J
> BF := bandecomp(B)j
a matrix of the same banded shape as A.
BF,~
> F := bandecomp(A);
-85 -55 0 0 0 [,:
37 -188
97 0 0
85 17
We see that the factorization contains 00.
-425 48651 > xb := bandsolve(BF,c);
0 56 0
94 94
xb:= [(77 + ~ 66 - ~54OO) 00, _~ 66 - ~5400]
4606 2807077
0 0 57
48651 48651
-2870409 289931778
0 0 0 > map(expand, II);
2807077 2807077
Both the [L] and the [U] factors are stored in the one
[33, -33 ~ + 77]
matrix, as is usual in FORTRAN and convenient here
(except if you forget whether or not you have factored Now that solution can be interpreted as [33,77], which,
[A] already and pass the wrong matrix to the solver, as it turns out, is the exact solution to the original
below). Note that since the diagonal of [L] contains problem. Unfortunately, the fact that that worked is
only l's we don't need to store them at all. because of a bug in the infinity handling in Maple-it
Now choose a random right-hand side. is supposed to complain if asked to cancel 00/00.
> b := linalg[randvector](5); > evalm(B t* II - c);
b := [-8, -93, 92, 43, -62] [ll -3 :700 -77, 0]
223
Comparison Between LV Solver and Maple's
> map(expand. "); 'linalg/linsolve'
[-33 ~, 0] Accuracy
The instability of LU factorization without pivots (which
It may be that for some examples incorrect answers is exactly the same as Gaussian elimination without
will be generated-in particular if the matrix is sin- pivots or row exchanges) for general matrices is well-
gular we expect this to be the case. However, if we known [3]. What do we mean by "instability"? We
are careful to always check the solutions this should be mean that the problem solved by the algorithm will
fine. Maple should generate an error message if it is in general be far away from the problem you wanted
asked to subtract 00 - 00, or divide 00/00, so if there it to solve.
are infinities in the calculation there should always be We use here the principle that a good numerical
infinities in the answer, 80 we will be warned to be algorithm will give you the exact solution of a nearby
careful. Unfortunately as noted above this may not problem. In engineering and other physical contexts
always hold. this idea makes a great deal of sense, and is both sim-
It may also be that processing the symbol infinity pler and more useful than a 'forward error analysis'
will add a significant overhead to the efficiency of this or comparing the computed solution with the 'exact'
program. IT that turns out to be the case, we will re- solution, which, after all, will usually be the exact solu-
move the statement and replace it with an error mes- tion of a simplified problem which is only some rough
sage. approximation to the true reality anyway. It cannot
We are presuming that small pivots are not a prob- be stressed enough that we need to study the effects of
lem, because of the arbitrary precision floating point perturbations in the data (which incidentally allow us
arithmetic. IT rounding errors are causing a difficulty, to understand the effects ofrounding errors in the solu-
then the precision will be increased. This, too, can be tion, which are usually trivial compared to the effects
very computationally expensive, but if it is too expen- of data error). This leads to the study of 'condition
sive, then likely this is the wrong approach anyway and number'. This will not be gone into here, but see [1]
some form of partial pivoting must be tried. for an introductory essay on the topic. See the LA-
Note that we had to teach Maple how to efficiently PACK manual for an introduction to deeper views.
solve banded systems. Just telling it how to define Here we face a different problem: a numerical method
a banded matrix was not enough, because otherwise is unstable if it solves a problem that is not close to
it would have used inappropriate algorithms to solve the intended one. The simplest way we can look at
them. This holds true, of course, for the FORTRAN- this here is to compute residuals:
style banded matrix as well.
{r} = [A]:i: - {b}
Solving Linear Systems of Equations in Maple where :i: is our computed solution. Note that {r} is a
computable vector, and its size reflects the stability of
The linear solver in Maple is designed to accept dif-
our algorithm because :i: is the exact solution to
ferent types of input and accordingly choose the solv-
ing strategy. For floating point calculations, a Gauss- [A]{y}={b+r}
Jordan method with partial pivoting on the maximum
pivot is used to minimize the round off errors, while for and if {r} is small compared to {b} with respect to the
integer calculations the same method is used with par- physical details we have omitted in our model, then we
tial pivoting on the minimum pivot to reduce the size of are finished: we have the exact solution to a problem
the intermediate integers produced while solving (i.e. that is just as good a model of the underlying problem
reduce the memory and time requirements). In this as was originally written down.
study pivoting is not used because row exchanges will It is known that Gaussian elimination without row
destroy the structure of the banded matrices, although exchanges is unstable for general matrices. Thus we
simple extensions of the program can be made [3]. can expect here that the residuals Az - b will not usu-
The solution method used here can be applied both ally be small compared to z, A, or b for the random
to banded matrices and to full matrices. For banded problems examined above. In fact, they were usually
matrices, the matrix can be stored in the normal for- acceptable for the problems we have solved, but we re-
mat (using either the standard indexing functions or mark that whenever this method is used in practice,
the banded indexing functions of the previous section) the residual must be examined. The accuracy in the
or in the FORTRAN-style modified indices format. solution, of course, is related to the residual by the con-
The matrix is LU factorized first and the simple for- dition number of A which should also be computed.
ward elimination and back- substitution are performed. It would be relatively trivial to modify the Maple
A package of procedures LUpacll: (for the FORTRAN- V Release 3 band indexing function to allow partial
style storage system) has been developed for that pur- pivoting, at the cost of increasing the upper band width
pose. of the factored form of the matrix. The maximum
increase in band width is known in advance, and thus
the factored matrix can be created to be that size,
and 'sparse'. This would cause fill-in no more than
necessary. It is anticipated that this modification will
224
be explored shortly. This modification would greatly
increase the stability of the solution, and it is clear that
the user should be allowed to choose whether or not to
pivot.
250r---.-----.---.-----.---.-----.----,
Flop counts
Before we start the comparison of the actual perfor- 200
225
Table 1: Algorithm complexity
LU full
matrix
LU banded
matrix
f,~
. Conclusions
i
100
1. We have implemented a matrix factorization in
Maple. There is a matrix factorization package
already in the Maple Share Library, but it does
~
not take banded matrices into account [2].
2. We have shown that for floating-point matrices,
00 20 140
the expected efficiency gains from the use of banded
matrix solvers can be realized.
Figure 3: Computation times for the solution of ran- 3. We have given an example ofthe new user-defined
dom integer systems. Two of the curves are indistin- indexing functions in Maple V Release 3.
guishable on this graph. All three curves are compara- 4. We have demonstrated that Maple's built-in lin-
ble, but linsolve is slightly better for larger systems. ear solver is more suitable for integer calculations
All are apparently O(n for 2 < a < 3.
Q
)
than the proposed LU method.
226
Robert M. Corless is an Associate Professor in
the Department of Applied Mathematics at the
University of Western Ontario, and has been at
Western since 1987. His Ph.D. was in classical
applied mathematics (though it was from the
Mechanical Engineering Department) under the
supervision of G. V. Parkinson at the University
of British Columbia in 1987. Earlier, he got an
M. Math. from the University of Waterloo in
1982, again in applied mathematics. It was at
Waterloo early in 1981 that he was introduced to
Maple.
227
USING MAPLE TO DESIGN A
COMPLEX MIXTURE EXPERIMENT
Richard A. Bilonick
CONSOl Inc., Pittsburgh, PA
228
greater than 0%. Adding the various centroids helps hyperpolyhedron defined by all eleven vertices. (The
to fill the experimental region more evenly with Maple procedures find_vertices and adjustment
observations. This helps to reduce the prediction error shown in the Appendix, only determine the vertices.
within the experimental region, and allow fitting Additional Maple procedures, available from the
models which include the possibility of curvature of author, convert from original components to
the response surface. Replicates of the centroids in pseudocomponents, find edges and faces, find the
addition provide an independent and direct estimate various centroids, convert from pseudocomponents to
of the experimental error, and further provide the original components, and so forth.)
means to check llle model for lack-of-fit.
1~/
.. 3~\
[16, [[ 1/10, O. 9/10. 0 I, Vertex, 711,
[17, [[ 0, 1/10, 9/10, 0 I. Vertex, 8ll, \
[18, [[ 0, 0, 9/10. 1/10 I, Vertex. 911, / " \ \
[19, [[ 0, O. 0, 1 I, OOes not fitll,
[20,
[21,
[[ 0, O. 0, 7/10 I. Needs adjustment, 3/101 I.
[[ 3/10, 0, 0, 7/10 I. OOes not fitll.
z/--:. 5~ '.6 2•. 1.0"': '""":"':-,;- '>z,
[22, [[ lIS, 0, 0, 7/10 I. Violates duplicate rulell.
[23, [[ 0, 3/10. 0, 7/10 I, Vertex, lOll. 8 Z, 9
[24. [[ 0, 0, 3/10. 7/10 I. Vertex, 111l
229
components should be varied. steps to locate all 94 unique vertices (and was
executed with infinite precision). These results would
be virtually impossible to produce by hand. The
A 7-Component Extreme Vertex Design results could have been obtained by creating a C
language program, but additional code would be
The following steps were performed: required to handle the more tedious chores
(constructing matrices, tables, and lists) that Maple
1) Verified the consistency of the lower and upper handles automatically.
constraints. Another Maple V procedure was used to detennine
which of the extreme vertices were connected and
2) Converted the lower and upper constraints to formed edges. A total of 291 edges were found. The
pseudo-constraints. edge lengths were also computed. This information
was used to determine 1) which vertices were close
3) Identified all the extreme vertices using the together (arbitrarily defined as lengths less than 0.1)
pseudo-constraints. and could be removed and replaced by an "average"
vertex, and 2) which vertices were "far" apart
4) Determined which vertices are connected (so that (arbitrarily defined as lengths greater than 0.6) so that
edge and face centroids can be computed). an edge centroid could be computed. The 23 longest
edges were identified. There were 14 (the maximum
5) Determined which connected extreme vertices are possible) 5-dimensional faces. The vertices fonning
close together (so that they can be replaced by a these faces were detennined and centroids computed
single vertex). for each face. The grand average of all 94 extreme
vertices was calculated and used as an estimate of the
6) Converted the pseudocomponents back to the overall (6-dimensional) centroid.
original component space. The various centroids have been added to the list
of experimental trials in order to be able to
To facilitate computations, the original component approximate the resulting response surfaces with
proportions are converted to L pseudocomponents [2]. quadratic or cubic models. The pseudocomponent
At this point, the original component constraints were coordinates of the extreme vertices were then
determined to be consistent (required in order to use converted back to original units so that they sum to
Crosier's algorithm for finding extreme vertices). 99/100 (allowing for the TiOz fixed at 1/100). The
Constraint consistency means that all of the specified overall (6-dimensional) centroid will be performed 5
upper and lower bounds are attainable (although not times, while the 5-dimensional face centroids will
necessarily simultaneously). each be performed twice. These replications will
Ninety-four extreme vertices (out of a possible 140 decrease the predictive uncertainty and also provide
vertices) were identified for the q = 7 components an independent estimate of the experimental error.
with the constraints shown in Table 1 (but ignoring The total number of trials is 133 and they are
for the moment TiOz ). The algorithm required 364 summarized in Table 2 below.
230
components i, j, and k. degrees of freedom for the overall centroid).
Alternatively, the model can be expressed as Therefore, if the cubic model is inadequate, this
should be detectable. In this event, some other
Y=X~+£ possibly nonlinear model may be indicated or the
response variable metric should be suitably
where Y is an n byl vector of the n observed transformed.
responses, X is an n by 84 design matrix (one column Analysis of the 21 intercorrelations between the 7
for each model parameter), ~ is an 84 by 1 vector of purely linear design variables indicates that almost all
parameters (7 ~i'S', 21 ~ij'S, 210ij'S, and 35 ~ijk'S), intercorrelations are extremely small. Only three were
and £ is an n by 1 vector of normally distril5uted larger in absolute value than OJ. The intercorrelation
random errors with mean equal to 0 and variance matrix is shown in Table 3 below. Only the
equal to cr z. correlation between SiOz and FeZ03 is moderately
The estimate of the model parameters is then given large at -0.73. A plot of SiOz by FeZ03 shows that the
by addition of one or more trials with proportions of
SiOz and FeZ03 simultaneously at their maximums
should reduce the intercorrelation to almost zero.
References
No. of
Vertex Class Trials [1) J. A. Cornel, Experiments with Mixtures,
2nd edition. New York: Wiley, 1990.
231
Richard A. Bilonick
CONSOL Inc.
Consol Plaza
Pittsbtrrgh, PA 15241-1421
USA
(412) 831-4509
NazO -0.00
232
Appendix A .. Finding All the Extreme Vertices
The following Maple procedure detennines all the extreme vertices of the hyperpolyhedron simplex
without duplicates:
find_vertices .- proc();
#
# Given a set of consistent L or U pseudocomponent constraints
# based on an original simplex, this proc
# finds all vertices in the q-1 dimensional simplex.
# You must supply: q - the no. of components, and
# the 1 x q array constraints (use proc pseudo_constraints to extract
# the L or U pseudocomponent constraints generated by proc
# consistency) .
# find_vertices produces the array vertices_nd which holds the unique
# vertices, nv is the no. of unique vertices, j is the no. of steps
# in the algorithm.
# Algorithm details are given in arrays work and comment and stored in the
# table keep.
#
# This algorithm uses proc adjustment recursively
#
# First initialize some indices
u . - 0;
n .- 1;
i . - 1;
j . - 0;
nv := 0; #no. of vertices
work := table([]);
work[j] := array(l. .q, [seq(O,m=l. .q)]); # This line and the next creates
# first line of work table
comment[j] := [eval(work[j]), 'Start; adjustment = 1'];
keep := table([]);
233
This procedure is used by find_vertices:
adjustment ;= proc(iO) local k;
#
# recursive proc used by find_vertices
#
for k from 1 by 1 to q
do
if work[j] [k] = 0
then
j := j + 1;
work[j] ;= copy(keep[i,n]);
work[j] [k] := adjust[n];
234
With this principle firmly in mind, the author of Maple via Calculus
brings to teachers and students a fresh look at the standard calculus
curriculum, colored by the existence of technology like Maple - a
Preface • Basic Plotting· tool that can be used in class during lectures and exams and at home :
while working assignments, a tool whose universal access will even- i
Parametric Equations •
tually make a software-based approach to mathematics the norm. I
Optimization Problems •
Whether one uses this book primarily to learn Maple or to learn cal- 1
Interpolation • Conic Through
culus, the student who works through the exercises will learn a great!
Five Points • An Implicit
deal about both. Drill exercises and rote manipulation are replaced.
Function • Inverse Functions • here with conceptual learning activities and an exploratory interac- ,
Partial Fraction Decomposition • tion with mathematics not seen in traditional courses. A surprising!
Derivatives By Definition • feature is that fewer than 90 Maple commands are necessary to do i
Implicit Differentiation • Taylor all the calculus activities in the book, thus making it an ideal text for:
learning Maple basics. By implementing this owerful computer.
Polynomials • Teaching the
algebra system in their courses, teachers can clearly delineate the!
Definite Integral • Deriving fundamental ideas of calculus while demonstrating the efficient use !
Simpson's Rule • Numerical of Maple.
Integration • Improper Integrals •
The techniques illustrated in this text have passed the test of student
Integration by 1rigonometric acceptance. The author has used them with great success in his own
Substitution • Integration by courses and demonstrated them in workshops and presentations in
Parts • Integration by Parts Twice many locations in North America and Europe. Everyone interested
• Surface Area ofa Solid in bringing the computer into the calculus classroom will find the
book a valuable resource.
Revolution • A Seperable
Differential Equation • Newton's
Law ofCooling • Logistic Growth
• L'Hopital's Rule • Lines and For Price Ordering Information: CALL: Toll-Free 1-800-777-4643.1n NJ please c>.l1201·348-4033.Your rerer-
ence number is Y804.· WRITE: Birkh'user, Marketing Depl.,675 MassachusensAve., Cambridge, MA 02139.' YlSIT: Your IOL.-.J
Planes • Curvature from Every fec.hnicaJ bookslorc: or urge your librarian to order for your dep:ulmem. Payment can be made by check. money order or credit oed. Plosc
Angle • The Lagrange Multiplier, enclose S2.50 for shipping & handling for the first book ($1.00 (or(';]ch addilional book).md lL, NY. NJ. MA. yr. PA. VA. TX& CA residents. p~ ",dd
sales tax. Guud~1l residcms pbsc.dd 7% GST. Prices arc ,·:lIid in Nonh America only and arc subject to change widlOUI nalia. For price and ordering
Part One • The Lagrange information outside Nonh America, plea.se COnlaet BirkhauSC'r Verlag AG, P.O. Box 133, Kloslerberg 23. CH4010. Basel. SwilUrland. Fax GJ 271 7666.
The way in which students in all fields of study learn mathematical skills is being fundamentally changed
through the advent of inexpensive computers and the creation of powerful mathematical packages for symbolic
manipulation, numerical approximation, and graphical representation. Teachers of mathematics through the
entire calculus and applied mathematics sequence now have at their disposal a number of these tools, among
which Maple V has become an acclaimed leader. Theoretical Methods in the Physical Sciences is a textbook
that takes advantage of this technological development to teach a wider variety of more complex and realistic
problems than was ever before possible.
The book is designed for a one-term course, to be taken in the first or second year after the student has
completed introductory courses in physics and calculus. It uses the Maple package as an integral part of
learning how to solve a range of problems taken from elementary physics, astronomy, chemistry, and geology.
At the same time, it encourages the reader to think about what is being calculated, to relate results to physical
experience, to make order-of·magnitude estimates of both answers and errors, and to carry out dimensional
and unit checks of calculations. Above all, it uses the power of the computer, when applicable, to deepen
perception and understanding. It is packaged with a 3.5-inch diskette containing Maple worksheets for each
chapter and useful data files of physical constants, conversion factors, and chemical isotopes. The diskette is
formatted for MS Windows, but its files can also be used on Apple and Unix platforms.
Teachers will find this book a useful resource as the main text for introductory courses in applied mathematics,
mathematical physics, and theoretical science and engineering, or as an ancillary to texts in mathematics,
engineering, and the physical sciences. Both students and research workers can use it for self-instruction as a
quick, practical introduction to Maple.