Part 2: Putting Your Ideas Together
Go to Maple Portal Previous Tutorial Next Tutorial

Introduction


Maple's Tutorials are designed to help you get started with Maple, learn about the key tools available in Maple, and lead you through a series of problems.
In Part 2: Putting Your Ideas Together, you will learn one of the essential tools for creating polished documents–how to use typeset mathematics in your text. You will use Maple to solve equations symbolically and numerically. You will learn how Maple distinguishes an equation from an assignment and an expression from a function.
To try this material on your own, start with an empty Maple document. Perform the steps described in the left column of each table below. The results of the steps are displayed in the right column for reference.
Refer to Help>Quick Reference for basic getting started tips.
Note for nonWindows users: The keystrokes given in this document are for Windows. There will be differences for other platforms. If you are using a different platform, see Help>Quick Help for the list of the most common keystrokes.


Combining Text and Math


In Maple you can combine math and text in the same paragraph to create a technical document.
Steps

Result

Getting an answer to display inline using [Ctrl][=]
In the examples so far, we obtained a result by pressing [Enter].
You can also get Maple to return the result inline by typing [Ctrl][=] (hold down the Ctrl key, then press the = key).
Example: Type "1+2" then [Ctrl][=].

=

Combining text and math
Example:
1. Start by entering a simple computation. From the Calculus palette, choose the integral
. Replace with the desired integrand. Press [Tab] to go to the next placeholder. Replace with .


2. Evaluate the integral using [Ctrl][=].

=

3. Place the cursor to the left of your expression and change to text mode using
or by pressing [F5]. Now, type "The integral"

The integral =

4. You can replace the equal sign (=) with text. Highlight the equal sign to select it, and then replace it with some additional text.

The integral is equal to

5. Place your cursor at the end of the output, press [F5], and complete the rest of the sentence.

The integral is equal to , as you can plainly see.

Recalculating
Modify some of the terms in the problem, highlight the entire sentence, and press the
button to reexecute the computation.

The integral is equal to , as you can plainly see.



Tip: In math mode, the cursor is slanted and has a dotted box around it. In text mode, the cursor appears as a vertical bar.
You can also check what mode you are in by looking at the top left of the toolbar.
•

In text mode the display is
.

•

In math mode the display is
.

Click Text or Math to enter that mode.
Tip: You can also toggle between math mode and text mode by pressing [F5].
Note: Anything you want Maple to evaluate (such as assignment statements) must be entered in Math mode. Anything entered in Text mode will be nonexecutable.
Exercise: The computation from the exercise at the end of Part 1: Talking to Maple has been carried out below. Add in explanatory text around the polynomial example. Change the original polynomial and update the results.


Solving Equations


Maple can solve equations and inequalities for their unknowns.
Steps

Result

Defining Equations
To represent an equation in Maple, use the = sign for equality.
Example: Solve the equation for using the context menu Solve>Solve for Variable>x.


Solving for Exact Solutions
By default, Maple uses symbolic methods to find the exact solution.
Example: Solve the equation for using Solve>Solve from the context menu.


Solving for Numeric Solutions
If you desire a numeric solution, you must specify it directly.
Example: Using the example above, solve the equation using the context menu, this time select Solve>Numerically Solve.


Solving with Maple Commands
Note that the equivalent Maple commands are solve and fsolve (floatingpoint solve).
To solve a system of equations, enclose them in a list or set.
Tip: Use this notation to include inequalities such as or .

 (3.1) 
 (3.2) 
 (3.3) 

Assigning Equations to Variables
You can assign equations to names. Remember to use := (colon equals) for assignments.
Example: Assign the equation "" to the variable name "eqn". Then apply the command rhs to your variable name.
You can use the solve command to solve the equation for .

 (3.4) 
 (3.5) 



Tip: If you have a formula containing multiple variables, you will find it useful to define it as an equation rather than a simple expression. That way you will be able to use Maple's solve command (which works on equations) to isolate variables.


Expressions, Functions, and Procedures


Learn to define Maple expressions and functions. To implement more complicated functions, define a procedure.
Steps

Result

Expressions
is an expression in defined to the right. Warning: is not a function!
Example: See the example on the right for what happens when you try to evaluate as if it were a function.
In fact, you have not defined a function. You have assigned the expression to the name .
Example: To find the value of an expression at a given value of , you need to evaluate the expression at that point. You can do this with
a) context menus,
b) the eval command,
c) or the evaluate symbol
found in the Expression palette.

 (4.1) 
 (4.2) 
=
 (4.3) 
 (4.4) 

Functions
Mathematical functions in Maple are represented as operators. The operator notation is represented by an arrow.is a function in defined to the right.
Example:
To define this function, you can use the palettes. From the Expression palette, choose . Type F, then press [Tab]. Type x. Press [Tab]. Type x^2. Press [Enter] to evaluate this line, thus making the function definition.
To find the value of at a particular value, call the function with an argument.
Example: Try to evaluate F at 3 and F at y.
Alternate notation: Using natural math notation
Maple also provides a way to define a function using natural mathematical notation. To do this, you enter an expression of the form "f(y)=expr" and then convert it into a Maple function.
Example:
Define a function . To begin, type this equation. (You can find the nth root symbol in the Expression palette.) Rightclick on the equation, and choose Assign Function.
Note: Using the arrow operator to define a function is strongly recommended.

 (4.5) 
 (4.6) 
 (4.7) 
 (4.8) 
 (4.9) 

Typing the arrow operator
You can type a function definition directly. To create the arrow, type the dash key followed by the greater than key: ">".
Example:
Define
2.

Now, press [Esc] to get symbol completion. Select the symbol. Press [Enter].

3.

Type ">sin(3*theta [Esc]" and select the symbol again.

4.

Finally, type ")" to complete the expression. End the expression with a colon (:). Press [Enter].

Tip: Ending any expression with a colon (:) suppresses the output.

 (4.10) 

MultiParameter Functions
is a two parameter function defined to the right.
You can evaluate G at specified points.
Example: Try evaluating G at (1,2) and at (1, y).
Note: This can be extended for use with multiparameter functions.

=
=

Procedures
A function is a special form of the more general procedure.
Example: See the example on the right for a very basic procedure.
Procedures can include conditional statements, iteration, type checking, local variables, errorhandling, and other features of standard programming languages. For an introduction to Maple programming, see the Basic Programming chapter of the User Manual.
Tip: Use [Shift][Enter] to continue a command on the next line.

=

Maple Syntax and 2D Math
The examples in these tutorials are done using standard 2D math notation, where fractions and exponents are entered and displayed as they would be written on paper. Some people prefer to enter commands using 1D Maple syntax, especially when writing procedures.
Several options are available for those who wish to use Maple syntax. The Code Edit Region, which can be embedded directly into a standard Maple document, provides an editor for easy entry of code written in Maple syntax.
For those who wish to do all interactive work in Maple Syntax, use worksheet mode with the input display set to Maple Notation.

 (4.11) 
 (4.12) 




Go to Maple Portal Previous Tutorial Next Tutorial
