874 Appendix A: Functions and Instructions
list1
+
list2
⇒
list
matrix1
+
matrix2
⇒
matrix
Returns a list (or matrix) containing the sums of
corresponding elements in
list1
and
list2
(or
matrix1
and
matrix2
).
Dimensions of the arguments must be equal.
{22,p,p/2}! L1
¸ {22 p p/2}
{10,5,p/2}! L2
¸ {10 5 p/2}
L1+L2
¸ {32 p+5 p}
ans(1)+{p,ë 5,ë p}
¸
{p+32 p 0}
[a,b;c,d]+[1,0;0,1]
¸
[]
a+1 b
c d+1
expression
+
list1
⇒
list
list1
+
expression
⇒
list
Returns a list containing the sums of
expression
and
each element in
list1
.
15+{10,15,20}
¸ {25 30 35}
{10,15,20}+15
¸ {25 30 35}
expression
+
matrix1
⇒
matrix
matrix1
+
expression
⇒
matrix
Returns a matrix with
expression
added to each
element on the diagonal of
matrix1
.
matrix1
must be
square.
Note: Use
.+
(dot plus) to add an expression to
each element.
20+[1,2;3,4]
¸
[
21 2
3 24
]
ì
(subtract)
| key
expression1
-
expression2
⇒
expression
Returns
expression1
minus
expression2
.
6ì 2
¸ 4
pì pà6
¸
5ø p
6
list1
-
list2
⇒
list
matrix1
-
matrix2
⇒
matrix
Subtracts each element in
list2
(or
matrix2
) from the
corresponding element in
list1
(or
matrix1
), and
returns the results.
Dimensions of the arguments must be equal.
{22,p,pà2}ì {10,5,pà2}
¸
{12 pì 5 0}
[3,4]ì [1,2]
¸ [2 2]
expression
-
list1
⇒
list
list1
-
expression
⇒
list
Subtracts each
list1
element from
expression
or
subtracts
expression
from each
list1
element, and
returns a list of the results.
15ì {10,15,20}
¸ {5 0 -5}
{10,15,20}ì 15
¸ {-5 0 5}
expression
-
matrix1
⇒
matrix
matrix1
-
expression
⇒
matrix
expression
ì
matrix1
returns a matrix of
expression
times the identity matrix minus
matrix1
.
matrix1
must
be square.
matrix1
ì
expression
returns a matrix of
expression
times the identity matrix subtracted from
matrix1
.
matrix1
must be square.
Note: Use
..
(dot minus) to subtract an expression
from each element.
20ì [1,2;3,4]
¸
[
19 ë 2
ë 3 16
]
ù
(multiply)
p key
expression1
ù
expression2
⇒
expression
Returns the product of
expression1
and
expression2
.
2ù 3.45
¸ 6.9
xù yù x
¸ x
2
ø y