How to Solve a Matrix Using QBasic
QBasic is an outdated programming language that was included with the DOS operating system. It was still included in earlier versions of Windows, but was discontinued completely with the release of Windows 2000. Versions can still be downloaded from unofficial sources compatible with today's modern operating systems. The language can still perform complex mathematical equations, including the use of matrices.
Instructions
-
-
1
Set up the matrix with the command "DIM MatrixOne%(x,y)." Enter the command without quotes. Replace "x" with the number of desired rows and "y" with the number of desired columns in the matrix.
-
2
Fill the matrix with data using the following commands:
FOR X% = 0 TO 6
FOR Y% = 0 TO 9
MatrixOne%(X%,Y%) = V%
V% = V% + 1
NEXT
NEXT
This will fill the matrix with integers, each one a single digit higher than the last. If you wish to input your own custom data, replace "V% + 1" with your own data.
-
-
3
Repeat Step 1 and Step 2, replacing any reference to "MatrixOne%" with "MatrixTwo%."
-
4
Perform any calculations using the two variables to perform calculations on the matrices. For example, "DIM MatrixAnswer% = MatrixOne% - MatrixTwo%" would create a new matrix based on the solution of subtracting MatrixTwo from MatrixOne.
-
1
References
- "The Beginner's Guide to QBasic"; Olga Melnikova; 2009
- Photo Credit Stockbyte/Stockbyte/Getty Images