Reading and Writing to a File in Maple

How can I salvage, restore and export information with Maple?

On this page:

  • Overview
  • Save
  • Saving worksheets
  • writeto
  • The "Export" menu option
  • LaTeX export
  • Other formats
  • See Also

Overview

Yous tin can salve and restore, and export Maple information in a number of ways. To salve output from Maple (or afterward restore it) yous have a number of choices:

Salve

Utilise the 'save' control. "save filename" will write all assigned names in the current Maple session into the file specified by filename as a sequence of assignment statements. The complementary control for reading information is "read filename". If the filename ends with ".k" and so the information is saved or read in "Maple internal format", otherwise the expressions are in readable text. To salvage ALL your variables in a ".thou" file named "foo.m", just do the following at the Maple ">" prompt:

To merely save a particular variable, say "a" for example, just do:

Saving worksheets

Employ the "Relieve" or "Save As..." features from the File carte du jour in the Ten version to save the current worksheet. This saves the commands you lot take typed and the results in "Maple worksheet" format with the extension ".mws". "Open up" from the File menu volition bring a worksheet file upward without executing its contents; i.e., you will see the commands and results, merely the variables aren't actually assigned. You lot can edit and execute the contents interactively (east.g., movement to a line and hitting Return), or execute the entire worksheet from to the Edit menu by choosing "Execute", then "Worksheet".

writeto

Use the 'writeto' routine. All the hereafter commands will take their results stored in a file and will not be displayed on the screen. This command is not generally used interactively since y'all tin lose control of the session; it is useful in writing Maple programs. To restore output to the screen, use:

The 'appendto' command works in the same way, except the file is appended to instead of overwritten.

The "Export" menu selection

Use one of the "Consign every bit" choices from the pull-down File carte:

  • "Plain Text" saves the worksheet as a patently text dump.
  • "Maple Text" saves the worksheet every bit especially marked text which distinguishes betwixt comments, input, and output. You can and so read in or paste from such a file, and Maple will translate lines kickoff with "> " every bit input, "# " equally text, and ignore the residuum (i.due east., output lines). To read in the entire file, utilize File->Open; to paste, use Edit->Paste Maple Text.
  • "LaTeX" generates a .tex file from the worksheet, with .eps files for any graphics.
    (LaTeX generated by Maple may require some specific .sty files, namely maple2e.sty. Equally of Maple 10, these can be found in /mit/maple/maple_v10.0/distrib/etc/. Y'all should add that path to your TEXINPUTS in society to correctly process Maple-generated LaTeX)
  • "HTML" generates HTML from the worksheet, with .gif files for equations and graphics.
    It currently does this with frames, generating a couple of actress pages and putting the GIFS into an image subdirectory.)

LaTeX export

In add-on to exporting the entire worksheet every bit LaTeX (see above), Maple offers another method of formatting output in LaTeX math style. To display an expression in LaTeX math format type:

or:

                > latex(expression, filename);              

For example:

                > latex(%); 	> latex((ten^4 - y)/(y^2-3*10)); 	> latex(sin(ten^2), `/mit/joeuser/maplestuff.tex`);              

Other formats

There are also 'C' and 'fortran' functions which generate C or fortran code, and the 'eqn' command generates output for the troff/eqn processor. More than information on the above Maple commands tin be obtained by typing:

or from the Aid bill of fare in the Ten version of Maple.

See Also

  • Maple Landing Folio

escarcegalostower.blogspot.com

Source: http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907446

0 Response to "Reading and Writing to a File in Maple"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel