Book contents

1. Introduction ……. 1

1.1 What is Special about MuPAD ……. 2
1.2 What may you expect ……. 3
1.3 Writing “between” ……. 3
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 ……. 18
2.6 Chapter Summary ……. 21
2.7 Review Exercises ……. 22

3. Programming in MuPAD – Declarations……. 25

3.1 Declaring Variables and Functions ……. 25
3.2 Declaring Functions ……. 28
3.3 Writing Formulae in MuPAD ……. 30
3.4 Writing More than One Line of Code ……. 32
3.5 The Basics of the Domain Concept ……. 33
3.6 Chapter Summary ……. 37
3.7 Review exercises ……. 40

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

4.1 Decisions ……. 43
4.1.1 MuPAD Syntax: the “if..then” Statement ……. 45
4.1.2 Indentation in MuPAD ……. 46
4.1.3 Quadratic Equation Example ……. 47
4.1.4 Formatting the Output ……. 50
4.1.5 elif – a Useful Shortcut ……. 51
4.2 Programming Iterations in MuPAD ……. 52
4.2.1 The “for” loop ……. 52
4.2.2 MuPAD Syntax: the “for” Loop ……. 53
4.2.3 The “while” and “repeat” Loops ……. 54
4.2.4 MuPAD Syntax: the “while” and “repeat” Loops ……. 56
4.3 Selections ……. 56
4.3.1 MuPAD Syntax: the “case” Structure ……. 59
4.4 Chapter Summary ……. 60
4.5 Programming Exercises ……. 62

5. Programming in MuPAD – Procedures and Libraries ……. 65

5.1 What is a Procedure ……. 68
5.2 Examples of Procedures ……. 68
5.3 Getting Output from Procedures ……. 75
5.4 Returning Unevaluated or Symbolic Expressions ……. 78
5.5 Shall We use Global or Local Variables? ……. 80
5.6 Using the Right Data Types in Procedures ……. 83
5.7 Domains and Types Summary ……. 87
5.8 Using Procedures to Produce Data Structures ……. 92
5.8.1 Sequences ……. 92
5.8.2 Lists ……. 94
5.8.3 Sets ……. 95
5.8.4 Strings ……. 95
5.8.5 Vectors and Matrices ……. 97
5.9 Procedures with Variable Number of Parameters ……. 100
5.10 Recursive Procedures ……. 103
5.11 Using Libraries ……. 107
5.12 User Defined Libraries of Procedures ……. 110
5.13 Final Comments on MuPAD Coding Guidelines ……. 114
5.13.1 Magic Numbers ……. 115
5.13.2 Comments ……. 115
5.13.3 Braces ……. 116
5.14 Chapter Summary ……. 118
5.15 Programming Exercises ……. 122

6. Introduction to MuPAD Graphics ……. 125

6.1 Obtaining Quick Plots ……. 125
6.1.1 Procedure plotfunc2d ……. 126
6.1.2 Procedure plotfun3d ……. 130
6.2 General Concept of MuPAD Plots ……. 131
6.2.1 Object Attributes & Options ……. 135
6.3 Object Options ……. 139
6.3.1 Color ……. 139
6.3.2 Grid ……. 142
6.3.3 Smoothness ……. 143
6.3.4 LineWidth ……. 143
6.3.5 LineStyle ……. 144
6.3.6 Style for 2D Objects ……. 144
6.3.7 Style for 3D Objects ……. 144
6.3.8 PointStyle & PointWidth ……. 147
6.3.9 Filled ……. 150
6.3.10 RealValuesOnly ……. 150
6.3.11 Discont ……. 150
6.3.12 Title & TitlePosition ……. 150
6.4 Scene-Specific Plotting Options ……. 151
6.4.1 Axes ……. 151
6.4.2 Labeling ……. 151
6.4.3 Environment ……. 152
6.4.5 Output ……. 153
6.4.6 Object Options Defined in Scene ……. 154
6.5 Operations on Graphical Objects ……. 155
6.5.1 Operation copy ……. 155
6.5.2 Operation modify ……. 156
6.5.3 Operation Group ……. 157
6.6 Chapter Summary ……. 159
6.7 Programming Exercises ……. 163

7. Exploring Mathematical Curves and Surfaces ……. 165

7.1 VCam Tool ……. 165
7.2 Plots in 2D Space & Plot Types ……. 170
7.2.1 Procedure Function2d ……. 170
7.2.2 Procedure Curve2d ……. 173
7.2.3 Developing Polar Plots ……. 176
7.2.4 Developing Implicit Plots ……. 178
7.3 Plots in 3D Space ……. 184
7.3.1 Procedure Function3d ……. 184
7.3.2 Procedure Surface3d ……. 190
7.3.3 Procedure spherical ……. 192
7.3.4 Procedure cylindrical ……. 196
7.3.5 Procedure Curve3d ……. 198
7.4 Chapter Summary ……. 200
7.5 Programming Exercises ……. 201

8. A Few Applications of MuPAD Graphics ……. 207

8.1 Calculus Graphics ……. 207
8.1.1 Plotting Contours ……. 207
8.1.2 Developing Density Plots ……. 211
8.1.3 Vector Fields ……. 213
8.1.4 Plotting Inequalities ……. 215
8.1.5 Operations on Functions ……. 217
8.2 Presentation Graphics ……. 219
8.2.1 Presentation Graphics in MuPAD Version 2.0 ……. 220
8.2.2 Presentation Graphics in MuPAD Versions 2.x ……. 223
8.3 Working with Geometry Objects……. 224
8.4 Turtle Graphics & L-systems ……. 236
8.4.1 Turtle Graphics in MuPAD ……. 236
8.4.2 Plotting L-systems ……. 240
8.5 Chapter Summary ……. 245
8.6 Programming Exercises ……. 248

