PDF-Version - am Institut für Baustatik
PDF-Version - am Institut für Baustatik
PDF-Version - am Institut für Baustatik
Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.
YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.
• To indicate non-commutative matrix multiplication, use the operator &*. The matrix product ABC<br />
may be entered as A &* B &* C or as &*(A,B,C), the latter being more efficient. Automatic<br />
simplifications such as collecting constants and powers will be applied. Do NOT use the * to<br />
indicate purely matrix multiplication, as this will result in an error. The operands of &* must be<br />
matrices (or n<strong>am</strong>es) with the exception of 0. Unevaluated matrix products are considered to be<br />
matrices. The operator &* has the s<strong>am</strong>e precedence as the * operator.<br />
• Use 0 to denote the matrix or scalar zero. Use &*() to denote the matrix identity. It may be<br />
convenient to use alias(Id=&*()).<br />
> alias(Id=&*()):<br />
> S := array([[1,2],[3,4]]):<br />
> T := array([[1,1],[2,-1]]):<br />
> evalm(S+2*T);<br />
⎡3<br />
4⎤<br />
⎢ ⎥<br />
⎣7<br />
2⎦<br />
> evalm(S^2);<br />
⎡ 7 10⎤<br />
⎢ ⎥<br />
⎣15<br />
22⎦<br />
> evalm(S &* T);<br />
⎡ 5 −1⎤<br />
⎢ ⎥<br />
⎣11<br />
−1⎦<br />
> evalm(T+Id);<br />
⎡2<br />
1⎤<br />
⎢ ⎥<br />
⎣2<br />
0⎦<br />
11.5 Advanced Maple<br />
11.5.1 Manipulating Expressions<br />
You can ex<strong>am</strong>ine parts of expressions by using the standard Maple library functions designed to<br />
categorize them or to pull them apart: type, whattype, op, and nops are some of those functions.<br />
To look at the i-th part of an expression, you use op(i, expression), where i evaluates to a nonnegative<br />
integer.<br />
Ex<strong>am</strong>ple:<br />
> e1 := op1 + op2 + op3:<br />
> e2 := op1 * op2 * sin(op3):<br />
> op(2, e1);<br />
op2<br />
> op(3, e2);<br />
sin(op3)<br />
As you can see, the operands of the expression are returned, not the operators that connect them.<br />
This is because Maple categorizes expressions into "types". For instance, "a+b+c" is of type "+" and<br />
has three operands; "a+b*c" is also of type "+" and has only two operands, one of which is of type "*"<br />
and itself has two operands. The whattype function tells you the type of an expression; type is a<br />
boolean test that allows you to check for a particular type of expression. For ex<strong>am</strong>ple:<br />
> whattype(e1);<br />
+<br />
> whattype(e2);<br />
*<br />
> type(e1+e2, `+`);<br />
true<br />
> type(expand(e1*e2),`+`);<br />
117