0% found this document useful (0 votes)
2K views

Introduction To Maple 6: Worksheet Toolbar

Maple is a mathematical software program used for symbolic algebra, calculus, graphics, and numerical computation. It allows users to perform computations, manipulate mathematical expressions, and describe problem-solving processes in interactive worksheets. The Maple interface includes toolbars, menus, and palettes to easily enter expressions and commands. Worksheets document mathematical problems and are reusable to replace calculators or programming.

Uploaded by

Erika Macalalad
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Introduction To Maple 6: Worksheet Toolbar

Maple is a mathematical software program used for symbolic algebra, calculus, graphics, and numerical computation. It allows users to perform computations, manipulate mathematical expressions, and describe problem-solving processes in interactive worksheets. The Maple interface includes toolbars, menus, and palettes to easily enter expressions and commands. Worksheets document mathematical problems and are reusable to replace calculators or programming.

Uploaded by

Erika Macalalad
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Introduction to Maple 6

Maple is an extensive mathematical-problem-solving environment used to support


an expansive range of mathematical operation such as numerical analysis, symbolic
algebra and graphics. It is comprehensive computer software for advanced mathematics.
It includes facilities for interactive algebra, calculus, discrete mathematics, graphics,
numerical computation and many other areas of mathematics. It also provides a unique
environment for rapid development of mathematical programs using its vast library of
built-in functions and operations.

Worksheet Toolbar
The toolbar is the area of the Maple window that contains buttons for performing
common tasks. You can toggle between having the toolbar visible and having it hidden.
From the View menu choose Toolbar. A check mark next to Toolbar in the
menu indicates that the toolbar is displayed.

The following is a list of the buttons on the worksheet toolbar.

Create a new worksheet. Remove the section enclosing


the selection.
Open an existing worksheet.
Enclose the selection in a
Open a specified URL. section or subsection.
Save the active worksheet. Go backward in the hyperlink
Print the active worksheet. history.

Cut the selection to the Go forward in the hyperlink


clipboard. history.

Copy the selection to the Cancel the computation in


clipboard. progress.

Paste the clipboard contents Set the zoom magnification to


into the current worksheet. 100%.

Undo the last operation. Set the zoom magnification to


150%.
Redo undone operation.
Set the zoom magnification to
Insert nonexecutable Standard 200%.
Math in a text region.
Toggle the display of
Insert text at the cursor. nonprinting characters.
Insert a new execution group Resize the active window to fill
after the cursor. the available space.

MCSU Mathematics 73 (Introduction to Maple) 1


Overview of Basic Features

Maple worksheets are files that document how to solve mathematical problems from the
fields of mathematics, science, and engineering. Worksheets are both interactive and reusable.
They can be used to replace calculators, spreadsheet application programs, and programs in
languages such as FORTRAN. Specifically, in worksheets you can:

• perform computations
• manipulate mathematical expressions
• describe the problem-solving process
When you use Maple to perform computations or manipulate expressions, Maple displays
the corresponding results, which you can use for subsequent processing. The request you send
Maple is called Maple input, it is displayed in red Courier typeface by default. You can change
the default by modifying the Maple Input text style. The result is called Maple output, it is
displayed centered in blue Times typeface by default. You can change the default by modifying
the Maple Output text style. Together, Maple input and output comprises an execution group,
which is the fundamental element of the worksheet.
Overview of Insert Menu
The Insert menu contains commands to insert text and Maple objects into an active
Maple worksheet.

 Text
Insert text into your Maple worksheet. Text can include comments which help explain
your steps more effectively.
1. From the Insert menu, choose Text.
2. Type the text you want in the worksheet.
 Standard Math
Standard Math notation is displayed in a format similar in appearance to that found
in a textbook. It is not necessarily executable.
1. From the Insert menu, choose Standard Math. A question mark appears at
the insertion point and the edit field is displayed.
2. Type the expression, using the edit field for editing, if necessary.
3. Press the Enter key. The output will be displayed in nonexecutable Standard Math
notation.
 Maple Input
