Content deleted Content added
→Arrays: Added example |
→Arrays: Extended example |
||
Line 127:
=== 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
Example:
10
20
30 DATA 1,1,2,1,0,2,0,2,1
30 MAT READ A▼
40
50
60 DATA 0,0,1,0,1,0,1,0,0
70 DIM C(3,3),D(3,3)
80 MAT C
90 MAT
<math>\begin{pmatrix}▼
{|
|<code>A</code> is read from the first <code>DATA</code> statement
▲|<math>\begin{pmatrix}
0 & 2 & 1
\end{pmatrix}</math>
|-
|<code>B</code> is read from the second <code>DATA</code> statement
|<math>\begin{pmatrix}▼
0 & 0 & 1 \\
0 & 1 & 0 \\
1 & 0 & 0
\end{pmatrix}</math>
|-
|<code>C</code> is calculated by multiplying <code>A</code> and <code>B</code>
▲<math>\begin{pmatrix}
|<math>\begin{pmatrix}▼
▲ 2 & 4 & 3 \\
1 & 2 & 0
\end{pmatrix}</math>
|-
|<code>D</code> is calculated as the inverse of <code>C</code>
▲<math>\begin{pmatrix}
|<math>\begin{pmatrix}
▲ 1 & -4 & 5 \\
4 & -3 & -2
\end{pmatrix}</math>
|}
The output would be
== Debugging ==
|