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

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

= 2;<br />

b = 2<br />

In the first case we are assigning the value 2 to the variable a (Zuordnung). In the second case, we<br />

are making the assertion that b is in fact already equal to 2 (Gleichung).<br />

11.2.5 Quotes, N<strong>am</strong>es, and Values (Anführungszeichen, N<strong>am</strong>en und Werte)<br />

There are three types of quotes used in Maple: double-quotes ("); backquotes (`); and apostrophes or<br />

single quotes (').<br />

Double quotes are used to construct strings (Zeichenfolgen), as in:<br />

> a := "This is a string";<br />

a := This is a string<br />

> a;<br />

This is a string<br />

Single quotes are used to delay evaluation (verzögerte Ausführung), as in:<br />

> a := 1; x := 'a' + b;<br />

a := 1<br />

x := a + b<br />

Backquotes are used to form symbols or n<strong>am</strong>es (Definition von Symbolen und N<strong>am</strong>en):<br />

> `This is a n<strong>am</strong>e!` := 1;<br />

This is a n<strong>am</strong>e! := 1<br />

In the previous section, a mathematical variable was also described as an unassigned variable<br />

(Platzhalter). Unassigned variables have their own n<strong>am</strong>e as their value. This is the default condition<br />

for a variable until you assign it a value. To turn an assigned variable (i.e., a progr<strong>am</strong>ming variable)<br />

back into an unassigned variable (i.e., a mathematical variable), you must assign it its own n<strong>am</strong>e. As<br />

an ex<strong>am</strong>ple:<br />

> # r hasn't been used, so its an unassigned variable:<br />

> r;<br />

r<br />

> # Now make r an assigned variable:<br />

> r := 2;<br />

r := 2<br />

> r;<br />

2<br />

> # Now make r an unassigned variable again:<br />

> r := 'r';<br />

r := r<br />

Maple generally performs what is called "full evaluation" (d.h. die Variable wird in allen Ausdrücken<br />

substituiert).<br />

11.2.6 Functions (Funktionen)<br />

Maple has a large library of functions for you to use. Syntactically, functions are a type of expression.<br />

They have a n<strong>am</strong>e, a sequence of zero or more arguments, and they return a value as a result of<br />

calling the function. For ex<strong>am</strong>ple:<br />

> a := -2;<br />

a := -2<br />

> abs(a);<br />

2<br />

> a;<br />

106

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

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!