Maple input is executable Maple notation, usually a mathematical expression, that
Maple can evaluate.
1. From the Insert menu, choose Maple Input. The command prompt appears.
2. Type in the expression, followed by a semicolon to display the output, or by a colon to
suppress the output.

MCSU Mathematics 73 (Introduction to Maple) 2


 Standard Math Input
Standard Math notation is displayed in a format similar in appearance to that found
in a textbook. Standard Math Input is executable.
1. From the Insert menu, choose Standard Math Input. A question mark appears at the
insertion point and the edit field is displayed.
2. Type the expression, followed by a semicolon to display the output, or by a colon to
suppress the output. Use the edit field for editing, if necessary.
 Execution Group
An execution group is a grouping of Maple input with its corresponding Maple output.
It is characterized by a large square bracket, called a group range, at the left. When you insert
an execution group, Maple also inserts a command prompt . Maple commands entered at
this prompt are recognized as Maple input and can be executed.
From the Insert menu, choose Execution Group, and then either Before Cursor or
After Cursor.
You can also set an option to have Maple always automatically insert a new
execution group below any group that gets executed.

 Plot
Create a blank plot object after the cursor.

Two-dimensional Plot Object


Create a blank smart plot object.
From the Insert menu, choose Plot, and then 2-D.
Place a curve in the plot object by moving or copying an expression from elsewhere in
the worksheet.

Three-dimensional Plot Object


Create a blank smart plot object.
From the Insert menu, choose Plot, and then 3-D.
Place a surface in the plot object by moving or copying an expression from
elsewhere in the worksheet.

 Standard Math Input


Add comments to your worksheets to provide information to readers about the steps
you took to solve a problem.
1. From the Insert menu, choose Paragraph, and then Before or After. A new
paragraph is inserted and the cursor is moved to the new blank line.
2. Type the paragraph.

MCSU Mathematics 73 (Introduction to Maple) 3


Overview of Palettes
A palette is a collection of buttons representing predefined symbols, expressions,
operators, or Matrices. By clicking on the buttons on the palettes, you can build or edit
mathematical expressions without having to remember the Maple command syntax.
You can toggle between having the palettes visible and having them hidden.
Use the Expression Palette - to build expressions containing constructions such as integrals,
derivatives, sums, and products.
The expression palette contains buttons for constructing expressions such as integrals,
derivatives, sums, and products.
1. Display the expression palette.
2. Click where you want to insert the expression.
3. On the expression palette, click the template for the expression you want to enter. For
example, for division, click .
4. Fill in the first placeholder by entering a number, a symbol, or an expression.
5. Press the Tab key to move the cursor to the next placeholder.
6. Continue filling all placeholders that apply to your expression.
7. If you are using Standard Math notation, press the Enter key to accept your value for the
last placeholder.
8. When all of the relevant placeholders have been filled, press the Enter key.

Use the Symbol Palette - to add symbols and Greek letters to expressions.
The symbol palette contains buttons for inserting mathematical symbols into your
expressions.
1. Display the symbol palette. (See Show Palettes.)
2. Click where you want to insert the symbol.
3. On the symbol palette, click the symbol you want to enter. For example, to enter an alpha,
click on .
Title Your Worksheet
1. Place your cursor at the top of the worksheet.
2. From the Insert menu, choose Paragraph, and then Before.
3. Type the title.

4. In the list of styles on the far left of the context bar, click Title.
To change the way the text appears, see Overview: Maple Text Styles.

MCSU Mathematics 73 (Introduction to Maple) 4


The Worksheet Interface

MCSU Mathematics 73 (Introduction to Maple) 5


Maple as a Mathematical Problem-solving Tool

Use Maple to solve a wide range of mathematical problems. Enter, compute, and
manipulate mathematical expressions by using the powerful Maple mathematical engine. During
the problem-solving process, Maple can take the result of one calculation and use it as input for a
second calculation. In this way, Maple can solve complicated mathematical problems.

Active and Inert Functions


Certain Maple commands have both active and inert forms. In these cases, the command
beginning with a lower-case letter is the active form and causes Maple to compute a result
immediately. The inert commands start with a capital letter and are useful to show steps in the
problem-solving process.
These are some of the Maple commands that have both active and inert forms.

