Cohen
Computer Algebra and
Symbolic Computation
Mathematical Methods
Mathematica™, Maple™, and similar software packages provide
programs that carry out sophisticated mathematical operations. In
this book the author explores the mathematical methods that form
the basis for such programs, in particular the application of algorithms
to methods such as automatic simplification, polynomial decomposition,
and polynomial factorization. Computer Algebra and Symbolic
Computation: Mathematical Methods goes beyond the basics of
computer algebra—presented in Computer Algebra and Symbolic
Computation: Elementary Algorithms—to explore complexity analysis
of algorithms and recent developments in the field.
This text:
For the student, Mathematical Methods is an essential companion to
Elementary Algorithms, illustrating applications of basic ideas. For
the professional, Mathematical Methods is a look at new applications
of familiar concepts.
ISBN 1-56881-159-4
A K Peters, Ltd.
ì<(sl&q)=ib fji< +^-Ä-U-Ä-U
Mathematical Methods
• is well-suited for self-study and can be used as the basis for a
graduate course.
• maintains the style set by Elementary Algorithms and explains
mathematical methods as needed.
• introduces advanced methods to treat complex operations.
• presents implementations in such programs as Mathematica™
and Maple™.
• includes a CD with the complete text, hyperlinks, and algorithms
as well as additional reference files.
Computer Algebra and Symbolic Computation
JOEL S. COHEN
AK
PETERS
JOEL S. COHEN
Computer Algebra and
Symbolic Computation
Mathematical Methods
www.pdfgrip.com
Computer Algebra and Symbolic Computation
www.pdfgrip.com
www.pdfgrip.com
Computer Algebra and Symbolic Computation
Mathematical Methods
Joel S. Cohen
Department of Computer Science
University of Denver
A K Peters
Natick, Massachusetts
www.pdfgrip.com
Editorial, Sales, and Customer Service Office
A K Peters, Ltd.
63 South Avenue
Natick, MA 01760
www.akpeters.com
Copyright © 2003 by A K Peters, Ltd.
All rights reserved. No part of the material protected by this copyright notice
may be reproduced or utilized in any form, electronic or mechanical, including
photocopying, recording, or by any information storage and retrieval system,
without written permission from the copyright owner.
Library of Congress Cataloging-in-Publication Data
Cohen, Joel S.
Computer algebra and symbolic computation : mathematical methods
/ Joel S. Cohen
p. cm.
Includes bibliographical references and index.
ISBN 1-56881-159-4
1. AlgebraData processing. I. Title.
QA155.7.E4 .C635 2002
512dc21
Printed in Canada
07 06 05 04 03
2002024315
10 9 8 7 6 5 4 3 2 1
www.pdfgrip.com
For my wife Kathryn
www.pdfgrip.com
www.pdfgrip.com
vii
Contents
1 Preface
ix
1 Background Concepts
1.1 Computer Algebra Systems . . . . . . . . . . . . .
1.2 Mathematical Pseudo-Language (MPL) . . . . . .
1.3 Automatic Simplification and Expression Structure
1.4 General Polynomial Expressions . . . . . . . . . .
1.5 Miscellaneous Operators . . . . . . . . . . . . . .
.
.
.
.
.
1
1
2
5
11
12
2 Integers, Rational Numbers, and Fields
2.1 The Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Rational Number Arithmetic . . . . . . . . . . . . . . . . . . .
2.3 Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
17
37
44
3 Automatic Simplification
3.1 The Goal of Automatic Simplification . . . . . . . . . . . . . .
3.2 An Automatic Simplification Algorithm . . . . . . . . . . . . .
63
63
91
. . .
. . .
. .
. . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4 Single Variable Polynomials
4.1 Elementary Concepts and Polynomial Division . . . . . . . .
4.2 Greatest Common Divisors in F[x] . . . . . . . . . . . . . . .
4.3 Computations in Elementary Algebraic Number Fields . . .
4.4 Partial Fraction Expansion in F(x) . . . . . . . . . . . . . . .
www.pdfgrip.com
.
.
.
.
111
111
126
146
166
viii
5 Polynomial Decomposition
179
5.1 Theoretical Background . . . . . . . . . . . . . . . . . . . . 180
5.2 A Decomposition Algorithm . . . . . . . . . . . . . . . . . 188
6 Multivariate Polynomials
201
6.1 Multivariate Polynomials and Integral Domains . . . . . . . 201
6.2 Polynomial Division and Expansion . . . . . . . . . . . . . . 207
6.3 Greatest Common Divisors . . . . . . . . . . . . . . . . . . 229
7 The Resultant
265
7.1 The Resultant Concept . . . . . . . . . . . . . . . . . . . . 265
7.2 Polynomial Relations for Explicit Algebraic Numbers . . . . 289
8 Polynomial Simplification with Side Relations
297
8.1 Multiple Division and Reduction . . . . . . . . . . . . . . . 297
8.2 Equivalence, Simplification, and Ideals . . . . . . . . . . . 318
8.3 A Simplification Algorithm . . . . . . . . . . . . . . . . . . 334
9 Polynomial Factorization
9.1 Square-Free Polynomials and Factorization . . . .
9.2 Irreducible Factorization: The Classical Approach
9.3 Factorization in Zp [x] . . . . . . . . . . . . . . . .
9.4 Irreducible Factorization: A Modern Approach . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
349
350
360
370
399
Bibliography
431
Index
441
www.pdfgrip.com
3UHIDFH
]B8}Z sjAs $R Y hjI BP 8sY8s${R stI {B8}Z R{$t{ Ys $R
{Bt{tI b$Y Y I%jB}8t $8}j8ts$Bt stI s}}j${s$Bt BP sjBT
$Y8R Ys 8st$}Zjs stI stsjk9 8sY8s${sj -}RR$BtR qY$R ABB,
stI Y {B8}st$Bt - ]B8}Z VjAs stI 7k8ABj${ ]B8}Zs$BtU
ej8tsk VjB$Y8R s st $tBIZ{$Bt B Y RZA`{ Ys sIIRRR
ABY $R }s{${sj stI YB${sj sR}{R ej8tsk VjB$Y8R sIIRRR
Y }s{${sj R$I $ $R {Bt{tI b$Y Y PB8Zjs$Bt BP sjB$Y8R Ys
RBj% Rk8ABj${ 8sY8s${sj }BAj8R stI b$Y Y $8}j8ts$Bt BP
YR sjB$Y8R $t 8R BP Y B}s$BtR stI {BtBj RZ{ZR s%s$jsAj
$t {B8}Z sjAs }Bs88$t jstZsR qY$R ABB, bY${Y sIIRRR
8B YB${sj $RRZR $R {Bt{tI b$Y Y AsR${ 8sY8s${sj stI sjBT
$Y8${ {Bt{}R Ys s Y PBZtIs$Bt BP Y RZA`{ BY ABB,R R%
sR s A$I Abt -R stI 8stZsjR Ys RYBb YBb B ZR {B8}Z
sjAs RBPbs stI sIZs j%j -R Ys IR{$A sjB$Y8R s Y
PBPBt BP Y hjI
qYR ABB,R Ys% At $t %s$BZR RsR BP I%jB}8t PB B% dx
ksR qYk s AsRI Bt Y {jsRR tBR PB s bBTJZs {BZR RJZt{
$t {B8}Z sjAs Ys YsR At B&I s Y =t$%R$k BP *t% %k
BY ks PB Y }sR dE ksR qY hR {BZR bY${Y $R Y AsR$R PB ejT
8tsk VjB$Y8R ss{R }$8s$jk ZtIsIZs RZItR stI s Pb
sIZs RZItR PB8 8sY8s${R {B8}Z R{$t{ stI t$t$t
qY R{BtI {BZR bY${Y $R Y AsR$R PB sY8s${sj YBIR ss{R
}$8s$jk sIZs RZItR $t ABY 8sY8s${R stI {B8}Z R{$t{
qY {BZR $R {BRRTj$RI ZtI ABY 8sY8s${R stI {B8}Z R{$t{
L[
www.pdfgrip.com
[
3UHIDFH
3UHUHTXLVLWHV
qY s sZI$t{ PB YR ABB,R $t{jZIR RZItR stI }BPRR$BtsjR
PB8 8sY8s${R {B8}Z R{$t{ stI BY {Yt${sj hjIR bYB bBZjI
j$, B ,tBb sABZ {B8}Z sjAs stI $R s}}j${s$BtR
yt Y R}$$ BP st $tBIZ{Bk - b Ys% $I B 8$t$8$9 Y
}JZ$R$R qY 8sY8s${sj }JZ$R$R $t{jZI Y ZRZsj bB ks
PRY8stuRB}YB8B RJZt{ BP {BZRR w{sj{ZjZR YBZY 8Zj$%s$sAj
{sj{ZjZR j8tsk j$ts sjAs stI s}}j$I BI$tsk I$&t$sj JZsT
$BtRD yt sII$$Bt st $tBIZ{Bk {BZR $t I$R{ 8sY8s${R $R {T
B88tII A{sZR 8sY8s${sj $tIZ{$Bt $R ZRI sR s }BBP {Yt$JZ
YBZYBZ qB}${R PB8 j8tsk tZ8A YBk stI sARs{ sjAs
s $tBIZ{I sR tII
!t Y {B8}Z R{$t{ R$I b sRRZ8 Ys Y sI YsR YsI RB8
-}$t{ b$Y s {B8}Z }Bs88$t jstZs RZ{Y sR 3Bst _sR{sj
] ]LL B Fs%s VjYBZY YR jstZsR s tB ZRI $t YR ABB,R
Y R,$jjR $t }BAj8 RBj%$t stI sjB$Y8 I%jB}8t BAs$tI $t s AT
$tt$t }Bs88$t {BZR s RRt$sj !t }Bs88$t {Yt$JZ
Ys $R R}{$sjjk $8}Bst $t {B8}Z sjAs $R {ZR$Bt VjYBZY
8stk RZItR b$jj Ys% Rt {ZR$Bt $t s {Bt%t$Btsj }Bs88$t
{BZR Y B}${ $R IR{$AI $t ]Ys} x BP ej8tsk VjB$Y8R PB8
s {B8}Z sjAs }R}{$%
isj$R${sjjk R}s,$t bY$j YR }JZ$R$R RZ^{ $t s PB8sj RtR
PB ABY ABB,R $t s }s{${sj RtR Y s RB8 R{$BtR sR Y -R
}BRR bY s 8sY8s${sj stI {B8}Zs$Btsj RB}Y$R${s$Bt $R
JZ$I VjYBZY Y 8sY8s${sj I%jB}8t $t YR R{$BtR {st A
{Ysjjt$t PB RZItR b$Y Y 8$t$8Z8 }JZ$R$R Y sjB$Y8R
s s{{RR$Aj stI YR R{$BtR }B%$I s stR$$Bt B 8B sI%st{I
s8tR BP Y RZA`{
2UJDQL]DWLRQ DQG &RQWHQW
BsIjk R}s,$t YR ABB,R s $ttII B R% bB w{B8}j8tskD
}Z}BRRU
T qB }B%$I s RkR8s${ s}}Bs{Y B Y sjB$Y8${ PB8Zjs$Bt stI
$8}j8ts$Bt BP 8sY8s${sj B}s$BtR $t s {B8}Z sjAs
}Bs88$t jstZs
VjB$Y8${ 8YBIR $t sI$$Btsj 8sY8s${R s ZRZsjjk tB }T
RtI b$Y Y }{$R$Bt PBZtI $t tZ8${sj 8sY8s${R B {Bt%t$Btsj
{B8}Z }Bs88$t 3B -s8}j Y sjB$Y8 PB Y -}stR$Bt BP
}BIZ{R stI }BbR BP }BjktB8$sjR $R ZRZsjjk $%t $tPB8sjjk $tRsI BP
b$Y w{ZR$%D }B{IZR Ys {st A -}RRI sR s {B8}Z }Bs8
www.pdfgrip.com
3UHIDFH
[L
qY 8s$sj $t ej8tsk VjB$Y8R $R {Bt{tI b$Y Y sjB$YT
8${ PB8Zjs$Bt BP RBjZ$BtR B j8tsk Rk8ABj${ 8sY8s${sj }BAT
j8R qY %$b}B$t $R Ys 8sY8s${sj -}RR$BtR }RtI sR -T
}RR$Bt R s Y Iss BA`{R BP {B8}Z sjAs }Bs8R stI
ZR$t s Pb }$8$$% B}s$BtR Ys stsjk9 stI {BtRZ{ -}RR$BtR
b {st $8}j8t 8stk j8tsk B}s$BtR PB8 sjAs $BtB8k
{sj{ZjZR stI I$&t$sj JZs$BtR 3B -s8}j sjB$Y8R s $%t PB
Y stsjkR$R stI 8st$}Zjs$Bt BP }BjktB8$sjR stI s$Btsj -}RR$BtR Y
8st$}Zjs$Bt BP -}Btt$sj stI $BtB8${ PZt{$BtR I$&t$s$Bt
j8tsk $ts$Bt stI Y RBjZ$Bt BP hR BI I$&t$sj JZsT
$BtR BR BP Y 8s$sj $t Y$R ABB, $R tB PBZtI $t $Y 8sY8s${R
-ABB,R B $t BY 8B sI%st{I {B8}Z sjAs -ABB,R
T qB IR{$A RB8 BP Y 8sY8s${sj {Bt{}R stI sjB$Y8${ {YT
t$JZR Z$j$9I Ak 8BIt {B8}Z sjAs RBPbs
3B Y }sR nx ksR Y Rs{Y $t {B8}Z sjAs YsR At {BtT
{tI b$Y Y I%jB}8t BP &{$% stI ^{$t sjB$Y8R PB 8stk
8sY8s${sj B}s$BtR $t{jZI$t }BjktB8$sj sR {B88Bt I$%$RB
w{ID {B8}Zs$Bt }BjktB8$sj Ps{B$9s$Bt }BjktB8$sj I{B8}BR$$Bt
Y RBjZ$Bt BP RkR8R BP j$ts JZs$BtR stI 8Zj$%s$s }BjktB8$sj
JZs$BtR $tIht$ $ts$Bt stI Y RBjZ$Bt BP I$&t$sj JZs$BtR
VjYBZY sjB$Y8R PB RB8 BP YR }BAj8R Ys% At ,tBbt R$t{ Y
t$ttY {tZk PB ^{$t{k sRBtR Yk s tB RZ$sAj sR tsj
}Z}BR sjB$Y8R PB {B8}Z sjAs RBPbs qY {jsRR${sj sjB$Y8R
s $8}Bst YBb% A{sZR Yk s 8Z{Y R$8}j stI }B%$I s {BtT
- B 8B$%s Y AsR${ sjAs${ $IsR stI Y tI PB 8B ^{$t
s}}Bs{YR
qY 8s$sj $t sY8s${sj YBIR $R st $tBIZ{$Bt B Y 8sYT
8s${sj {Yt$JZR stI sjB$Y8${ 8YBIR BP {B8}Z sjAs VjT
YBZY Y 8s$sj $t Y$R ABB, $R 8B I$^{Zj stI JZ$R s 8sYT
8s${sj RB}Y$R${s$Bt Y s}}Bs{Y stI Rj{$Bt BP B}${R $R IR$tI RB
Ys $ $R s{{RR$Aj stI $tR$t B Y $ttII sZI$t{ VjB$Y8R
s $%t PB AsR${ $t stI s$Btsj tZ8A B}s$BtR sZB8s${ wB
IPsZjD R$8}j$h{s$Bt BP sjAs${ -}RR$BtR sR {B88Bt I$%$RB
{sj{Zjs$Bt PB R$tj stI 8Zj$%s$s }BjktB8$sjR RZjst {B8}Zs$Bt
}BjktB8$sj I{B8}BR$$Bt }BjktB8$sj R$8}j$h{s$Bt b$Y p[
BAt AsRR
stI }BjktB8$sj Ps{B$9s$Bt
7RSLF 6HOHFWLRQ
qY sZYB BP st $tBIZ{Bk - sABZ s s}$Ijk {Yst$t hjI $R Ps{I
b$Y s I$^{Zj I{$R$Bt sABZ bY${Y B}${R stI sjB$Y8R B $t{jZI $t s
www.pdfgrip.com
[LL
3UHIDFH
- qY$R I{$R$Bt $R {BtRs$tI Ak Y As{,BZtI BP Y sZI$t{ Y
8sY8s${sj I$^{Zjk BP Y 8s$sj stI BP {BZR Ak R}s{ j$8$s$BtR
yt sII$$Bt b Aj$% Ys st $tBIZ{Bk - RYBZjI sjjk A st $tBT
IZ{$Bt B Y RZA`{ Ys IR{$AR RB8 BP Y $8}Bst $RRZR $t Y
hjI AZ RYBZjI tB k B A {B8}YtR$% B $t{jZI sjj ht8tR BP
s }s${Zjs B}${ B sjB$Y8 qY$R %$b}B$t YsR Z$II Y Rj{$Bt BP
B}${R {YB${ BP sjB$Y8R stI j%j BP 8sY8s${sj $B
3B -s8}j }BjktB8$sj {I {B8}Zs$Bt $R st $8}Bst B}${ $t
sY8s${sj YBIR Ys }jskR st RRt$sj Bj $t 8BIt {B8}Z
sjAs RBPbs G IR{$A {jsRR${sj eZ{j$Ist sjB$Y8R PB ABY R$tT
j stI 8Zj$%s$s }BjktB8$sjR b$Y s$Btsj tZ8A {B^{$tR stI s
eZ{j$Ist sjB$Y8 PB R$tj %s$sAj }BjktB8$sjR b$Y R$8}j sjAs${
tZ8A {B^{$tR y $R bjj ,tBbt YBb% Ys PB ^{$t{k sT
RBtR YR sjB$Y8R s tB RZ$sAj sR tsj }Z}BR sjB$Y8R $t
s {B8}Z sjAs RkR8 3B Y$R sRBt b IR{$A Y 8B sIT
%st{I RZARZjst {I sjB$Y8 PB 8Zj$%s$s }BjktB8$sjR AZ B8$
Y 8sY8s${sj `ZR$h{s$Bt bY${Y $R JZ$ $t%Bj%I stI Ps BZR$I Y
R{B} stI R}$$ BP YR ABB,R
!t B}${ Ys $R tB I$R{ZRRI $R Y sRk8}B${ {B8}j-$k BP Y
$8 stI R}s{ JZ$8tR BP sjB$Y8R ]B8}j-$k stsjkR$R PB {B8T
}Z sjAs bY${Y $R BPt JZ$ $t%Bj%I ZRR {Yt$JZR PB8 sjB$Y8
stsjkR$R }BAsA$j$k YBk I$R{ 8sY8s${R Y YBk BP {B8}ZsT
$Bt stI BY ssR Ys s bjj AkBtI Y As{,BZtI BP Y $ttII
sZI$t{ !P {BZR $ $R $8}BRR$Aj B $tB ^{$t{k {BtR$Is$BtR tT
$jk stI bYt s}}B}$s b $tI${s wZRZsjjk Ak -s8}jD RB8 BP Y
$RRZR Ys s$R V {BZR AsRI Bt sY8s${sj YBIR $R st $Isj }T
JZ$R$ PB s sIZs j%j {BZR Ys $t{jZIR Y {B8}j-$k stsjkR$R
BP sjB$Y8R sjBt b$Y {t I%jB}8tR $t Y hjId
&KDSWHU 6XPPDULHV
V 8B Is$jI IR{$}$Bt BP Y 8s$sj {B%I $t YR ABB,R $R $%t
$t Y PBjjBb$t {Ys} RZ88s$R
(OHPHQWDU\ $OJRULWKPV
]Ys} dU ytBIZ{$Bt B ]B8}Z VjAs qY$R {Ys}
$R st $tBIZ{$Bt B Y hjI BP {B8}Z sjAs y $jjZRsR ABY Y
}BRR$A$j$$R stI j$8$s$BtR PB {B8}Z Rk8ABj${ {B8}Zs$Bt YBZY
I$sjBZR b$Y s tZ8A BP {B88{$sj {B8}Z sjAs RkR8R
d V sIZs j%j {BZR {BZjI A AsRI Bt Bt BP Y ABB,RU V,$sR >1H pIIR
]9s}B stI NsAsYt >nH $tB >EEH $tB stI 7aPQstR{Z >EH $RYs >EMH %Bt
9Z psYt stI pYsI >EH G$t,j >d(dH Os} >d(xH B $}}j >d(MH
www.pdfgrip.com
3UHIDFH
[LLL
]Ys} 1U ej8tsk ]Bt{}R BP ]B8}Z VjAs qY$R
{Ys} $tBIZ{R st sjB$Y8${ jstZs {sjjI 8sY8s${sj }RZIBT
jstZs wB R$8}jk _ND Ys $R ZRI YBZYBZ Y ABB,R B IR{$A Y
{Bt{}R -s8}jR stI sjB$Y8R BP {B8}Z sjAs _N $R s R$8}j
jstZs Ys {st A sR$jk stRjsI $tB Y RZ{ZR stI B}s$BtR
s%s$jsAj $t 8BIt {B8}Z sjAs jstZsR qY$R {Ys} sjRB $t{jZIR
s tsj IR{$}$Bt BP Y %sjZs$Bt }B{RR $t {B8}Z sjAs RBPbs
w$t{jZI$t sZB8s${ R$8}j$h{s$BtD stI s {sR RZIk bY${Y $t{jZIR st
_N }Bs8 Ys BAs$tR Y {Yst BP PB8 BP JZsIs${ -}RR$BtR
ZtI Bs$Bt BP {BBI$tsR
]Ys} nU i{ZR$% 7Z{Z BP sY8s${sj e-}RR$BtR
qY$R {Ys} $R {Bt{tI b$Y Y $ttsj RZ{Z BP 8sY8s$T
{sj -}RR$BtR BY Y {Bt%t$Btsj RZ{Z wAPB %sjZs$BtD stI
Y R$8}j$hI RZ{Z wsP %sjZs$Bt stI sZB8s${ R$8}j$h{s$BtD s
IR{$AI qY RZ{Z BP sZB8s${sjjk R$8}j$hI -}RR$BtR $R $8}BT
st A{sZR sjj sjB$Y8R sRRZ8 Ys Y $t}Z Iss $R $t Y$R PB8
3BZ }$8$$% _N B}sBR w7zQ 5 yzQ ] `EK LW L yzQX
stI gLzX0`0D Ys stsjk9 stI {BtRZ{ 8sY8s${sj -}RR$BtR s
$tBIZ{I qY {Ys} sjRB $t{jZIR s IR{$}$Bt BP PBZ _N B}sT
BR w3 BP 7ZAR$Z 7JZt$sj RZAR$Z stI ]Bt{Zt RZAR$ZD
bY${Y I}tI Btjk Bt Y RZ{Z BP st -}RR$Bt
]Ys} ;U ej8tsk sY8s${sj VjB$Y8R yt Y$R {Ys}T
b IR{$A Y AsR${ }Bs88$t RZ{ZR $t _N stI ZR YR
RZ{ZR B IR{$A s tZ8A BP j8tsk sjB$Y8R qY {Ys}
$t{jZIR s {sR RZIk bY${Y IR{$AR st sjB$Y8 Ys RBj%R s {jsRR BP
hR BI BI$tsk I$&t$sj JZs$BtR ZR$t Y R}ss$Bt BP %s$sAjR
{Yt$JZ stI Y 8YBI BP -s{ JZs$BtR b$Y $ts$t Ps{BR
]Ys} xU i{ZR$% VjB$Y8R qY$R {Ys} IR{$AR {ZT
R$Bt sR s }Bs88$t {Yt$JZ $t {B8}Z sjAs stI $%R s tZ8A
BP -s8}jR Ys $jjZRs $R sI%stsR stI j$8$s$BtR y $t{jZIR s {sR
RZIk Ys IR{$AR st j8tsk $ts$Bt sjB$Y8 bY${Y htIR Y
st$I$%s$%R PB s j$8$I {jsRR BP PZt{$BtR ZR$t Y j$ts }B}$R BP
Y $tsj stI Y RZAR$Z$Bt 8YBI e-tR$BtR BP Y sjB$Y8 B
$t{jZI Y j8tsk s$Btsj PZt{$Bt $ts$Bt RB8 $BtB8${
$tsjR j8tsk $ts$Bt Ak }sR stI Bt sjAs${ PZt{$Bt PB8
s IR{$AI $t Y -{$RR
]Ys} EU 7Z{Z BP _BjktB8$sjR stI is$Btsj e-}RT
R$BtR qY$R {Ys} $R {Bt{tI b$Y Y sjB$Y8R Ys stsjk9 stI 8sT
t$}Zjs }BjktB8$sjR stI s$Btsj -}RR$BtR y $t{jZIR {B8}Zs$Btsj
Iht$$BtR PB %s$BZR {jsRRR BP }BjktB8$sjR stI s$Btsj -}RR$BtR Ys
s AsRI Bt Y $ttsj RZ{Z BP -}RR$BtR VjB$Y8R AsRI
Bt Y }$8$$% B}s$BtR $tBIZ{I $t ]Ys} n s $%t PB I
www.pdfgrip.com
[LY
3UHIDFH
stI {B^{$t {B8}Zs$Bt {B^{$t {Bjj{$Bt -}stR$Bt stI s$BtsjT
$9s$Bt BP sjAs${ -}RR$BtR
]Ys} U e-}Btt$sj stI q$BtB8${ qstRPB8s$BtR
qY$R {Ys} $R {Bt{tI b$Y sjB$Y8R Ys 8st$}Zjs -}Btt$sj stI
$BtB8${ PZt{$BtR y $t{jZIR sjB$Y8R PB -}Btt$sj -}stR$Bt
stI IZ{$Bt $BtB8${ -}stR$Bt stI IZ{$Bt stI s R$8}j$h{s$Bt
sjB$Y8 Ys {st %$Pk s js {jsRR BP $BtB8${ $It$$R
0DWKHPDWLFDO 0HWKRGV
]Ys} dU s{,BZtI ]Bt{}R qY$R {Ys} $R s RZ88sk BP Y
As{,BZtI 8s$sj PB8 ej8tsk VjB$Y8R Ys }B%$IR s Ps8T
bB, PB Y 8sY8s${sj stI {B8}Zs$Btsj I$R{ZRR$BtR $t Y ABB, y
$t{jZIR s IR{$}$Bt BP Y 8sY8s${sj }RZIBTjstZs w_ND s A$P
I$R{ZRR$Bt BP Y RZ{Z stI }BjktB8$sj RZ{Z BP sjAs${ -T
}RR$BtR stI s RZ88sk BP Y AsR${ 8sY8s${sj B}sBR Ys s}}s
$t BZ sjB$Y8R
]Ys} 1U ytR is$Btsj WZ8AR stI 3$jIR qY$R {Ys}T
$R {Bt{tI b$Y Y tZ8${sj BA`{R Ys s$R $t {B8}Z sjAs
$t{jZI$t $tR s$Btsj tZ8AR stI sjAs${ tZ8AR y $t{jZIR
eZ{j$I:R sjB$Y8 PB Y sR {B88Bt I$%$RB BP bB $tR Y
-tII eZ{j$Ist sjB$Y8 Y ]Y$tR 8s$tI sjB$Y8 stI s
R$8}j$h{s$Bt sjB$Y8 Ys stRPB8R st $t%Bj%I s$Y8${ -}RR$Bt
b$Y $tR stI Ps{$BtR B s s$Btsj tZ8A $t RstIsI PB8 yt sIT
I$$Bt $ $tBIZ{R Y {Bt{} BP s hjI bY${Y IR{$AR $t s tsj bsk
Y }B}$R BP tZ8A RkR8R Ys s$R $t {B8}Z sjAs
]Ys} nU VZB8s${ 7$8}j$h{s$Bt VZB8s${ R$8}j$h{s$Bt
$R IhtI sR Y {Bjj{$Bt BP sjAs${ stI $BtB8${ R$8}j$h{s$Bt
stRPB8s$BtR Ys s s}}j$I B st -}RR$Bt sR }s BP Y %sjZs$Bt
}B{RR yt Y$R {Ys} b s, st $tTI}Y jBB, s Y sjAs${ {B8}BT
tt BP Y$R }B{RR $% s }{$R Iht$$Bt BP st sZB8s${sjjk R$8}j$hI
-}RR$Bt stI IR{$A st w$t%Bj%ID sjB$Y8 Ys stRPB8R 8sYT
8s${sj -}RR$BtR B sZB8s${sjjk R$8}j$hI PB8 VjYBZY sZB8s${
R$8}j$h{s$Bt $R RRt$sj PB Y B}s$Bt BP {B8}Z sjAs RBPbs
Y$R $R Y Btjk Is$jI s8t BP Y B}${ $t Y -ABB, j$sZ
]Ys} ;U 7$tj zs$sAj _BjktB8$sjR qY$R {Ys} $R {BtT
{tI b$Y sjB$Y8R PB R$tj %s$sAj }BjktB8$sjR b$Y {B^{$tR $t
s hjI Vjj sjB$Y8R $t Y$R {Ys} s Zj$8sjk AsRI Bt }BjktB8$sj
I$%$R$Bt y $t{jZIR sjB$Y8R PB }BjktB8$sj I$%$R$Bt stI -}stR$Bt
eZ{j$I:R sjB$Y8 PB sR {B88Bt I$%$RB {B8}Zs$Bt Y -tII
eZ{j$Ist sjB$Y8 stI s }BjktB8$sj %R$Bt BP Y ]Y$tR 8s$tI
sjB$Y8 yt sII$$Bt Y AsR${ }BjktB8$sj I$%$R$Bt stI {I sjB$Y8R
www.pdfgrip.com
3UHIDFH
[Y
s ZRI B $% sjB$Y8R PB tZ8${sj {B8}Zs$BtR $t j8tsk sjT
As${ tZ8A hjIR qYR sjB$Y8R s Yt ZRI B I%jB} I$%$R$Bt
stI {I sjB$Y8R PB }BjktB8$sjR b$Y sjAs${ tZ8A {B^{$tR qY
{Ys} {Bt{jZIR b$Y st sjB$Y8 PB }s$sj Ps{$Bt -}stR$Bt Ys $R
AsRI Bt Y -tII eZ{j$Ist sjB$Y8
]Ys} xU _BjktB8$sj *{B8}BR$$Bt _BjktB8$sj I{B8}BR$T
$Bt $R s }B{RR Ys I8$tR $P s }BjktB8$sj {st A }RtI sR s
{B8}BR$$Bt BP jBb I }BjktB8$sjR yt Y$R {Ys} b I$R{ZRR RB8
YB${sj sR}{R BP Y I{B8}BR$$Bt }BAj8 stI $% st sjB$Y8
AsRI Bt }BjktB8$sj Ps{B$9s$Bt Ys $Y htIR s I{B8}BR$$Bt B IT
8$tR Ys tB I{B8}BR$$Bt -$RR
]Ys} EU Zj$%s$s _BjktB8$sjR qY$R {Ys} tsj$9R
Y I$%$R$Bt stI {I sjB$Y8R B 8Zj$%s$s }BjktB8$sjR b$Y {BPT
h{$tR $t st $tsj IB8s$t y $t{jZIR sjB$Y8R PB Y }BjktBT
8$sj I$%$R$Bt B}s$BtR w{ZR$% I$%$R$Bt 8BtB8$sjTAsRI I$%$R$Bt stI
}RZIBTI$%$R$BtD }BjktB8$sj -}stR$Bt w$t{jZI$t st s}}j${s$Bt B Y
sjAs${ RZAR$Z$Bt }BAj8D stI Y }$8$$% stI RZARZjst sjBT
$Y8R PB {I {B8}Zs$Bt
]Ys} U qY iRZjst qY$R {Ys} $tBIZ{R Y RZjst BP
bB }BjktB8$sjR bY${Y $R IhtI sR Y I8$tst BP s 8s$- bYBR tT
$R I}tI Bt Y {B^{$tR BP Y }BjktB8$sjR G IR{$A s eZ{j$Ist
sjB$Y8 stI s RZARZjst sjB$Y8 PB RZjst {B8}Zs$Bt stI ZR
Y RZjst B htI }BjktB8$sj js$BtR PB -}j${$ sjAs${ tZ8AR
]Ys} MU _BjktB8$sj 7$8}j$h{s$Bt b$Y 7$I ijs$BtR
qY$R {Ys} $t{jZIR st $tBIZ{$Bt B p[
BAt AsR$R {B8}Zs$Bt b$Y
st s}}j${s$Bt B Y }BjktB8$sj R$8}j$h{s$Bt }BAj8 qB R$8}j$Pk Y
}Rts$Bt b sRRZ8 Ys }BjktB8$sjR Ys% s$Btsj tZ8A {B^{$tR
stI ZR Y j-${Bs}Y${sj BI$t R{Y8 PB 8BtB8$sjR
]Ys} U _BjktB8$sj 3s{B$9s$Bt qY Bsj BP Y$R {Ys} $R
Y IR{$}$Bt BP s AsR${ %R$Bt BP s 8BIt Ps{B$9s$Bt sjB$Y8 PB
R$tj %s$sAj }BjktB8$sjR $t +>?H y $t{jZIR RJZsTP Ps{B$9s$Bt sjT
B$Y8R w$t +>?H stI >?HD Bt{,:R {jsRR${sj Ps{B$9s$Bt sjB$Y8
PB >?H j,s8}:R sjB$Y8 PB Ps{B$9s$Bt $t >?H stI s AsR${ %T
R$Bt BP Y <tRj j$P$t sjB$Y8
&RPSXWHU $OJHEUD 6RIWZDUH DQG 3URJUDPV
G ZR s }B{IZ Rkj BP }Bs88$t Ys {BR}BtIR 8BR {jBRjk
B Y }Bs88$t RZ{ZR stI Rkj BP Y s}j sY8s${s stI
Z_V* RkR8R stI B s jRR I B Y s{Rk8s stI iIZ{
RkR8R yt sII$$Bt RB8 sjB$Y8R s IR{$AI Ak stRPB8s$Bt
ZjR Ys stRjs B Y }st 8s{Y$t jstZsR $t Y sY8s${s
www.pdfgrip.com
[YL
3UHIDFH
stI s}j RkR8R =tPBZtsjk Y }Bs88$t Rkj ZRI Y IBR
tB stRjs sR$jk B Y RZ{ZR $t Y V-$B8 RkR8
qY I$sjBZR stI sjB$Y8R $t YR ABB,R Ys% At $8}j8tI
$t Y s}j ( sY8s${s ;d stI Z_V* _B wzR$Bt 1(D RkRT
8R qY I$sjBZR stI }Bs8R s PBZtI Bt s ]* $t{jZII b$Y Y
ABB,R yt s{Y ABB, s%s$jsAj I$sjBZR stI }Bs8R s $tI${sI Ak Y
bBI Xy8}j8ts$Bt" PBjjBbI Ak s RkR8 ts8 s}j sY8s${s
B Z_V* 7kR8 I$sjBZR s $t s tBABB, PB8s w8bR $t s}j tA
$t sY8s${s stI 8tA $t Z_V*D stI }B{IZR s $t - wV7]yyD
PB8s w3B -s8}j R Y I$sjBZ $t 3$Z n; Bt }s 1 stI Y
}B{IZ $t 3$Z 11 Bt }s 1nD yt RB8 -s8}jR Y I$sjBZ I$RT
}jsk BP s {B8}Z sjAs RkR8 $%t $t Y - YsR At 8BI$hI RB
Ys $ hR Bt Y }$tI }s
(OHFWURQLF 9HUVLRQ RI WKH %RRN
qYR ABB,R Ys% At }B{RRI $t Y NVqe 1 RkR8 b$Y Y Yk}P
}s{,s bY${Y sjjBbR Yk}- j$t,R B {Ys} tZ8AR R{$Bt tZ8AR
I$R}jskI wstI tZ8AID PB8ZjsR YB8R -s8}jR hZR PBBtBR
-{$RR Y sAj BP {BttR Y $tI- Y A$Aj$Bs}Yk stI bA R$R
Vt j{Bt${ %R$Bt BP Y ABB, wsR bjj sR sII$$Btsj Pt{ hjRD $t
Y }BsAj IB{Z8t PB8s w_*3D bY${Y $R I$R}jskI b$Y Y VIBA
V{BAs RBPbs $R $t{jZII Bt Y ]*
$FNQRZOHGJHPHQWV
y s8 sPZj B Y 8stk RZItR stI {BjjsZR bYB sI stI Yj}I
IAZ }j$8$tsk %R$BtR BP Y$R ABB, qY$ sI%${ t{BZs8t
RZR$BtR {$${$R8R stI {B{$BtR Ys% sjk $8}B%I Y Rkj stI
RZ{Z BP Y ABB, qYst,R B WB8st j$R$t VtIb Z Vj]Ys8}$Bt Y js Fs{, ]BYt iBA ]BB8A pB *BtB%st $jj
*Bt i${YsI 3s8st ]jskBt 3t ]sj p$AABtR <A ptA
F$jjst
FB{jkt sAsZ 7stjk 7$tA FBk{ 7$%R 7stIYks z$t`s8Z$ stI
*$st Gst
y s8 sPZj B pbt *$s9 stI Vj- ]Ys8}$Bt PB Y$ Yj} b$Y
Y NVqe IB{Z8t }}ss$Bt $s G$tstI bYB sI 8BR BP Y
- stI stRjsI 8stk BP Y }Bs8R B Y Z_V* jstZs VI$ks
WssY bYB {sI RB8 BP Y hZR stI ${Ysj GR bYB stRT
jsI 8stk BP Y }Bs8R B Y sY8s${s Z_V* stI s{Rk8s
jstZsR qYst,R B ]s8$ sR bYB sI Y t$ 8stZR{$} stI
8sI tZ8BZR RZR$BtR Ys $8}B%I Y -}BR$$Bt tBs$Bt stI
www.pdfgrip.com
3UHIDFH
[YLL
Yj}I {js$Pk {BtPZR$t R{$BtR BP Y ABB, < {sPZj sI$t I$R{B%T
I tZ8BZR k}Bs}Y${sj s88s${sj stI 8sY8s${sj BR
y sjRB s{,tBbjI Y jBtT8 RZ}}B stI t{BZs8t BP 8k
YB8 $tR$Z$Bt Y =t$%R$k BP *t% *Z$t Y b$$t BP Y
ABB, y bsR sbsII bB RsAAs${sj js%R B I%jB} Y$R 8s$sj
7}{$sj Yst,R B 8k Ps8$jk PB t{BZs8t stI RZ}}BU 8k js
}stR ejA stI FZI$Y ]BYt *st$j ]BYt 3sttk ]BYt stI NBZ$R
stI ej$9sAY !AIBP
3$tsjjk y bBZjI j$, B Yst, 8k b$P sYkt bYB sR jBt sR RY {st
88A YsR j$%I YBZY IsP sP IsP BP Y$R ABB, stI bYB b$Y
}s$t{ jB% stI RZ}}B YsR Yj}I 8s, Y$R ABB, }BRR$Aj
FBj 7 ]BYt
*t% ]BjBsIB
WB%8A dM 1((1
www.pdfgrip.com
www.pdfgrip.com
1
Background Concepts
In this chapter we summarize the background material that provides a
framework for the mathematical and computational discussions in the book.
A more detailed discussion of this material can be found on the CD that
accompanies this book and in our companion book, Computer Algebra and
Symbolic Computation, Elementary Algorithms, (Cohen [24]). Readers who
are familiar with this material may wish to skim this chapter and refer to
it as needed.
1.1 Computer Algebra Systems
A computer algebra system (CAS) or symbol manipulation system is a computer program that performs symbolic mathematical operations. In this
book we refer to the computer algebra capabilities of the following three
systems which are readily available and support a programming style that
is most similar to the one used here:
• Maple – a very large CAS originally developed by the Symbolic
Computation Group at the University of Waterloo (Canada) and now
distributed by Waterloo Maple Inc. Information about Maple is found
in Heck [45] or at the web site .
• Mathematica – a very large CAS developed by Wolfram Research
Inc. Information about Mathematica can be found in Wolfram [102]
or at the web site .
1
www.pdfgrip.com
2
1. Background Concepts
• MuPAD – a large CAS developed by the University of Paderborn
(Germany) and SciFace Software GmbH & Co. KG. Information about
MuPAD can be found in Gerhard et al. [40] or at the web site
.
1.2 Mathematical Pseudo-Language (MPL)
Mathematical pseudo-language (MPL) is an algorithmic language that is
used throughout this book to describe the concepts, examples, and algorithms of computer algebra. MPL algorithms are readily expressed in the
programming languages of Maple, Mathematica, and MuPAD, and implementations of the dialogues and algorithms in these systems are included
on the CD that accompanies this book.
Mathematical Expressions
MPL mathematical expressions are constructed with the following symbols
and operators:
• Integers and fractions that utilize infinite precision rational number
arithmetic.
• Identifiers that are used both as programming variables that represent the result of a computation and as mathematical symbols that
represent indeterminates (or variables) in a mathematical expression.
• The algebraic operators +, −, ∗, /, ∧ (power), and ! (factorial). (As
with ordinary mathematical notation, we usually omit the ∗ operator
and use raised exponents for powers.)
• Function forms that are used for mathematical functions (sin(x),
exp(x), arctan(x), etc.), mathematical operators (Expand(u), Factor(u), Integral(u,x), etc.), and undefined functions (f(x), g(x,y), etc.).
• The relational operators =, =, <, ≤, >, and ≥, the logical constants
true and false, and the logical operators, and, or, and not.
• Finite sets of expressions that utilize the set operations ∪, ∩, ∼ (set
difference), and ∈ (set membership). Following mathematical convention, sets do not contain duplicate elements and the contents of a set
does not depend on the order of the elements (e.g., {a, b} = {b, a}).
• Finite lists of expressions. A list is represented using the brackets [
and ] (e.g., [1, x, x2 ]). The empty list, which contains no expressions,
www.pdfgrip.com
1.2. Mathematical Pseudo-Language (MPL)
3
is represented by [ ]. Lists may contain duplicate elements, and the
order of elements is significant (e.g., [a, b] = [b, a]).
The MPL set and list operators and the corresponding operators in
computer algebra systems are given in Figure 1.1.
MPL mathematical expressions have two (somewhat overlapping) roles
as either program statements that represent a computational step in a program or as data objects that are processed by program statements.
Assignments, Functions, and Procedures
The MPL assignment operator is a colon followed by an equal sign (:=) and
an assignment statement has the form f := u where u is a mathematical
expression.
function
An MPL function definition has the form f (x1 , . . . , xl ) := u, where
x1 , . . . , xl is a sequence of symbols called the formal parameters, and u is
a mathematical expression. MPL procedures extend the function concept
to mathematical operators that are defined by a sequence of statements.
The general form of an MPL procedure is given in Figure 1.2. Functions
and procedures are invoked with an expression of the form f (a1 , . . . , al ),
where a1 , . . . , al is a sequence of mathematical expressions called the actual
parameters.
In order to promote a programming style that works for all languages,
we adopt the following conventions for the use of local variables and formal
parameters in a procedure:
• An unassigned local variable cannot appear as a symbol in a mathematical expression. In situations where a procedure requires a local (unassigned) mathematical symbol, we either pass the symbol
through the parameter list or use a global symbol.
• Formal parameters are used only to transmit data into a procedure
and not as local variables or to return data from a procedure. When
we need to return more than one expression from a procedure, we
return a set or list of expressions.
Decision and Iteration Structures
MPL provides three decision structures: the if structure, the if-else structure which allows for two alternatives, and the multi-branch decision structure which allows for a sequence of alternatives.
MPL contains two iteration structures that allow for repeated evaluation of a sequence of statements, the while structure and the for structure.
Some of our procedures contain for loops that include a Return statement.
www.pdfgrip.com
4
1. Background Concepts
MPL
set notation
{a, b, c}
∅
A∪B
(set union)
A∩B
(set intersection)
A∼B
(set difference)
x∈A
(set membership)
Maple
Mathematica
MuPAD
{a,b,c}
{ }
A union B
{a,b,c}
{ }
Union[A,B]
{a,b,c}
{ }
A union B
A intersect B
Intersection[A,B]
A intersect B
A minus B
Complement[A,B]
A minus B
member(x, A)
MemberQ[x,A]
contains(A,x)
(a) Sets. (Implementation: Maple (mws), Mathematica (nb), MuPAD (mnb).)
MPL
list notation
[a, b, c]
empty list [ ]
First (L)
(first member
of L)
Rest(L)
(a new list
with first
member of
L removed)
Adjoin(x, L)
(a new list
with x
adjoined to
the beginning
of L)
Join (L, M )
(a new list
with members
of L followed
by members
of M )
x∈L
(list
membership)
Maple
Mathematica
MuPAD
[a,b,c]
[]
op(1,L)
{a,b,c}
{}
First[L]
[a,b,c]
[]
op(L,1)
[op(2..nops(L),L)]
Rest[L]
[op(L,2..nops(L))]
[x,op(L)]
Prepend[L,x]
[x, op(L)]
[op(L),op(M)]
Join[L,M]
concat(L,M)
member(x,L)
MemberQ[x,L]
contains(L,x)
(b) Lists. (Implementation: Maple (mws), Mathematica (nb), MuPAD (mnb).)
Figure 1.1. MPL set and list operations in CAS languages.
www.pdfgrip.com
1.3. Automatic Simplification and Expression Structure
5
Procedure f (x1 , . . . , xl );
Input
x1 : description of input to x1 ;
..
.
xl : description of input to xl ;
Output
description of output;
Local Variables
v1 , . . . , vm ;
Begin
S1 ;
..
.
Sn
End
Figure 1.2. The general form of an MPL procedure. (Implementation: Maple
(txt), Mathematica (txt), MuPAD (txt).)
In this case, we intend that both the loop and the procedure terminate
when the Return is encountered.1
All computer algebra languages provide decision and iteration structures (Figure 1.3).
1.3 Automatic Simplification and Expression Structure
As part of the evaluation process, computer algebra systems apply some
“obvious” simplification rules from algebra and trigonometry that remove
extraneous symbols from an expression and transform it to a standard form.
This process is called automatic simplification. For example,
√
x + 2 x + y y 2 + z 0 + sin(π/4) → 3 x + y 3 + 1 + 2/2
where the expression to the right of the arrow gives the automatically
simplified form after evaluation.
In MPL (as in a CAS), all expressions in dialogues and computer programs operate in the context of automatic simplification. This means: (1)
1 The for statements in both Maple and MuPAD work in this way. However, in
Mathematica, a Return in a For statement will only work in this way if the upper limit
contains a relational operator (e.g., i<=N). (Implementation: Mathematica (nb).)
www.pdfgrip.com