Book contents

1. Introduction  ……… 1

1.1 For whom this book was written ……. 1
1.2 The goal ……… 1
1.3 Why we should care about MuPAD ……… 2
1.4 What is inside ……… 3
1.5 Style conventions ……… 4
1.6 Writing “between” ……… 4

2. A Quick Introduction to MuPAD ……… 7

2.1 The Very First Look ……… 7
2.2 Getting Started ……… 9
2.3 A Quick Look at MuPAD’s Interface ……… 13
2.4 Formatting Documents in MuPAD ……… 16
2.5 Getting Help ……… 19
2.6 Chapter Summary ……… 21
2.7 Review Exercises ……… 22

3. Programming in MuPAD – Declarations……… 25

3.1 Writing Formulae in MuPAD ……… 25
3.2 Declaring Variables and Constants ……… 27
3.3 Declaring Functions and Operations ……… 31
3.4 Writing More than One Line of Code ……… 34
3.5 The Basics of the Domain Concept ……… 36
3.6 Chapter Summary ……… 41
3.7 Review Exercises ……… 43

4. Programming in MuPAD – Control Structures ……… 45

4.1 Decisions ……… 45
4.1.1 MuPAD Syntax: the “if” Statement ……… 47
4.1.2 Indentation in MuPAD ……… 48
4.1.3 Quadratic Equation Example ……… 49
4.1.4 Formatting Output and Input ……… 52
4.1.5 “elif” a Useful Shortcut ……… 55
4.2 Programming Iterations in MuPAD ……… 56
4.2.1 The “for” Loop ……… 56
4.2.2 MuPAD Syntax: the “for” Loop ……… 57
4.2.3 The “while” and “repeat” Loops ……… 58
4.2.4 MuPAD Syntax: the “while” and “repeat” Loops ……… 59
4.3 What is Wrong with my Loops and Conditions ……… 60
4.4 Selections ……… 64
4.4.1 MuPAD Syntax: the “case” Structure ……… 67
4.5 Chapter Summary ……… 67
4.6 Programming Exercises ……… 69

5. Programming in MuPAD – Procedures ……… 75

5.1 What is a Procedure ……… 78
5.2 Examples of Procedures ……… 78
5.3 Getting Output from Procedures ……… 85
5.4 Returning Unevaluated or Symbolic Expressions ……… 88
5.5 Shall We use Global or Local Variables? ……… 90
5.6 Introduction to Types and Domains ……… 93
5.7 Using MuPAD Types and Domains ……… 96
5.8 Using Procedures to Produce Data Structures ……… 101
5.8.1 Sequences ……… 102
5.8.2 Lists ……… 104
5.8.3 Sets ……… 105
5.8.4 Strings ……… 105
5.8.5 Vectors and Matrices ……… 107
5.9 Procedures with a Variable Number of Input Parameters ……… 111
5.10 Recursive Procedures ……… 114
5.11 Using Libraries ……… 117
5.12 User Defined Libraries of Procedures ……… 122
5.13 Final Comments on MuPAD Coding Guidelines ……… 126
5.13.1 Magic Numbers ……… 126
5.13.2 Comments ……… 127
5.13.3 Braces ……… 128
5.14 Chapter Summary ……… 130
5.15 Programming Exercises ……… 134

6. Introduction to MuPAD Graphics ……… 137

6.1 Obtaining Quick Plots ……… 137
6.1.1 Procedure plotfunc2d ……… 137
6.1.2 Your First Animation with MuPAD ……… 142
6.1.3 Procedure plotfunc3d ……… 144
6.2 General Concept of MuPAD Plots ……… 145
6.2.1 Object Attributes & Options ……… 150
6.3 Canvas, Scene and Coordinate System Options ……… 155
6.3.1 Options for Canvas ……… 158
6.3.2 Options for Scene2d ……… 163
6.3.3 Options for Scene3d ……… 164
6.3.4 The Coordinate System in 2D and 3D ……… 167
6.4 Options Related to Primitives ……… 170
6.4.1 Basic Options for Primitives ……… 171
6.4.2 Working with Color ……… 173
6.4.3 Mesh and Other Options ……… 174
6.5 Operations on Graphical Objects ……… 178
6.5.1 Operation modify ……… 178
6.6 Chapter Summary ……… 179
6.7 Programming Exercises ……… 186

7. Interactive Graphics & Animation with VCam ……… 189

7.1 Learning the Virtual Camera Environment ……… 189
7.2 Using VCam to Improve 2D Graphs ……… 195
7.3 Using VCam to Improve 3D Graphs ……… 199
7.4 Interactive Development of Animations ……… 206
7.5 Saving MuPAD Graphs ……… 212
7.6 Chapter Summary ……… 215
7.7 Exercises ……… 215

8. Exploring Mathematical Curves and Surfaces ……… 219

8.1 Plots in 2D Space & Plot Types ……… 219
8.1.1 Class Function2d ……… 219
8.1.2 Class Curve2d ……… 222
8.1.3 Developing Polar Plots ……… 224
8.1.4 Developing Implicit Plots ……… 226
8.2 Plots in 3D Space ……… 233
8.2.1 Class Function3d ……… 233
8.2.2 Class Surface ……… 239
8.2.3 Class Spherical ……… 242
8.2.4 Class Cylindrical ……… 245
8.2.5 Class Implicit3d ……… 247
8.2.6 Classes Curve3d and Tube ……… 249
8.3 Chapter Summary ……… 252
8.4 Programming Exercises ……… 253

9. A Few Applications of MuPAD Graphics ……… 259

