3 ms·
For anyone who has only used Microsoft dialect BASICs, seeing the original Dartmouth BASIC features might be surprising. I learned BASIC on a Wang 2200 computer
by tasty_freeze 6y ago
For anyone who has only used Microsoft dialect BASICs, seeing the original Dartmouth BASIC features might be surprising. I learned BASIC on a Wang 2200 computer (circa 1973), which followed Dartmouth BASIC pretty closely and added a ton of quirky Wang-specific features on top. The following, as far as I recall, would have been valid in the 1964 Dartmouth BASIC:
10 DIM A(5,5), B(5,5), C(5,5)
20 MAT READ A,B
30 DATA <a list of numbers for matrix A and B here>
40 MAT C=A*B:REM matrix multiply
50 MAT PRINT C:REM print the contents of C in five rows
60 MAT C=A*(2):REM scalar multiply
70 MAT C=A+B:REM matrix addition
80 MAT C=A-B:REM matrix subtaction
90 MAT C=TRN(A):REM matrix transpose
100 REM C=IDN:REM fill C with identity matrix
110 REM C=ZER:REM fill C with zeros
120 REM C=INV(A),D: REM invert A, and put determinant in variable D
By combining INV with matrix multiply, it was a snap to solve systems of linear equations. The examples above are all square matrices, but many of the actions worked on non-square matrices too. It was also possible to change the dimensions of a matrix so long as the total number of elements was the same or less than what was allocated by the original DIM statement.
- tasty_freeze 6y agoLines 100-120 were intended to start with MAT C=..., but I had a thinko and typed REM instead.