• diff (Diff)
• int (Int)
• limit (Limit)
• normal (Normal)
• product (Product)
• sum (Sum)

Maple displays inert forms in two colors in the worksheet. It maintains the default color
for variables and elements of the expression you can change, and it displays items you cannot
change in black.

> int(x^2,x);
1 3
x
3

> Int(x^2,x);

⌠ 2

x d x

MCSU Mathematics 73 (Introduction to Maple) 6


Enter Expressions in Maple

A new worksheet opens with a Maple prompt in the upper left-hand corner. Enter Maple
commands at this prompt so that Maple recognizes your entry as Maple input and executes the
command. (See Overview of Palettes for information on using palettes to enter expressions
without having to remember all the syntax of Maple commands.)
The following assumes the Input Display is set to Maple Notation. See Set Input Display for
more information.
1. Type the Maple input, followed by either a semicolon or a colon. The semicolon indicates
that the input executes and the corresponding Maple output is displayed, as seen below.
> factor(x^2 + 2*x + 1);
( x + 1 )2

The colon indicates that the input executes, but the corresponding output is suppressed, as
seen below.
> assume(z > 0):
2. Press the Enter key. Maple evaluates the input and displays the output, provided that the
input ends with a semicolon.

Assigning Names to Expressions


Assign a name to a Maple expression so that you can use the expression again in subsequent
calculations.
> expn := 3 * sin(x) + 2 * cos(x);
expn := 3 sin ( x ) + 2 cos( x )

> sin(x) * expn;


sin ( x ) ( 3 sin ( x ) + 2 cos( x ) )

You can even give names to equations.


> eqn := y = 5*x - 3;
eqn := y = 5 x − 3

Define your own functions.


> f := x -> x * 2;
f := x → 2 x

> f(3);
6

> f(y + 1);


2y+2

MCSU Mathematics 73 (Introduction to Maple) 7


Examples of Maple Functions
Maple functions include most standard mathematical functions such as sin, sinh, arcsin,
exp, ln, sqrt, binomial, and so on.

Examples of Maple Functions


The following are examples of some basic Maple functions

> cos(alpha)^2+sin(alpha)^2;

cos( α ) 2 + sin( α ) 2

> a*x^2+b*x=c;

a x2 + b x = c

> a*Int(exp(sqrt(2)*x),x);

⌠ ( 2 x)
a e dx

> Limit(f(x),x=infinity);
lim f( x )
x→ ∞

> Sum(a[k]*x^k, k=0..m)=Product(b[j]*x^j, j=0..n);


m n
∑ ak xk = ∏ bj xj
k=0 j=0

Examples of Advanced Maple Functions


More advanced Maple functions include the differential operator, the sequence function,
the composite function, and so on.

Derivatives and the Differential Operator


Express derivatives using the function diff.
> diff(a*x^2+b*x +c, x,x);
2a

Composition Function
The Composition function, @ @, takes two arguments. The first argument must be a
function, such as sin or cos, or a variable name that can be treated as a function. The second
argument specifies the number of times the function should be composed. Because the @ symbol

MCSU Mathematics 73 (Introduction to Maple) 8