9.1 Calculus Graphics ……… 259
9.1.1 Plotting Contours ……… 259
9.1.2 Developing Density Plots ……… 264
9.1.3 Vector Fields ……… 265
9.1.4 Plotting Areas ……… 267
9.1.5 Surfaces of Revolution ……… 272
9.2 Presentation Graphics ……… 274
9.3 Working with Geometry Objects ……… 279
9.4 Transformations of Graphical Objects ……… 295
9.5 Turtle Graphics & L-systems ……… 298
9.5.1 Turtle Graphics in MuPAD ……… 298
9.5.2 Plotting L-systems ……… 304
9.6 Chapter Summary ……… 309
9.7 Programming Exercises ……… 312

10. Exploring Numbers with MuPAD ……… 317

10.1 Integers in MuPAD ……… 317
10.2 Rational Numbers in MuPAD ……… 326
10.3 Real Numbers in MuPAD ……… 330
10.4 Complex Numbers in MuPAD ……… 335
10.5 Chapter Summary ……… 340
10.6 Programming Exercises ……… 342

11. Elementary Algebra and Trigonometry in MuPAD ……… 347

11.1 Polynomials ……… 347
11.2 Rational Expressions ……… 354
11.3 Algebraic Expressions ……… 358
11.4 Trigonometric and Other Functions ……… 359
11.5 Solving Equations and Inequalities ……… 365
11.6 Chapter Summary ……… 372
11.7 Programming Exercises ……… 373

12. Working with Sets and Sentences MuPAD……… 377

12.1 Logic in MuPAD ……… 377
12.1.1 Polish Notation ……… 380
12.2 Working with Sets ……… 386
12.3 Chapter Summary ……… 396
12.4 Programming Exercises ……… 397

13. Exploring Calculus with MuPAD ……… 401

13.1 Limits ……… 401
13.2 Derivatives ……… 409
13.3 Working with Integrals ……… 419
13.4 Infinite Series and Products ……… 428
13.5 Calculus of Two Variables ……… 433
13.5.1 Limits of Functions of Two Variables ……… 434
13.5.2 Partial Derivatives ……… 435
13.6 Chapter Summary ……… 438
13.7 Programming Exercises ……… 439

14. A Short Introduction to Linear Algebra ……… 445

14.1 Checking Resources ……… 445
14.2 Solving Linear Equations ……… 446
14.3 Matrices and Operations on Matrices ……… 449
14.3.1 Declaring Matrices in MuPAD ……… 449
14.3.2 Global Operations on Matrices ……… 455
14.3.3 Local Matrix Operations ……… 464
14.4 Determinants ……… 469
14.5 Chapter Summary ……… 474
14.6 Programming Exercises ……… 476

Appendix 1: MuPAD Libraries and Procedures……… 481

A1.1 MuPAD Libraries (ver. 3.0, 21/02/2004) ……… 482
A1.2 Operators Represented by Symbols ……… 483
A1.3 MuPAD Standard Collection ……… 483
A1.3.1 Procedures in Standard Collection ……… 483
A1.3.2 Functions in Standard Collection ……… 490
A1.4 Library ‘adt’ — Abstract Data Types ……… 492
A1.5 Library ‘Ax’ — Basic Axiom Constructors ……… 493
A1.6 Library ‘Cat’ — Category Constructors ……… 493
A1.7 Library ‘combinat’ — Combinatorial Functions ……… 494
A1.8 Library ‘detools’ — Methods for Differential Equations ……… 496
A1.9 Library ‘Dom’ — Domain Constructors ……… 497
A1.10 Library ‘fp’ — Utilities for Functional Programming ……… 498
A1.11 Library ‘generate’ — Generate Foreign Formats ……… 499
A1.12 Library ‘Graph’ — Utilities for Directed and Undirected Graphs ……… 499
A1.13 Library ‘groebner’ — Utilities for Groebner Bases ……… 502
A1.14 Library ‘import’ — Utilities for Reading Data ……… 502
A1.15 Library ‘intlib’ — Definite and Indefinite Integration ……… 502
A1.16 Library ‘linalg’ — the Linear Algebra Package ……… 502
A1. 17 Library ‘linopt’ — Tools for Linear Optimization ……… 505
A1.18 Library ‘listlib’ — Operations on Lists ……… 506
A1.19 Library ‘matchlib’ — Pattern Matching Tools ……… 506
A1.20 Library ‘module’ — Module Management Tools ……… 506
A1.21 Library ‘numeric’ — Tools for Numerical Methods ……… 507
A1.22 Library ‘numlib’ — Elementary Number Theory ……… 508
A1.23 Library ‘orthpoly’ — Orthogonal Polynomials ……… 510
A1.24 Library ‘output’ — Tools for the Output of Data ……… 510
A1.25 Library ‘plot’ — 2D and 3D Graphical Objects ……… 511
A1.26 Library ‘polylib’ — Tools for Polynomials ……… 515
A1.27 Library ‘prog’ — Programming Utilities ……… 516
A1.28 Library ‘property’ — Properties of Identifiers ……… 517
A1.29 Library ‘RGB’ — Color Names and Color Functions ……… 517
A1.30 Library ‘Series’ — Tools for Series Expansions ……… 519
A1.31 Library ‘solvelib’ — Tools for Solving Equations ……… 520
A1.32 Library ‘stats’ — Statistical Functions ……… 520
A1.33 Library ‘stringlib’ — Tools for String Manipulation ……… 524
A1.34 Library ‘student’ — the Student Package ……… 525
A1.35 Library ‘transform’ — Integral Transformations ……… 525
A1.36 Library ‘Type’ — Predefined Types ……… 525
A1.37 MuPAD Environmental Variables ……… 527

Appendix 2: MuPAD Resources……… 529

Index ……… 533

Advertisements