04.03.2013 Aufrufe

PDF-Version - am Institut für Baustatik

PDF-Version - am Institut für Baustatik

PDF-Version - am Institut für Baustatik

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

11.2.8 Packages and Libraries (Zusatzpakete und Bibliotheken)<br />

A Maple "package" is a collection of related functions. An ex<strong>am</strong>ple of a package is linalg, the Maple<br />

linear algebra package. To use a package, you initially read it into memory using the with command:<br />

> with(linalg):<br />

Warning: new definition for norm<br />

Warning: new definition for trace<br />

It will also give a bracketed list of functions. When Maple loads a package, it checks to see whether<br />

any of the new function n<strong>am</strong>es will replace an existing function. If so, it gives you a warning. For<br />

instance, since linalg has a function to compute the trace of a matrix that is called "trace", which is the<br />

s<strong>am</strong>e n<strong>am</strong>e as the debugging command "trace", a warning was generated. The new function is<br />

available for use, but the previous function of the s<strong>am</strong>e n<strong>am</strong>e is no longer accessible.<br />

There is a way to avoid this problem if you want access to both functions. The technique will allow you<br />

to use a single function of a package without loading the entire package into memory. To specify the<br />

function, you use the "long form": libn<strong>am</strong>e[funcn<strong>am</strong>e](...) where funcn<strong>am</strong>e is the function you wish to<br />

use, libn<strong>am</strong>e is the package it is contained in, and (...) is the argument list.<br />

A Maple "library" is a collection of packages. The standard Maple library consists of some internallydefined<br />

functions, but most of them reside externally on the file system. When you use the readlib<br />

command, Maple reads in the definition for the specified function in much the s<strong>am</strong>e way that with<br />

works for packages. readlib is particularly useful in situations where you have redefined a standard<br />

library function.<br />

For ex<strong>am</strong>ple, when the linalg package was loaded in, the standard trace function bec<strong>am</strong>e<br />

unavailable. To get it back, use:<br />

> readlib('trace');<br />

proc(fn<strong>am</strong>e) ... end<br />

11.2.9 Restoring and Saving Sessions (Sichern und Wiederherstellen)<br />

During the course of a Maple session, you may have entered in a number of useful expressions and<br />

routines that you would like to re-use in future. To avoid retyping them the next time you use Maple,<br />

you can save that work in a file by using the save command.<br />

For ex<strong>am</strong>ple, the following command saves everything you created during the session in a file n<strong>am</strong>ed<br />

"filen<strong>am</strong>e.m":<br />

> save "filen<strong>am</strong>e.m";<br />

or:<br />

> save a,b,c,"filen<strong>am</strong>e.m"<br />

if you only want to save variables a, b, and c.<br />

When you specify a filen<strong>am</strong>e with the extension ".m", Maple saves your work in "Maple internal<br />

format". This format can be read in more quickly by Maple when you restore your work later on, but is<br />

not human-readable. You restore the information with the command:<br />

> read "filen<strong>am</strong>e.m";<br />

To save information in a human-readable format (Maple language format), you can type:<br />

> save a,b,c,"filen<strong>am</strong>e"<br />

This saves the specified items as a series of assignment statements. To save the entire worksheet,<br />

select File, followed by Save As. For more information on formats, consult Maple's online help.<br />

108

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!