is special to Maple, you must enclose the name @ inside single open quotes (`) when using it as
a function.
`@@`(cos, 3)(x) means cos(cos(cos(x))) and `@@`(D,2)(y)(x) means D(D(y))(x)

RootOf
Maple uses the function RootOf to represent the roots of a polynomial in one variable. It is a
compact representation because all roots can be expressed at once. In addition, it enables Maple
to manipulate the roots of a polynomial even when it is unable to find explicit representations for
them. The polynomial is always expressed in terms of the variable _Z.
Solve for the Roots explicitly.
1. Select the expression.
2. From the Context menu, choose All Values You could also use the allvalues function.

Examples:
> RootOf(x^2+1=0);
RootOf( _Z 2 + 1 )

> RootOf(x^2-a*x=b, x);


RootOf( _Z 2 − a _Z − b )

> RootOf(a*b^2+a/b, b);


RootOf( _Z 3 + 1 )

> RootOf(a*x+b, x);


b

a

> RootOf(x^3-1, x) mod 7;


RootOf( _Z 3 + 6 )

> RootOf(x^2-2*x+1, x) mod 5;


1

> alias(alpha = RootOf(x^2+x+1)):


Normal(1/alpha) mod 2;
α+1

> RootOf(x^2=2, x, -1.41);


RootOf( _Z 2 − 2, -1.41 )

> evalf(%);
-1.414213562

MCSU Mathematics 73 (Introduction to Maple) 9


> RootOf( x^3-2, x, -0.7-1.1*I .. -0.6-1.0*I );
RootOf( _Z 3 − 2, -.7 − 1.1 I .. -.6 − 1.0 I )

> evalf(%);
-.6299605249 − 1.091123636 I

> r1 := RootOf(_Z^4+_Z^2+1, index=1);


r1 := RootOf( _Z 4 + _Z 2 + 1, index = 1 )

> evalf(r1);
.5000000000 + .8660254038 I

> allvalues(r1);
1 1
+ I 3
2 2

> r2 := RootOf(_Z^4+_Z^2+1, label=1);


r2 := RootOf( _Z 4 + _Z 2 + 1, label = 1 )

> evalf(r2);
RootOf( _Z 4 + _Z 2 + 1, label = 1 )

> allvalues(r2);
1 1 1 1 1 1 1 1
− + I 3, − − I 3, + I 3, − I 3
2 2 2 2 2 2 2 2

Getting Started

Executing Commands
To execute commands in the New User's Tour (and any other) worksheets:
1. Place the cursor on the first command line (for example, 1+1; below) by using your
mouse or the Tab key.
2. Press Enter.

Try this now:


> 1+1;

MCSU Mathematics 73 (Introduction to Maple) 10


By pressing Enter, you also move the cursor to the next command line (in this case, limit(
x-7, x=3 );) in the worksheet.
> limit( x-7, x=3 );

Please note:
• If you happen to place the cursor elsewhere in a worksheet, place it back on the appropriate
command line before pressing Enter to continue.
• It is important to execute the commands in order because some computations require results
from previous command lines.

Maple worksheets can serve as an interactive problem-solving environment, or as a


system for generating technical documentation. This topic explains the various elements and
features of Maple worksheets.

Interacting with Maple's Computational Engine


Execution groups and spreadsheets help you to interact with the Maple computational
engine. They provide the primary means by which Maple is asked to carry out specific tasks and
display the results. Maple commands can be entered into either of these.

Execution Groups

Execution groups are the fundamental computation elements in the worksheet. Their primary
purpose is to combine one or more Maple commands and their results into a single re-executable
unit. You can easily recognize an execution group by a square bracket immediately to the left of
the command prompt.

> solve( a*x^2 = 4, {x} );


The function above solves the equation as indicated on its first parameter (e.g. ax 2 = 4 ).
The output would be:
1 1
{x = 2 }, { x = −2 }
a a

When you place the cursor on any command line in an execution group and press Enter,
all commands in that group are executed in sequence and the results (or output) are displayed at
the end of the execution group. The cursor is automatically advanced to the first command line in
the next execution group.

In addition to Maple commands and their results, an execution group can contain descriptive
paragraphs.

MCSU Mathematics 73 (Introduction to Maple) 11


Examples:
The following execution group contains a paragraph and a Maple command line with one
command. After you place the cursor on the command line and press Enter, it will also contain
the command result.

A Maple command and the computed result.


> expand((a + b)^3);
The function above is used to expand a given expression to its
nth power. The output would be:
a 3 + 3 a 2 b + 3 a b2 + b3
New Maple worksheets begin with a single execution group containing a command
prompt (as shown below). To create a new execution group within a worksheet, from the Insert
menu, choose Execution Group, then Before Cursor or After Cursor.
The results produced by a Maple command may be numeric, symbolic, or graphical. The
following command generates a plot of a three-dimensional surface:
> plot3d( sin(x*y) , x = -2..2, y = -1..1 );

DIAGRAM

Constructing and Executing Maple Commands


This section presents three primary means of creating Maple commands and results.

Typing Commands
You can execute commands by typing them at a Maple prompt, and pressing Enter. You
can display commands as Maple notation or as standard math notation.

Using Context-sensitive Menus


Existing Maple results can be used to suggest and construct new actions. To obtain an on-
screen list of suggested actions, right-click on a Maple object. (Option-click if you have only one
mouse button.) The resulting list of actions is called a context-sensitive menu, because the items
it contains vary depending on the properties of the selected object.

Try this out now. Copy the equation: Select it, and from the Edit menu, choose Copy.
Create a new worksheet: From the File menu, choose New. (Switch between the worksheet and
this one by using the Window menu.) Paste the equation at the command prompt: From the Edit
menu, choose Paste. Type a semicolon at the end of the command line, and press Enter. Right-
click (or option-click) on the result to see the context-sensitive menu. (Left-click elsewhere to
close the menu without choosing an item.)

MCSU Mathematics 73 (Introduction to Maple) 12


z = sin( x2 y )

You can also use the context-sensitive menus to plot expressions. Go back to your new
worksheet, and right-click on the result again. From the context-sensitive menu, choose Plots,
then Implicit 3-D Plot, then x,y,z as the desired permutation for the axes. You should arrive at
the three-dimensional smart plot displayed below.
> smartplot3d[x,y,z](z = sin(x^2*y));

DIAGRAM

Dragging and Dropping


You can move Maple output to or from smart plots by using the mouse. When you drag
the result of an evaluation to a smart plot, it will become a curve or surface. When you drag a
curve or surface away from a set of axes, the corresponding expression will be placed in the
worksheet.

Formulae may also be dragged from the worksheet into a cell of a spreadsheet, or from a
cell of a spreadsheet to a worksheet.

Annotating and Structuring Documents


Paragraphs, sections, and hyperlinks exist to help you document and organize your results. This
section describes how to use these features to make your worksheet document more interactive
and usable.

Paragraphs and Text


A paragraph in a worksheet is analogous to a paragraph in a word processor. Paragraphs
can contain styled text, inline mathematics, and graphics, including copies of Maple-generated
output, such as plots. A paragraph can also be contained in an execution group.

Paragraphs are used for explanatory notes such as this. They are presented in black Times
or Times New Roman font by default. The following sentences illustrate the types of formatting
that you can easily apply to Maple paragraphs:

1. Paragaphs can be centered.


2. They can be left-justified.
3. They can be right-justified.
4. Text can be italicized and underlined, and it can be made bold.
5. The size and font of the text can easily be changed.

(Please note that you cannot change text in this worksheet, because it's set to "read only.")
As in word processors and desktop publishers, you can create your own paragraph and
character styles for text. To do so, from the Format menu, choose Styles.

MCSU Mathematics 73 (Introduction to Maple) 13


Maple supports inline mathematics so that you can develop sophisticated documents
featuring typeset equations and graphics within text areas. For example, it is possible to create
the following:
β

To compute the symbolic definite integral ⌠



 x2 sin( α x ) dx in Maple, type:
⌡0
> int( x^2*sin(alpha*x), x=0..beta );

Numerical Calculations
Computations with Integers
At its most basic level, you can use Maple as a very powerful calculator.
13
To calculate (32)( 12 ), you would enter the following:
> 32*12^13;
3423782572130304
Maple recognizes many special operators, including factorial, greatest common divisor, least
common multiple, and computation over the integers modulo m. The following line is an
example of the factorial operator in use.
> 200!;
7886578673647905035523632139321850622951359776871732632947425332443594\
499634033429203042840119846239041772121389196388302576427902426371\
050619266249528299311134628572707633172373969889439224456214516642\
402540332918641312274282948532775242424075739032403212574055795686\
602260319041703240623517008587961789222227896237038973747200000000\
00000000000000000000000000000000000000000
You can easily include the previous expansion of 200! in any subsequent calculation
without having to type it. The ditto operator, represented by a percent sign (%), refers to the last
expression computed by Maple. (For more information on the ditto operator, see the help page
for ditto.) The command ifactor factors the previous result into its prime factors.
> ifactor(%);
( 2 ) 197 ( 3 ) 97 ( 5 ) 49 ( 7 ) 32 ( 11 ) 19 ( 13 )16 ( 17 ) 11 ( 19 ) 10 ( 23 )8 ( 29 ) 6 ( 31 )6 ( 37 ) 5
( 41 ) 4 ( 43 ) 4 ( 47 ) 4 ( 53 ) 3 ( 59 ) 3 ( 61 ) 3 ( 67 ) 2 ( 71 ) 2 ( 73 ) 2 ( 79 ) 2 ( 83 ) 2 ( 89 ) 2
( 97 ) 2 ( 101 ) ( 103 ) ( 107 ) ( 109 ) ( 113 ) ( 127 ) ( 131 ) ( 137 ) ( 139 ) ( 149 ) ( 151 )
( 157 ) ( 163 ) ( 167 ) ( 173 ) ( 179 ) ( 181 ) ( 191 ) ( 193 ) ( 197 ) ( 199 )
The next command calculates the product again, which is precisely the value of 200!.
> expand(%);
Floating-point Arithmetic
A principal strength of Maple is its ability to do exact arithmetic. Fractions and radicals
during computation are not converted to their decimal equivalent, thereby avoiding round-off

MCSU Mathematics 73 (Introduction to Maple) 14


errors. When you do need to use decimal equivalents, Maple has a command that approximates
the value of the expression in a floating-point form.

2 30 3
Consider the expression , which is entered on the Maple command line as follows:
3 20

> (2^30/3^20)*sqrt(3);
1073741824
3
3486784401
Use the evalf command to generate an approximation in the form of a floating-point value.
> evalf(%);
.5333783739

Finite and Infinite Sums and Products


You can calculate both finite and infinite sums.
1+i
10
Consider the finite sum ∑ . You calculate its value as follows:
i=1 1 + i
4

> sum( (1+i)/(1+i^4), i=1..10 );


51508056727594732913722
40626648938819200088497

1
Consider the infinite sum ∑ k2
. To calculate its value, enter:
k=1

> sum( 1/k^2, k=1..infinity );


1 2
π
6

Maple also calculates both finite and infinite products.


i + 3 i − 11
10 2
To evaluate the finite product ∏ , you would enter the following Maple
i=0
i+3
command:

> product( ((i^2+3*i-11)/(i+3)), i=0..10 );


-7781706512657
40435200
You can do arithmetic with floating-point numbers to any desired precision. In fact,
Maple handles numbers up to hundreds of thousands of digits of precision on most operating
systems. The following command calculates a 50-digit floating-point approximation of the
fraction in the previous calculation.

MCSU Mathematics 73 (Introduction to Maple) 15


> evalf( % , 50 );
-192448.81965854008388730610952833175055397277619500

Complex Numbers and Special Functions


Maple also performs calculations using complex numbers. Type the complex unit as a
capital I.
> (3+5*I)/(7+4*I);
41 23
+ I
65 65
To easily convert a complex number to its polar-coordinate form, use the convert
function. Maple represents the expression in the form polar( r, θ ), where r is the modulus and θ
is the argument of the complex value of the expression.
> convert( % , polar );
polar 2210 , arctan  
1 23
 65  41  
You can compute numeric values for the elementary functions and many special
functions and constants. For example, compute e , the base of the natural logarithm, to 40 digits.
> evalf( exp(1.0), 40 );
2.718281828459045235360287471352662497757
Consider an example of the Gamma function Γ( 2.5 ) :
> evalf( GAMMA(2.5) );
1.329340388
Finally, suppose that you want to evaluate π to 500 digits:
> evalf( Pi, 500 );
3.14159265358979323846264338327950288419716939937510582097494459230781\
640628620899862803482534211706798214808651328230664709384460955058\
223172535940812848111745028410270193852110555964462294895493038196\
442881097566593344612847564823378678316527120190914564856692346034\
861045432664821339360726024914127372458700660631558817488152092096\
282925409171536436789259036001133053054882046652138414695194151160\
943305727036575959195309218611738193261179310511854807446237996274\
95673518857527248912279381830119491

Algebraic Computations
Working with Expressions
Maple provides different ways of manipulating and displaying expressions to make them
easier to verify, or more effective to use. This flexibility allows you to do such things as expand
binomials, factor results, simplify trigonometric expressions, assign variable names to results,
and convert expressions to different forms.

MCSU Mathematics 73 (Introduction to Maple) 16


Expanding and Factoring Expressions
Maple can expand binomials such as ( x + y ) . The following Maple commands create the
15

expression, and then expand it.


> expr := (x+y)^15;
> expand(expr);
x15 + 15 y x14 + 105 y2 x13 + 455 y3 x12 + 1365 y4 x11 + 3003 y5 x10 + 5005 y6 x9 + 6435 y7 x8
+ 6435 y8 x7 + 5005 y9 x6 + 3003 y10 x5 + 1365 y11 x4 + 455 y12 x3 + 105 y13 x2
+ 15 y14 x + y15
After viewing the results, you can use the factor command to factor the last result and
check the computation.
> factor(%);
( x + y ) 15

Simplifying Expressions
Maple can apply identities to simplify many lengthy mathematical expressions, such as
trigonometric expressions.
Consider cos( x ) + sin( x ) + 2 cos( x ) − 2 sin( x ) − cos( 2 x ) .
5 4 2 2

> simplify( cos(x)^5 + sin(x)^4 + 2*cos(x)^2 - 2*sin(x)^2 -


cos(2*x) );
cos( x ) 5 + cos( x ) 4
Another way to simplify expressions is to use the normal command, which puts
fractions on a common denominator and removes common factors in the numerator and
denominator.
x3 − y 3
The fraction 2 is much simpler after Maple removes the common factors.
x + x − y − y2

> normal( (x^3-y^3)/(x^2+x-y-y^2) );


x2 + y x + y2
x+1+y

Assigning Variable Names


You can assign a variable name to the results of a computation. The use of variables is
essential for managing large numbers of expressions and functions, especially if you want to
reuse the output later in a session.
2
For example, create the expression ( 41 x + x + 1 ) ( 2 x − 1 ) , and store it as expr1 .
2

> expr1 := (41*x^2+x+1)^2*(2*x-1);


2
expr1 := ( 41 x2 + x + 1 ) ( 2 x − 1 )
Use the expand command on expr1 and store the result as a variable, expr2 .
> expr2 := expand(expr1);

MCSU Mathematics 73 (Introduction to Maple) 17


expr2 := 3362 x5 − 1517 x4 + 84 x3 − 79 x2 − 1
Evaluate expr2 at x=1.
> eval(expr2 , x=1 );
1849
In the next example, answer is assigned the normalized quotient of the expansion of two
expressions, top and bottom .
> top := expr2;
top := 3362 x5 − 1517 x4 + 84 x3 − 79 x2 − 1
> bottom := expand((3*x+5)*(2*x-1));
bottom := 6 x2 + 7 x − 5
> answer := normal( top/bottom );
1681 x4 + 82 x3 + 83 x2 + 2 x + 1
answer :=
3x+5

Converting Expressions to Different Forms


The convert command allows you to convert many types of expressions into specific
forms. For a complete list of conversions available in Maple, see the Help page for the convert
command.
a x2 + b
The following example converts a symbolic expression, , into its
x ( −3 x2 − x + 4 )
partial fraction decomposition.

> my_expr := (a*x^2+b)/(x*(-3*x^2-x+4));


a x2 + b
my_expr :=
x ( −3 x2 − x + 4 )

> convert( my_expr, parfrac, x );


1 b 1 16 a + 9 b 1 a + b
− −
4 x 28 3 x + 4 7 x−1
The following example converts a trigonometric expression, cot( x ) , into an exponential
expression.
> convert( cot(x), exp );
2
(I x)
I ((e ) + 1)
2
(I x)
(e ) −1

MCSU Mathematics 73 (Introduction to Maple) 18


Function Notation
Maple provides several ways to define functions. One way is to use arrow notation
(which closely resembles standard mathematical notation for a mapping). You can also use the
unapply command, which turns an expression into a function.
1
Define the function x → x2 + .
2

> f := x -> x^2+1/2 ;

Evaluate the function at numeric and symbolic values.


> f(2);
9
2
> f(a+b);
1
( a + b )2 +
2
Use the unapply command to turn an expression into a function.
> g := unapply(x^2 + 1/2, x);

Solving Equations and Systems of Equations


You can use Maple to solve and verify solutions to equations and systems of equations.

Solving an Equation
a x2 13 x2 13 a x 10 x 5 a
Use Maple to solve the following equation: x −
3
+ = + − .
2 3 6 3 3

> eqn := x^3-1/2*a*x^2+13/3*x^2 = 13/6*a*x+10/3*x-5/3*a;


1 13 13 10 5
eqn := x3 − a x2 + x2 = a x + x − a
2 3 6 3 3
> solve( eqn, {x} );
2 1
{ x = }, { x = -5 }, { x = a }
3 2
To verify one of the solutions, evaluate the equation at that particular value of x.
> eval( eqn , x=1/2*a );
13 2 13 2
a = a
12 12

Solving a System of Equations


You can also solve systems of equations in Maple.
Consider the following set of four equations and five unknowns:
> eqn1 := a+2*b+3*c+4*d+5*e=41;

MCSU Mathematics 73 (Introduction to Maple) 19


> eqn2 := 5*a+5*b+4*c+3*d+2*e=20;
> eqn3 := 3*b+4*c-8*d+2*e=125;
> eqn4 := a+b+c+d+e=9;

Now solve the system for the variables a , b , c , and d. Maple will return its solutions in terms
of the fifth variable, e. Since there are four equations and five unknowns, we will have a
parametric set of solutions. On the other hand, if we solved for a, b, c, d and e, Maple would
choose one of the variables (at random) as a free parameter.
> solve( {eqn1, eqn2, eqn3, eqn4}, {a, b, c, d} );
313 22 483 31 79 4
{b = − + e, c = − e, d = − − e, a = 2 }
13 13 13 13 13 13
To verify that this solution satisfies eqn1 and eqn2, evaluate both of them at this solution.
> eval( {eqn1, eqn2} , % );
{ 20 = 20, 41 = 41 }

Further Examples of Solving Equations


The following examples show other types of equations that you can solve using Maple, such as
equations using trigonometric functions and absolute values.

Solve an equation involving trigonometric functions.


> solve( arccos(x) - arctan(x)= 0, {x} );
 1 −2 + 2 5 
 x = 2 
  − 1 + 1 5  − 1 + 1 5 
2
 
  2 2  2 2 

2
As a final example, solve an equation containing absolute values: ( z + z + 2 ) − 1 = 9 .
2

> solve( abs( (z+abs(z+2))^2-1 )^2 = 9, {z});


{ z = 0 }, { z ≤ -2 }
> abs( (z+abs(z+2))^2-1 )^2 = 9;
2
( z + z + 2 )2 − 1 = 9

Solving Inequalities
The following examples show how easy it is to solve systems of inequalities in Maple.
1
Use Maple to solve systems of inequalities, such as x2 < 1, y2 ≤ 1, x + y < .
2

> solve( {x^2<1, y^2<=1, x+y<1/2}, {x,y} );


1
{ -1 < x, x < 1, y ≤ 1, -1 ≤ y, x + y < }
2
4
Another example involves solving the inequality x + y + < 10 , for x in terms of y.
x+y

MCSU Mathematics 73 (Introduction to Maple) 20


> ineq := x+y+4/(x+y) < 10;
> solve( ineq, {x} );
{ x < −y }, { 5 − 21 − y < x, x < 5 + 21 − y }
Not only does Maple solve inequalities, but it can also consider a complex inequality
such as 2 −1 − I −1 + I ≠ 0 , and compute its Boolean value, by using the is command.
> expr := 2*sqrt(-1-I)*sqrt(-1+I):
> is( expr <> 0 );
true

MCSU Mathematics 73 (Introduction to Maple) 21

You might also like