9. Exploring Numbers with MuPAD ……. 253

9.1 Integers in MuPAD ……. 253
9.2 Rational Numbers in MuPAD ……. 261
9.3 Real Numbers in MuPAD ……. 266
9.4 Complex Numbers in MuPAD ……. 271
9.5 Chapter Summary ……. 276
9.6 Programming Exercises ……. 279

10. Elementary Algebra and Trigonometry in MuPAD ……. 283

10.1 Polynomials ……. 283
10.2 Rational Expressions ……. 290
10.3 Algebraic Expressions ……. 293
10.4 Trigonometric and other Functions ……. 294
10.5 Solving Equations and Inequalities ……. 299
10.6 Chapter Summary ……. 308
10.7 Programming Exercises ……. 309

11. Working with Sets and Sentences MuPAD……. 311

11.1 Logic in MuPAD ……. 311
11.1.1 Polish Notation ……. 314
11.2 Working with Sets ……. 320
11.3 Chapter Summary ……. 329
11.4 Programming Exercises ……. 330

12. Exploring Calculus with MuPAD ……. 333

12.1 Limits ……. 333
12.2 Derivative ……. 340
12.3 Working with Integrals ……. 350
12.4 Infinite Series and Products ……. 359
12.5 Calculus of Two Variables ……. 365
12.5.1 Limits of Functions of Two Variables ……. 366
12.5.2 Partial Derivatives ……. 367
12.6 Chapter Summary ……. 371
12.7 Programming Exercises ……. 372

13. Linear Equations, Matrices and Determinants ……. 377

13.1 Checking Resources ……. 377
13.2 Solving Linear Equations ……. 379
13.3 Matrices and Operations on Matrices ……. 381
13.3.1 Declaring Matrices in MuPAD ……. 381
13.3.2 Global Operations on Matrices ……. 387
13.3.3 Local Matrix Operations ……. 395
13.4 Determinants ……. 401
13.5 Chapter Summary ……. 406
13.6 Programming Exercises ……. 409

Appendix 1: MuPAD Libraries and Procedures……. 413

A1.1 MuPAD Libraries (ver. 2.5, 18/01/2002) ……. 414
A1.2 Operators Represented by Symbols ……. 415
A1.3 MuPAD Standard Collecton ……. 415
A1.4 Library ‘adt’ — Abstract Data Types ……. 423
A1.5 Library ‘Ax’ — Basic Axiom Constructors ……. 423
A1.6 Library ‘Cat’ — Category Constructors ……. 423
A1.7 Library ‘combinat’ — Combinatorial Functions ……. 424
A1.8 Library ‘detools’ — Methods for Differential Equations ……. 425
A1.9 Library ‘Dom’ — Domain Constructors ……. 426
A1.10 Library ‘fp’ — Utilities for Functional Programming ……. 427
A1.11 Library ‘generate’ — Generate Foreign Formats ……. 428
A1.12 Library ‘groebner’ — Utilities for Groebner Bases ……. 428
A1.13 Library ‘import’ — Utilities for Reading Data ……. 428
A1.14 Library ‘intlib’ — Definite and Indefinite Integration ……. 428
A1.15 Library ‘linalg’ — the Linear Algebra Package ……. 428
A1. 16 Library ‘linopt’ — Tools for Linear Optimization ……. 431
A1.17 Library ‘listlib’ — Operations on Lists ……. 431
A1.18 Library ‘matchlib’ — Pattern Matching Tools ……. 432
A1.19 Library ‘module’ — Module Management Tools ……. 432
A1.20 Library ‘Network’ — Tools for Directed Graphs ……. 432
A1.21 Library ‘numeric’ — Tools for Numerical Methods ……. 433
A1.22 Library ‘numlib’ — Elementary Number Theory ……. 435
A1.23 Library ‘orthpoly’ — Orthogonal Polynomials ……. 436
A1.24 Library ‘output’ — Tools for the Output of Data ……. 437
A1.25 Library ‘plot’ — 2D and 3D Graphical Objects ……. 437
A1.26 Library ‘polylib’ — Tools for Polynomials ……. 439
A1.27 Library ‘prog’ — Programming Utilities ……. 440
A1.28 Library ‘property’ — Properties of Identifiers ……. 440
A1.29 Library ‘RGB’ — Color Names ……. 441
A1.30 Library ‘Series’ — Tools for Series Expansions ……. 444
A1.31 Library ‘solvelib’ — Tools for Solving Equations ……. 444
A1.32 Library ‘specfunc’ — Elementary and Special Functions ……. 445
A1.33 Library ‘stats’ — Statistical Functions ……. 446
A1.34 Library ‘stringlib’ — Tools for String Manipulation ……. 450
A1.35 Library ‘student’ — the Student Package ……. 451
A1.36 Library ‘transform’ — Integral Transformations ……. 451
A1.37 Library ‘Type’ — Predefined Types ……. 451
A1.38 MuPAD Environmental Variables ……. 453

Appendix 2: MuPAD Resources……. 455

Advertisements