Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple...

17
Introduction to Maple Maple is a Computer Algebra System, that is, a program that is able to manipulate information in a symbolic or algebraic manner. You can use Maple for finding derivatives, simplifying expressions, solving differential equations etc. This document describes what you need to know to start using Maple. Starting Up, Finishing Off, and Checking Help When you start Maple 11, you will be faced something like the following: You first want to close the “Startup” window. By default, Maple opens a “Document, using “2-D Notation for Exe- cution Groups. This gives you nice output, but can cause Maple to behave in unexpected ways. You want to open a “Worksheet, and change the “Input Display to “Maple Notation. To do the latter, 1. Select “Options” under the “Tools” menu 2. Click on the “Display” tab 3. Select “Maple Notation” for the “Input Display.” 4. If you are using a computer in the computer lab, click on “Apply to Session” (the lab computers will not allow you to change global default behaviour). If you are at home, click on “Apply Globally.” 5. Use the “File” menu to open a new “Worksheet.” You are now ready to use Maple. You should be faced with: The Maple window should have a black [, followed by a red >, and a flashing vertical bar. 1

Transcript of Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple...

Page 1: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

Introduction to Maple

Maple is a Computer Algebra System, that is, a program that is able to manipulate information in a symbolic oralgebraic manner. You can use Maple for finding derivatives, simplifying expressions, solving differential equationsetc. This document describes what you need to know to start using Maple.

Starting Up, Finishing Off, and Checking HelpWhen you start Maple 11, you will be faced something like the following:

You first want to close the “Startup” window. By default, Maple opens a “Document, using “2-D Notation for Exe-cution Groups. This gives you nice output, but can cause Maple to behave in unexpected ways. You want to open a“Worksheet, and change the “Input Display to “Maple Notation. To do the latter,

1. Select “Options” under the “Tools” menu2. Click on the “Display” tab3. Select “Maple Notation” for the “Input Display.”4. If you are using a computer in the computer lab, click on “Apply to Session” (the lab computers will not allow

you to change global default behaviour). If you are at home, click on “Apply Globally.”5. Use the “File” menu to open a new “Worksheet.”

You are now ready to use Maple. You should be faced with:

The Maple window should have a black [, followed by a red >, and a flashing vertical bar.

1

Page 2: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

2 introduction to maple

Opening an Existing Maple File

You can, of course, open an existing Maple file by double clicking on it, or by using the “Open...” dialogue box inthe “File” menu. If you open an existing file, none of the commands have been executed, despite what the windowcontents suggest. “Execute” the “Worksheet” from the “Edit” menu before doing anything else.

Finishing Off

To end a Maple session choose “Quit” from the “File” menu, or press “Alt” and “F4” simultaneously.

Checking Help

Maple has an extensive Help menu, covering all its commands. You can access the Help menu from “Help in thetoolbar, and then do a search on the command. If you know the name of the command, you can also type in “?commandname in an Execution Group.

The top of the Help page on a command will have either “command name or “package name[command name]. Inthe second case, you need to load the package before using the command. The next part of the Help page gives thesyntax for the command. Check Data Types in this document to understand what the syntax means. Next is a detaileddescription of the command and its arguments, followed by examples. The examples are often very informative, so ifyou cant figure out the Help page, check the examples.

Maple’s Groups

A group in Maple is a set of consecutive lines grouped together. A “[” in the left margin encloses a group. Maple hastwo types of groups: Execution and Text Groups. You type in commands and execute them in an Execution Group,and type in text (which is not to be executed) in a Text Group. An Execution Group has a “>” in the left margin, whilea Text Group does not.

You add a text group after the group the cursor is in by clicking on the “T” in the toolbar, and you can add an executiongroup after the group the cursor is in by clicking on the “[>” in the toolbar. You can delete an element, for example,the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”menu, or pressing “Ctrl-Delete” on the keyboard.

Basic editing functions behave as you would expect. You can edit any line you like, cut-and-paste, etc. You can evencut-and-paste the result of a command into a Text Group!

Text Groups

You type text, that is, words you do not want Maple to treat as commands, into text groups. To add a Text Group afterthe cursor by clicking on “T in the toolbar. Do not use the “Text button or the drop-down style menu! You will still bein an Execution Group, so Maple may behave in unexpected ways.

Typing into a Text Group is similar to using a Word Processor. You can cut-and-paste in a Text Group, and can evencut-and-paste results of commands in Execution Groups. The toolbar directly above the Maple window includes astyle menu, which lets add nicely formatted titles, headings, etc, and a font menu.

To add a properly-formatted math expression, click on “Math” directly above the style menu, and type in the expressionusing Maple syntax described below. When you want to go back to typing text, click on “Text.” There are some mathexpressions Maple refuses to format properly when you add them to text. For example, typing in “theta,” even if youclicked on “Math” first, will not give θ. If Maple does not format your math properly, either use the palettes on theleft-hand side of the window (for example, the Greek palette will give you Greek letters), or open a new worksheet,type the desired math in an Execution Group, and cut-and-paste the result back to the original worksheet.

Page 3: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

introduction to maple 3

Execution Groups and Basic Maple Syntax

Execution Groups

You type math commands into Execution Groups. To add an Execution Group after the cursor, click on “[> in thetoolbar. Type in the commands to the right of the “>,” end the command with a “;” and the result will be displayedin blue on the next line. The cursor (the flashing bar) tells you if your “Input Display” (how the commands you typein appear in the window) is “Maple notation” or “2-D math notation.” If it is vertical, you are using Maple notation,and if it slants, you are using 2-D math notation. Remember that 2-D notation looks nice but can be misinterpreted byMaple even when it looks right. Make sure to use Maple notation instead. If you need to switch notations on-the-fly,press the “F5” key.

First Maple Commands and Syntax

One thing to remember when using Maple is that Maple gives you tools to do math. If you need to multiply out an uglyexpression, Maple can do the algebra for you. However, Maple cannot do math. For example, there is no commandthat says, “Find all roots of the following function.” Maple will do the algebraic steps for you, but you need to knowwhat those steps are.You can think of Maple as a programming language for math, with commands for differentiating expressions, graph-ing expressions, etc. The basic syntax for the commands is command name(comma separated list of required argu-ments,comma separated list of optional arguments). Commands end with a “;” if you want to see the result, or a “:”if you don’t. You press the “Return” or “Enter” key to execute the command. The result will be displayed on the nextline, in blue.

Examples

Some commands are not loaded when Maple starts, but are contained in separate packages. Check the Help menu todetermine what package (if any) a command is in. To load a package, type “with(package name); in an ExecutionGroup.

Syntax for Typing in ExpressionsThe syntax for mathematical expressions is similar to the syntax used for graphing calculators. Multiplication uses a“*”, and must be explicit. Maple does not understand “2x”, but does understand “2*x”. The remaining algebraic oper-ations are similar to your calculator, namely + for addition, - for subtraction, / for division and ∧ for exponentiation.As with a graphing calculator, use brackets liberally!

Page 4: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

4 introduction to maple

Nasty Details1. If you want ex, type in “exp(x)”. Maple interprets “e” as an unknown constant, rather than the base of the

exponential function. If you need the number “e”, type in “exp(1)”.

2. The syntax for evaluation a function in Maple is “function name(value or expression). To find cosπ, type in“cos(Pi).

3. The base of “log” is e, not 10. If you want log base 10 of 5, for example, type in “log10(5)”, and if you wantlog base 7 of 8, for example, type in “log[7](8)”.

4. The number π is known as “Pi”, with a capital. “pi” is the Greek letter, π.

5. The trig functions use radians by default. Also, powers of trig functions come after the bracket followingargument (as, strictly speaking, they should) rather than after the function: “cos(x)∧2”, not “cos∧2(x)”

5. The inverse trig functions are arcsin, arccos, etc.

Giving a Maple Result a NameIf you will use the result of a Maple command later, it is a good idea to give it a name. You can then refer to the resultby that name for future commands, rather than typing in the result, or cutting and pasting it in.

When you give a result a name,

1. Choose one that is meaningful. If you use A, B, C, etc., it is very difficult to figure out what is going on.

2. Choose one that is not a command name. Maple will tell you such things are “protected” and ask if you want tounprotect them. Do not do so! Choose a different name instead.

3. Choose one that is not a letter you are likely to use later. If you set x:=2, and later plot x∧2, you will be told thatthere are invalid arguments. If you make this mistake, delete the offending line, type in restart; and “Executethe Worksheet” (under the “Edit” menu).

You will sometimes see a “%” in a Maple command. This refers to the last calculated result. Using “%” is notrecommended because if you have been editing the Worksheet, the last result Maple has calculated may well bedifferent from what you think it is. When this happens, “Execute” the “Worksheet” from the “File” menu to straightenMaple out.

Page 5: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

introduction to maple 5

Error Messages

As with all computer programs, the most frustrating part of Maple is the cryptic error messages. If Maple complains,some common problems are:

1. Missing “;”, missing brackets, or missing “*”. Maple is usually able to identify these correctly, but it is likely toscrew up the location of missing brackets.

2. Missing or extra parameters for procedures. These produce particularly cryptic messages. Check the help entryon the relevant function.

3. Data of the wrong type. Maple commands expect particular types of data. For example, “diff expects the firstargument to be an expression. If it gets a function, Maple may get confused. Also, the result Maple gives for somecommands may be Maple procedures (essentially a Maple program). For example, if Maple cant solve a differentialequation exactly, it will return a procedure, and if Maple cant solve an equation, it will return a list of “ RootOf ....s.If you use these results in a command that expects a function or number, Maple will complain about the data typebecause a procedure is not a function, and a “RootOf is not a number. For “RootOf, enclose the command producingthe “RootOf” with an “evalf(...)”.

4. Non-existent commands. In this case Maple does not complain, but the result it spits out is precisely what youtyped in. First check help to see if your command exists. You may get an entry with first line like “plots[implicitplot]”,or you may get a dialog box asking you to choose between several commands, eg. “simplex,display, plots,display”.The part before the square brackets or the part before the “,” identifies the package the command is in. To load thepackage, and the command, type “with(package);”. Should there be no entry at all, try the help menu, using full-textsearch.

Data Types

Maple “knows” what an interval is, what an expression is and what a function is. However, you need to tell Maple thatwhat you have typed in is a function, say.

sequence A sequence is an arbitrary string of characters.

string You sometimes want a string of characters to be displayed, unprocessed. Such a string of characters is called astring, and is identified by enclosing it in double quotes.

List Maple distinguishes between lists and sets, but in most cases you want to use lists (a list has a first entry, secondentry, etc., while a set does not). You identify a list by enclosing the elements of the list, separated by commas, withsquare brackets. For example, “[x,2,3∧x,2] is the list, x, 2, ex, 2, in that order. You can also identify a particularelement of a list. If you have named the above list “alist, the first entry will be “alist[1], the second, “alist[2],etc.

Page 6: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

6 introduction to maple

Set A set is similar to a list, but there is no order in a set, and no element in the set can occur more than once. Youidentify a set by enclosing the elements of the set, separated by commas, with braces ({ and }).

Interval When plotting, or “fsolving” the interval is written “left endpoint..right endpoint”, and is known as a “rangeof values”.

Expression If you type in a mathematical expression, Maple assumes it is such.

Function You identify a function by “function name:=variable -> expression;”. For example, g:=x->x∧2; identifiesg as g(x) = x2. When naming a function, do not use f(x):=.... f(3) will then not be what you think it is (butf(x)(3) probably will). Once you have named your function, you can evaluate it easily. For example, using g, g(4)will spit out 16. Some Maple commands want expressions rather than functions. Evaluating the function at “x”, forexample, will change it into an expression in x.

A Glossary of Popular CommandsYou can use the “Help” menu to get help on Maple commands. You can use the search field in the upper left to searchfor arbitrary text. For example, if you cannot remember how to differentiate in Maple, type “differentiate” into the

Page 7: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

introduction to maple 7

search field, and a long list of possible help pages will appear. If you have an idea of what the name is, you can alsotype “?command name” in an execution group of your worksheet. This is often faster than going through the Helpmenu.Even if the Help entry is confusing, scroll to the end, where you will see examples of the command in use.

Algebra Commands

eval(expression, variable = value): substitutes in the given value for the given variable in the expression. The secondargument can be replaced by a list of equations. Unless one of the numbers in the expression is already a decimal, theresult will be an exact answer.

evalf(expression): Changes exact numbers into decimals.

expand(expression): multiplies out the given expression and collects like terms.

factor(expression): factors the given polynomial. If the optional “real” or “complex” is not present, Maple uses thecoefficients of the polynomial to determine whether to factor over the rationals, reals or complex numbers. If you wantfactorization over reals, type “factor(expression,real)”.

fsolve(equation): finds one, and sometimes more, roots of the given equation and where necessary, gives a decimalanswer. If an expression rather than an equation is used, Maple sets the expression to 0 and solves the resultingequation. If the equation has more than one variable, specify the variables you are looking for after the equation. Ifyou want a root in a given interval, use the optional argument “variable=range”, and if you know a number close tothe root, use the optional argument “variable=number”, where the number is close to the root. If you want to use both,make sure “variable=range” is second.

Page 8: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

8 introduction to maple

To ensure that Maple is getting the root you want, and to cut down on computing time and memory, it is always a goodidea to bring all terms in the equation to the left-hand side, plot the result, and either identify an interval containingthe desired root, or a number close to it. In the following example, if we wanted the second positive root, fsolve withno optional arguments would have given us the wrong answer!

simplify(expression): simplifies the given expression. What Maple thinks is fully simplified is often what you thinkis insufficiently simplified. Some simplification by hand may therefore be necessary.

Page 9: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

introduction to maple 9

solve(expression or equation,variable): solves the equation for the given variable. If given an expression, sets theexpression to 0 and then solves. solve can be used for symbolic solutions (eg. solve F = ma for a) or to findnumerical solutions. Maple tries to find exact, though possible complex, solutions where possible, and spits out“RootOf” solutions otherwise. If you want real solutions only, add the optional argument “real” after the secondargument. If Maple finds more than one root, the result will be a list of solutions. If a numerical solution is desired,use “fsolve”.

Functions

The trig functions are “sin(x)”, “cos(x)”, “tan(x)”, “cot(x)”, “sec(x)”, “csc(x)”. The inverse trig functionsare “arcsin(x)”, “arccos(x)”, “arctan(x)”, “arccot(x)”, “arcsec(x)”, “arccsc(x)”. The exponential func-tion is “exp(x)”, and “log(x)” is the natural logarithm. If you want base 10, use “log10(x),” and if you wantanother base, say 20, use “log[20](x). You use “->” to identify a function.

piecewise(condition,expression,condition, expression, condition,...): defines a piecewise expression. The first ex-pression holds when the first condition is true, the second, when the second is true, etc. Conditions are usually of theform “variable<number”, “variable<=number”, “variable=number”, “variable<number and variable>=number”.Notice “and” is used for intersection, and, of course, “or” is used for union.

Plotting Commands

Maple’s plotting commands allow you to do far more than we can describe here, so we describe only the basics.

plot(expression,variable = range): plots the given expression over the given range. To restrict the y-axis, the x-range isfollowed by the optional argument “variable=range” where “variable” is the dependent variable. For discontinuous

Page 10: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

10 introduction to maple

functions or expressions, add the optional argument “discont=true”, to change the colour, add the optional argument“colour=colour”, and to plot several expressions on the same graph replace the expression by a list of expressions. Toplot each of these in a different colour, replace colour in the colour argument by a list of colours. Finally, if printing,you want output in black and white. Set “colour=black”, and to differentiate between graphs on the same axes,use the optional argument “linestyle=list” where the list elements are “solid,” “dot,” “dash,” “dashdot,” “longdash,”“spacedash,” or “spacedot.” You will also want to include a legend. The syntax is “legend=list of strings.” The stringsrefer to the functions, in order. The list can have more general entries, called “typesets”. See Maple help under“plot,options” and “plot/typesetting”.As a rule, build plotting commands up. First plot with the required arguments only, then add optional arguments toproduce a better plot.If you want to label the axes properly, use the optional argument “labels=list of strings,” where the list is of two strings,the first refering to the horizontal axis, the second, the vertical. By default, all labels are printed horizontally. If youwant to change this, use the optional argument “labeldirections=list” where the list has two entries, both of which areeither “horizontal” or “vertical”.

To plot a parametric curve, the first argument is a list or three arguments consisting of the x and y coordinates, and thelast is of the form “variable=range”.

plot([t∧2,t∧3,t=-3..3],x=-4..4);

Finally, if you right-click on a plot, you will be able to change some of the settings. Unfortunately, if you change theplot in this way, the command producing the plot does not change. If you edit the command, the changes you addedby right-clicking will disappear.

Page 11: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

introduction to maple 11

Plot Examples

Page 12: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

12 introduction to maple

A Paramatric Plot

implicitplot(equation,variable=range,variable=range,options): plots the given equation implicitly. It is part of theplots package, so you must load that package first. The two ranges identify the horizontal and vertical axes, and therelevant variables. Maple plots these by evaluating both sides of the equation at a set of points. If the two sides areclose enough, a point is plotted, and the points are then joined. By default, Maple uses a 26×26 grid. To increase thenumber of points, use “grid=list,” where the list is a list of two positive integers.

Page 13: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

introduction to maple 13

Calculus

diff(expression,variable): differentiates the given expression with respect to the given variable. The result is an ex-pression. If the expression is followed by variables separated by commas, the expression is differentiated successivelywith respect to each variable, finding the relevant higher-order partial derivative. To find the nth derivative you canreplace the second argument by “variable$n.”

D(function): finds the derivative of the given function. The result is a function. Do not used D to differentiateexpressions since the result may, in fact, not be the derivative. Because the result is a function, it can be evaluatedeasily. “D(sin)(2)” differentiates the sine function, and evaluates the result at 2.

int(expression,variable or variable=range): integrates the given expression with respect to the variable. If the secondargument is just a variable, the indefinite integral is found. Maple ignores the arbitrary constant (of course, you shouldnot). If the second argument is “variable=range,” a definite integral is found.

dsolve(differential equation,indeterminate function of one variable,optional arguments), or dsolve({differentialequation,Initial conditions},indeterminate function of one variable,optional arguments) solves the given differentialequation. The differential equation can be replaced by a list of differential equations, in which case the system issolved. The indeterminate function must be of the form “y(x)”, that is, it must have an explicit argument, and theargument must occur wherever the indeterminte function occurs. The indeterminate function can be replaced by a listof indeterminate functions. If there are initial conditions, they are included with the differential equation as a set. If a

Page 14: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

14 introduction to maple

derivative is included in the initial conditions, use “D”. dsolve is finicky, so pay attention to the examples, and thosein Maple’s Help.

DEplot(differential equation,dependent variable,range of independent variable,range of dependent variable): willplot a direction field for autonomous differential equations (ones where the independent variable appears only as anargument of the dependent variables), and, given a list of initial conditions immediately following the range for theindependent variable, will plot solution curves corresponding to the given initial conditions. DEplot is in the “DEtools”package, so it must be loaded first. The differential equation can be replaced by a list of differential equations, inwhich case you have a system of differential equations. The dependent variable can be replaced by a list of dependentvariables. The initial conditions, if they occur, are lists (so you have a list of lists). The range of the independentvariable is supposed to be optional, but I have always found it to be required. DEplot is very finicky, so pay attentionto the examples here, and in Maple’s Help.

Page 15: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

introduction to maple 15

series(expression,variable=number,order of error) finds the Taylor series with center a, where the last term displayedhas degree less than the order of the error. If no number is specified for the second argument, it is assumed to be 0. Ifno order is specified, it is assumed to be 6. The result has an “O(xn)” term, where “n” is the order of the error. Mapletreats a series differently than it does a polynomial, so if you want the Taylor approximation, you need to convert theseries to polynomial using “convert(series,polynom)”.

Linear Algebra Commands

The two linear algebra data types are “Vector” and “Matrix.” There are three ways to type in vectors and matrices.1. You can type in a column Vector as “<entry 1,entry 2,. . .>,” and a row Vector as “<entry 1|entry 2|. . .>.” Most

of the time you want a column vector, even when exercises have the vector written as a row vector, so most ofthe time you separate the entries of the vector by commas. You can type in a Matrix as a “row vector of columnvectors,” that is, you type in each column as a column vector, and separate the columns by “|.”

2. You can select a vector or matrix of the proper size using the palettes on the left-hand side of the window. This

Page 16: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

16 introduction to maple

is one of the few cases where I find the palettes to be eficient.3. Use the Matrix or Vector command described below. In some cases you must use these commands because

Maple guesses incorrectly what you want. For example, Maple will identify “<1,3,3>” as a Vector in R3, butyou may want it identified as a 3× 1 matrix.

You refer to an entry of a Vector using square brackets. If you have called a Vector “vec,” “vec[2]” returns the secondentry of the vector. Similarly, you can identify an element of a Matrix using pairs of indices. If you have called a matrix“mtx,” “mtx[2,3]” returns the element in the second row, third column. You can replace either argument by a range.A sneaky trick to get the third column, regardless of the number of rows in the Matrix, is to use “mtx[1..-1,3].” Bewarned that Maple will return a Vector with this command, not a Matrix.

You can type in Matrices and Vectors without loading any packages. However, all the following commands are in theLinearAgebra package.

(Matrix or Vector).(Matrix or Vector). The “.” tells Maple to “multiply” the right-hand element by the left-handelement. Maple tries to guess what “multiply” means. For example, for <<1,2>|<3,1>|<-2,1>>.<4,1,-2>, thefirst element is a 2 × 3 matrix, and Maple assumes the second is a 3 × 1 Vector, with a 2 × 1 Vector as the result. Ifthe two elements are matrices, and they are of the right dimensions so that they can be multiplied, Maple will give youthe product of the two matrices. If the two elements are column vectors, Maple assumes you mean dot product, andthe result is a number. Be warned that if the first element is a row vector, and the second a column vector, the resultmay be 1 × 1 Matrix rather than a real number. If Maple misidentifies the intended product, use the explicit productcommand.

ChracteristicPolynomial(square matrix,variable) finds the characterisitic polynomial of the given matrix interms of the given variable.

CrossProduct(3-Vector,3-Vector) finds the cross product, in the order given, of the two vectors in R3 or Q3.

BackwardSubstitute(Matrix) does backsubstitution on the given augmented matrix in echelon form. If there is asecond (optional) argument consisting of a Matrix or a Vector, BackwardSubstitute augments the first matrix by thesecond Matrix or Vector, and then performs backsubstitution. The result is a Vector, and the “free variables” are givennames “ t1, t2,” etc.

convert can be used to convert a Vector to a Matrix, a matrix to a Vector, a row Vector to a column Vector, anda column Vector to a row Vector. If “vec” is a Vector and “mtx” is a Matrix, syntax for each case is: con-

vert(vec,Matrix), convert(mtx,Vector), convert(vec,Vector[row]), convert(vec,Vector[column]).Be warned that if a Matrix is not a row or column matrix, converting it to a Vector may not produce the desired effect.

DotProduct(Vector,Vector) finds the dot product of the two given Vectors. Both must be column vectors or rowvectors, and, of course, of the same dimension.

Eigenvectors(square matrix) finds the eigenvalues and eigenvectors of the given matrix. The result is a list consistingof a Vector and a Matrix. The entries of the Vector are the eigenvalues, each occuring with the correct multiplicity,and the columns of the Matrix are the corresponding eigenvectors. If an eigenvalue has greater multiplicity than thereare corresponding eigenvectors, you will see a column of zeroes in the Matrix of eigenvectors. Remember that, byconvention, the zero vector is never an eigenvector.

GaussianElimination(Matrix) performs Gaussian Elimination on the given Matrix. It does not make the leadingentries (the pivots) “1.”

MatrixInverse(square Matrix) finds the inverse matrix of the given Matrix. If there is no inverse, you will get anerror. The command will also return something if the matrix is not square, but this, obviously, won’t be the inverse ofthe matrix.

Matrix returns a Matrix. If the argument is a list of lists, each sublist having the same number of entries, the matrixwill have the sublists as rows. Unless your Matrices cannot be entered using the angle bracket method, it is simpler toenter Matrices using angle brackets.

Page 17: Introduction to Maple€¦ · You can delete an element, for example, the result of a Maple command, a line of of text, or a Maple command by using “Delete Element” from the “Edit”

introduction to maple 17

MatrixMatrixMultiply(Matrix),Matrix multiplies the two given matrices, in the order given.

ReducedRowEchelonForm(Matrix) reduces the given matrix to reduced echelon form. When solving matrixequations, it is usually computationally more efficient to use GaussianElimination.

Vector returns a Vector. If the argument is a list, the Vector entries will be the list entries. To specify a row vector, use“Vector[row](list).” Unless your Vector cannot be entered using the angle bracket method, it is simpler to enterVectors using angle brackets.

type(element,type) returns “true” if the element is of the specified type, and “false” otherwise. This can be usefulwhen Maple refuses to execute a command because an argument is of the wrong type. Useful types in linear algebraare “Matrix” and “Vector.”

Transpose(Matrix) finds the transpose of the given Matrix.

Maple’s Assitants and TutorsMaple has a small collection of assistants and tools intended to help in producing such things as plots, without learn-ing the commands. They look great at first sight, but after discovering their limitations, you will want to learn thecommands.

Plot Tool

The plot tool allows you to plot one or several functions, or a parametric curve without having to use the plot commandexplicitly. While it does make the production of plots easier, it has the major disadvantage of forgetting all theinformation after you have finished your plot. If you find that you have plotted the wrong function, for example, youwill have to restart plotting from scratch, and, if you find your function has asymptotes, you will not be able to add a“discont=true” option without redoing the plot from the start.To use the plot tool, choose “Plot builder” from the “Assitants” submenu of the "Tools" menu. Click “Add”, and typein the function, in Maple syntax, in the dialogue box. Click “Accept”. If you want to plot more functions, repeatthe last few steps. When you have added all the expressions to plot, click “Done”. A new dialogue box will appear,choose the plot you want, select the range of x and y values you want plotted. If you need to specify some options,click “Options”, otherwise, click “Plot”. Once the graph is plotted, you can change options by clicking on the relevantfeature. A dialogue box will appear, describing which options can be changed.If you wish to plot a parametric curve, “add” an expression similar to “[t∧3,t∧2,t=-3..3]”.

Integration Methods and Differentiation Methods Tutors

The integration method tutor, and the differentiation method tutor are supposed to help you learn integration anddifferentiation by having you specify what technique to use, and having Maple perform the technique. Unfortunately,Maple does not simplify the results, and does not check any identities you give it. For example, Maple will be quite

happy using the “identity” sin2 x− cos2 x = 1 to find∫

sin3 x dx.

c©Michael Nyenhuis, 2007