Content deleted Content added
→Functions: +line numbers in the examples, given that they're required |
→Arrays: Added example |
||
Line 128:
=== Arrays ===
Support for handling arrays of data was relatively strong, with <code>MAT</code> statements able to read an entire array from <code>DATA</code> statements, and perform useful [[matrix (mathematics)|matrix]] operations such as adding or multiplying two matrices, or even finding the [[multiplicative inverse]] of a [[square matrix]].
Example:
10 DATA 0,0,1,0,1,0,1,0,0
20 DIM A(3,3)
30 MAT READ A
40 DATA 2,4,3,-1,0,-2,1,-4,5
50 DIM B(3,3)
60 MAT READ B
70 DIM C(3,3)
80 MAT C = A * B
90 MAT PRINT C,
A contains
<math>\begin{pmatrix}
0 & 0 & 1 \\
0 & 1 & 0 \\
1 & 0 & 0
\end{pmatrix}</math>
, B contains
<math>\begin{pmatrix}
2 & 4 & 3 \\
-1 & 0 & -2 \\
1 & -4 & 5
\end{pmatrix}</math>
, C contains
<math>\begin{pmatrix}
1 & -4 & 5 \\
-1 & 0 & -2 \\
2 & 4 & 3
\end{pmatrix}</math>
This is the output:
1 -4 5
-1 0 -2
2 4 3
== Debugging ==
|