newuser,topic02

(2) The Worksheet Environment

Before examining this topic, please make sure that you have read (1) Working Through the New User's Tour.

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} );

{x = 2*1/(sqrt(a))}, {x = -2*1/(sqrt(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.

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);

a^3+3*a^2*b+3*a*b^2+b^3

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 th e 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 );

[Maple Plot]

>

Spreadsheets

Maple allows you to enter spreadsheets that can contain both numeric and symbolic information. They combine Maple's math capabilities with the familiar row-and-column format of traditional spreadsheets.

You can use Maple's spreadsheets to generate tables of formulae. The following illustration is a Maple symbolic spreadsheet showing the integrals combining exp(x) with different formulae. The formulae in columns B and C depend on the formulae in column A.

general*expression The*Integral The*Integral*Value



1 Int(exp(x),x) exp(x)
x Int(exp(x)*x,x) exp(x)*x-exp(x)
x^2 Int(exp(x)*x^2,x) exp(x)*x^2-2*exp(x)*x+2*exp(x)
sin(x) Int(exp(x)*sin(x),x) -1/2*exp(x)*cos(x)+1/2*exp(x)*sin(x)
cos(x) Int(exp(x)*cos(x),x) 1/2*exp(x)*cos(x)+1/2*exp(x)*sin(x)
tan(x) Int(exp(x)*tan(x),x) -I*exp(x)-I*int(-2*exp(x)/(exp(I*x)^2+1),x)

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.)

z = sin(x^2*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));

[Maple Plot]

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 .

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 int(x^2*sin(alpha*x),x = 0 .. beta) in Maple, type:

> int( x^2*sin(alpha*x), x=0..beta );

Sections

Worksheets can be organized into a hierarchy of sections, with subsections within sections. Sections and subsections can be expanded and collapsed. Below are examples of subsections for this section. To expand and collapse them, click on the box beside the section (or subsection) name. Try this now:

Subsection 1

This is a short paragraph within a subsection.

Subsection 1.1

A subsection.

Subsection 1.2

This is another subsection.

Subsection 2

This is another subsection.

Hyperlinks

A hyperlink is a navigational tool. When you click on a hyperlink, it takes you to another location in the same worksheet, to another worksheet, to a help page, to a worksheet on a web server, or to a web page. By default, Maple displays hyperlinks as underlined dark cyan text. For instance, the Main Menu for this tour contains hyperlinks to each of its twelve topics.

Maple also supports bookmarking. A bookmark is a name that identifies a particular location in a worksheet. To access a list of bookmarks in the current document, from the View menu, choose Bookmarks . Choosing a bookmark name moves the cursor to the specified location in the worksheet. Bookmarks are also a prerequisite for creating a hyperlink to another location in the same worksheet.

To place a new hyperlink, from the Insert menu, choose Hyperlinks . To convert existing text into a hyperlink, from the Format menu, choose Convert to , then Hyperlink .

Click here to return to the Main Menu.

© 2009 by the Rector and Visitors of the University of Virginia.

The information contained on the University of Virginia’s Department of Information Technology and Communication (ITC) website is provided as a public service with the understanding that ITC makes no representations or warranties, either expressed or implied, concerning the accuracy, completeness, reliability or suitability of the information, including warrantees of title, non-infringement of copyright or patent rights of others. These pages are expected to represent the University of Virginia community and the State of Virginia in a professional manner in accordance with the University of Virginia’s Computing Policies.