Table of Contents

Quiz

 

Back to Maple Tutorial Table of Contents

Introduction

Sending Maple worksheets to other people who use Maple is a great way to share mathematical ideas. The process is rather simple; save your .mws file and attach it in an email or put it on a disk. However, there are some extra things you can do to make the "Maple exchange" more pleasant for the other user.

 

Top

restart

The first command your worksheet should have is restart. We learned about restart in a previous lesson, but to review, it clears all variables, packages, and functions from Maple's memory. This is important, because even if you open/create a new document in Maple, it still retains the old worksheet's information.

For example, open a worksheet and declare a variable called a to some value. Now, create a new worksheet and read the value of a. Surprise! a should be the value you set it to in the first worksheet.

If the user (the person who opens your worksheet) had another worksheet open, the two worksheets may conflict.

To avoid this, include restart before you load packages.

Example:

> restart;with(plots):

 

Top

Command Order and Execution Groups

If it is vital that a sequence of commands be executed in a certain order (i.e. if you define a variable and then have a command that uses it), make sure that your worksheet reflects that order. In other words, don't send a worksheet that isn't in order from top to bottom. If you need to insert a command block between commands, put your cursor on the bottom command block and press Control-K. This inserts a command prompt before the current block. Pressing Control-J inserts a command prompt after the current block. An easy way to remember which key does what is to remember that they are backwards. Since J comes before K in the alphabet, we would think that Control-J inserts a command prompt before the current prompt. But it is backwards!

If you woud like to make sure that two commands are executed at the same time, you can combine them into one execution group. In Maple, when you put your cursor in an execution group and press Return, Maple executes all commands in the execution group. We haven't noticed this phenomenon because, by default, Maple puts each command prompt in its own execution group.

You can tell how far the execution groups span by looking to the left of the command prompt. You will see a symbol that looks like a bracket. Each "bracket" denotes an execution group.

To combine two commands into one execution group, put your cursor on the top command and press F4. To split an execution group, put your cursor at the beginning of the line above where you want the split, and press F3.

If you have a worksheet that uses restart, defines packages, or creates variables, functions, or procedures for later use, use this technique to combine all of the "initialization" commands into one execution group so the user doesn't have to press Return on each command.

 

Top

Removing Output

If you worksheet has many plots or animations, the file size of the worksheet can grow very large, very quickly. If you are sending a worksheet with many plots or animations, you should remove them. The user will receive a worksheet with all of the necessary commands for the plot. They can then execute the worksheet (by going to Edit->Execute->Worksheet) to view the plots/animations.

To remove output from your worksheets, go to Edit->Remove Output->Worksheet.

 

Top

Posting a .mws File on a Website.

Using the web for wide distribution is a great idea. However, there can be a snag in the process. You would upload the file as you would any other file, probably using an FTP client. Then, you would make a link to that file as with any other file. However, some web servers (the software that serves web pages to the clients) may send a Maple file as plain text, which will show up in your browser instead of asking if you would like to download and save the worksheet.

There are two ways to remedy this. One is the elegant solution, but it requires the cooperation of your web server administrator. Contact your web admin and ask him/her to insert a MIME type for .mws files so that the server sends them as a download instead of a file that the browser displays. This may not be a viable solution since some web administrators do not want to modify their servers for one person.

The other solution isn't as elegant, but it doesn't require the assistance of your web administrator. Simply upload the .mws file and create a hyperlink as usual but instruct your users to right-click the link and choose "Save Target As..." or "Save Link As..." depending on their browsers. They can save the file to their hard drives or to a disk and open it in Maple.

 

Top

Exporting a Worksheet to HTML

If you want people who do not have access to Maple to be able to see Maple output, you can export it to HTML. Maple will convert your worksheet into a web page that any browser can read and interpret. To do this, go to File->Export As->HTML... When you get the Save dialog box, choose where you want the HTML file to be saved and what to name it. When you click OK, Maple generates the HTML file. You will see three files and, possibly, a new folder named images.

By default, Maple exports the HTML file so that you will see a list of sections on the left and the content on the right. If you don't want that, you need to delete two files. For example, if you named your HTML file myfile.htm, you would need to delete myfile.htm, myfileTOC.htm. You would rename myfile1.htm to myfile.htm. In Maple 7, you can tell it not to generate three files. Instead, Maple 7 will put the contents of the myfileTOC.htm file at the top of myfile.htm. You may want to edit the HTML file to remove that.

Note that if you upload a Maple-generated HTML file to the web, you must upload the images directory.

A caveat:

Maple generates all Maple Math and output to .gif graphic files. Even if you use 2*Pi as Maple Math in your worksheet, Maple converts that to a picture. Maple's GIF generation is horrible. The converted .gif files have blank space to the right and to the bottom of the Maple Math. Therefore, it is advised that for simple things such as superscript and subscript, that you do not use Maple Math, but instead, you use HTML coding to achieve the same effect.

If you have Maple 7, you can export to a language called MathML which is based on XML. MathML is supposed to tell both computers and humans how a piece of math is to be formatted. Unfortunately, its current implementation leaves much to be desired.

If you are a web designer, you may want to edit the HTML files that Maple generates by hand. Maple's HTML generation can be sloppy at times.

 

Top