\mnb150ÿ{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss\fprq2 System;}{\f3\fswiss\fprq2 Trebuchet MS;}{\f4\fmodern\fprq1 Lucida Sans Typewriter;}} {\colortbl\red0\green0\blue0;\red255\green0\blue0;} \deflang1033\pard\ri4\plain\f3\fs44\cf0 Chapter 1 Introduction to MuPAD\plain\f3\fs36\cf0 \par \plain\f3\fs28\cf0 \par 1.1 A brief history of MuPAD \par \par 1.2 MuPAD as a calculator \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab} 234 + 675 \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}98765467.89765/3456.987654 \par {\pntext\f1\'b7\tab}234! \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}DIGITS := 50 \par {\pntext\f1\'b7\tab}sqrt(2.0) \par \pard\ri4\plain\f3\fs28\cf0 \par Technical comment: \par ================= \par There are two important symbols, ":" and "//", useful for formatting MuPAD output. \par If we use the symbol ":" at the end of a MuPAD statement, then MuPAD produces the \par result, but it does not display it on the screen. If we use the symbol "//" in a MuPAD \par statement, then anything written to the right of it is treated as a comment \par and is not executed. \par \par Technical comment: \par ================= \par While writing MuPAD statements we should avoid using characters that do not \par exist in the English alphabet such as special symbols in Polish, Czech, Portuguese, \par etc. Usually MuPAD produces an error message if we do. However, we can use these \par characters in comments to the right of "//". \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}123/345 // Here we produce an exact result. \par {\pntext\f1\'b7\tab}123.0/345 // Here we produce a decimal result. \par {\pntext\f1\'b7\tab}float(123/345) // Here is another way of getting decimal result. \par \pard\ri4\plain\f3\fs28\cf0 \par >>>>>>>>>> Time for Exercise 1.1 \par >>>>>>>>>> Time for Exercise 1.2 \par \par 1.3 Solving equations \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}solve(x^4 - 4*x^2 - 1 = 0, x) \par {\pntext\f1\'b7\tab}solve(x^3 - 4*x^2 - 1 = 0, x) \par {\pntext\f1\'b7\tab}A := solve(x^3 - 4*x^2 - 1 = 0, x) \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}float(A) \par \pard\ri4\plain\f3\fs28\cf0 \par Technical comment: \par ================= \par For polynomial equations of order higher than 2, MuPAD often produces \par results as RootOf if their solutions contain radicals. This is because the \par resulting formula may be very complex and may not fit on the screen. \par However, we can force the program to display results in exact form. \par This can be done by using the solve statement, with parameters \par MaxDegree=3 or MaxDegree=4. For example, a statement like \par solve(x^3-4*x^2-1=0,x,MaxDegree=3) can produce the desired formula. \par \par Technical comment: \par ================ \par MuPAD statements use specific words such as solve, float, etc. We will \par call such words the names of procedures or, for short, procedures. \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}solve(\{3*x+2*y-1 = 0, -6*x+4*y-6 = 0\}, \{x,y\}) \par {\pntext\f1\'b7\tab}solve(\{x+2*y-1 = 0, -2*x+4*y^2-2 = 0\}, \{x,y\}) \par {\pntext\f1\'b7\tab}EQ1 := \{x + 2*y - 1 = 0, -2*x + 4*y^2 - 2 = 0\} \par {\pntext\f1\'b7\tab}Var1 := \{x,y\} \par {\pntext\f1\'b7\tab}solve(EQ1, Var1) \par \pard\ri4\plain\f3\fs28\cf0 \par Time for Exercise 1.3 \par \par 1.4 Transforming mathematical expressions \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}A := (x - 3)^2*(x - 1)^3*(x - 5) \par {\pntext\f1\'b7\tab}B := expand(A) \par {\pntext\f1\'b7\tab}factor(B) \par {\pntext\f1\'b7\tab}simplify(sin(2*x)^2 + cos(2*x)^2) \par {\pntext\f1\'b7\tab}Simplify(sin(3*x) * cos(3*x)) //Note, capital S \par {\pntext\f1\'b7\tab}simplify(exp(x)*exp(3*x)-exp(x)*exp(2*x)) \par \pard\ri4\plain\f3\fs28\cf0 \par Technical comment: \par ================= \par Starting from version 3.0, MuPAD contains two procedures: simplify and Simplify. \par Their names begin with a lowercase and an uppercase "s". The procedure simplify \par is sufficient for most elementary examples. The procedure Simplify is more \par "intelligent" and can handle more complex expressions. However, in many \par situations this procedure is slower. \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}simplify(sqrt(4 + 2*sqrt(3)), sqrt) \par {\pntext\f1\'b7\tab}P := x*y + a*x*y + x^2*y - a*x*y^2 + x + a*x \par {\pntext\f1\'b7\tab}collect(P, x) // collecting in respect to x \par {\pntext\f1\'b7\tab}collect(P, y) // collecting in respect to y \par {\pntext\f1\'b7\tab}collect(P,[x,y]) // collecting for x and y \par {\pntext\f1\'b7\tab}w := x^2/(x^3 - 3*x + 2) \par {\pntext\f1\'b7\tab}partfrac(w) \par \pard\ri4\plain\f3\fs28\cf0 \par >>>>>>>>>>> Time for Exercise 1.4 \par \par 1.5 Differentiation and integration \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}w := x^2/(x^3 - x + 1) \par {\pntext\f1\'b7\tab}diff(w,x) \par {\pntext\f1\'b7\tab}diff(w,x,x) \par {\pntext\f1\'b7\tab}h := sin(x)/cos(x) \par {\pntext\f1\'b7\tab}diff(h,x,x,x) \par {\pntext\f1\'b7\tab}u := (sin(x) + cos(y))*(cos(x) - sin(y)) \par {\pntext\f1\'b7\tab}diff(u,x,y) \par {\pntext\f1\'b7\tab}int(x^2 + 3*x + 1, x) \par {\pntext\f1\'b7\tab}int(x^2 + 3*x + 1, x=0..10) \par \pard\ri4\plain\f3\fs28\cf0 \par >>>>>>>>>> Time for Exercise 1.5 \par \par 1.6 Declaring functions \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}f := x->1/(1 + x^3) \par {\pntext\f1\'b7\tab}diff(f(x),x) \par {\pntext\f1\'b7\tab}int(f(x),x) \par {\pntext\f1\'b7\tab}int(f(x), x = 0..5) \par {\pntext\f1\'b7\tab}int(f(x), x = 0..+infinity) \par {\pntext\f1\'b7\tab}f := x->1/(1+x^3) \par {\pntext\f1\'b7\tab}limit(f(x), x=0) \par {\pntext\f1\'b7\tab}limit(f(x),x = -1) \par {\pntext\f1\'b7\tab}limit(f(x), x = -1, Left) \par {\pntext\f1\'b7\tab}limit(f(x), x = -1, Right) \par {\pntext\f1\'b7\tab}en := n->(1+1/n)^n \par {\pntext\f1\'b7\tab}limit(en(n), n = +infinity) \par {\pntext\f1\'b7\tab}f := x->1/(1+x^3) \par {\pntext\f1\'b7\tab}f(1.234) \par \pard\ri4\plain\f3\fs28\cf0 >>>>>>>>>> Time for Exercise 1.6 \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}f := x -> piecewise([x<-1,-x],[x<1,1],[x>1,x]) \par {\pntext\f1\'b7\tab}f := x->1/(1+x^3) \par {\pntext\f1\'b7\tab}plotfunc2d(f(x), x=-3..2) \par \pard\ri4\plain\f3\fs28\cf0 \par 1.7 Graphs of functions in one variable \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}plotfunc2d(tan(x), cot(x), x = 0..2*PI): \par \pard\ri4\plain\f3\fs28\cf0 \par >>>>>>>>>> Time for Exercise 1.7 \par \par 1.8 Graphs of functions of two variables \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}plotfunc3d( \par \pard\li600\ri1\fi-300\plain\f4\fs28\cf1 sin(x^2 + y^2), cos(x^2 - y^2), \par x=-1.5..1.5, y=-1.5..1.5 \par ): \par \pard\ri4\plain\f3\fs28\cf0 \par Technical comment: \par ================= \par As we already know, pressing the [Enter] key inside an input region \par forces MuPAD to execute a statement. If for some reason we want \par to split our statement into two or more lines, we can create line \par breaks by pressing the keys [Shift] and [Enter] simultaneously. \par \par Technical comment: \par ================= \par Any two consecutive statements in the same input region must \par always be separated by ";" or ":" symbols. \par \par >>>>>>>>>> Time for Exercise 1.8 \par \par 1.9 Selected mathematical structures in MuPAD \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}A := 1, -2, 3, -4, 5, -5, 6, -8, 8, -3, 4 \par {\pntext\f1\'b7\tab}B := \{1, -2, 3, -4, 5, -5, 6, -8, 8, -3, 4\}: \par \pard\li600\ri1\fi-300\plain\f4\fs28\cf1 C := \{-1, 2, 7, 4, -5, 5, 9, -8, 10, 3, -4\}: \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}B union C \par {\pntext\f1\'b7\tab}B intersect C \par {\pntext\f1\'b7\tab}B minus C \par {\pntext\f1\'b7\tab}MyEmptySet := \{\} \par {\pntext\f1\'b7\tab}MyEmptyList := [] \par {\pntext\f1\'b7\tab}MySequence := 1,2,3,4 \par {\pntext\f1\'b7\tab}Sequence2 := MySequence,5,7,8 \par {\pntext\f1\'b7\tab}MySet := \{a,b,c\}: \par {\pntext\f1\'b7\tab}MySet2 := MySet union \{2,3,4,3,4\} \par {\pntext\f1\'b7\tab}List1 := [1,2,3,4] \par {\pntext\f1\'b7\tab}List2 := List1.[3,4,5,6] \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}A := [1,2,3]: \par {\pntext\f1\'b7\tab}A := op(A): \par {\pntext\f1\'b7\tab}A := \{A\} \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}A := sin(n*PI/3) $ n = 2..10 \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}B := [A] \par {\pntext\f1\'b7\tab}C := \{A\} \par {\pntext\f1\'b7\tab}n $ 10 \par {\pntext\f1\'b7\tab}A := matrix([[1, 5, 5], [2, 3, 8], [2,7, 8]]) \par {\pntext\f1\'b7\tab}B := matrix(3, 1, [1,2,3]) \par {\pntext\f1\'b7\tab}C := matrix (1, 3, [1,2,3]) \par \pard\ri4\plain\f3\fs28\cf0 \par >>>>>>>>>> Time for Exercise 1.9 \par \par 1.10 Looking for help \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}info(stdlib) \par {\pntext\f1\'b7\tab}info(radsimp) \par {\pntext\f1\'b7\tab}?radsimp \par {\pntext\f1\'b7\tab}U := (1/2 + 1/4*3^(1/2))^(1/2) \par {\pntext\f1\'b7\tab}radsimp(U) \par {\pntext\f1\'b7\tab}anames() \par \pard\ri4\plain\f3\fs28\cf0 \par 1.11 Using libraries \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}info() \par {\pntext\f1\'b7\tab}info(student) \par {\pntext\f1\'b7\tab}simpson(sin(x),x=0..PI) \par {\pntext\f1\'b7\tab}student::simpson(sin(x),x=0..PI) \par {\pntext\f1\'b7\tab}float(%) \par {\pntext\f1\'b7\tab}export(student, simpson): \par {\pntext\f1\'b7\tab}simpson(x^3,x=0..1) \par {\pntext\f1\'b7\tab}float(%) \par \pard\ri4\plain\f3\fs28\cf0 \par >>>>>>>>>> Time for Exercise 1.10 \par \par 1.12 Tracing basic errors \par \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}myNumber := 12 \par {\pntext\f1\'b7\tab}nextNumber := myNumber+1 \par {\pntext\f1\'b7\tab}newNumber \par {\pntext\f1\'b7\tab}is(A=123) \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}p := x^2 - 3*x - 3 \par {\pntext\f1\'b7\tab}p \par {\pntext\f1\'b7\tab}solve(x^2 - 3*x - 3 = 0, x) \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}delete x \par {\pntext\f1\'b7\tab}p \par {\pntext\f1\'b7\tab}reset() \par {\pntext\f1\'b7\tab}A:=34 \par {\pntext\f1\'b7\tab}A:=A+1 \par {\pntext\f1\'b7\tab}A^2 \par {\pntext\f1\'b7\tab}(A^2)^2 \par \pard\ri4\plain\f3\fs28\cf0 \par \pard\li300\ri5\fi-300{\*\pn\pnlvlblt\pnf1\pnindent300{\pntxtb\'b7}}\plain\f4\fs28\cf1 {\pntext\f1\'b7\tab}last(1) \par \pard\ri4\plain\f3\fs28\cf0 \par >>>>>>> Time for Exercise 1.11 \par }