BBS: Inland Empire Archive
Date: 04-30-92 (21:21)             Number: 194
From: PAUL LEONARD                 Refer#: 147
  To: MARGARET ROMAO                Recvd: NO  
Subj: Matrix                         Conf: (2) Quik_Bas
On or about <Apr 29 11:26>, Margaret Romao (1:3603/150) scribbled:

 MR> What did the MAT function do?

The following is from the Basic-Plus2 help listings...


    MAT INPUT array(s)
    50 MAT INPUT A
    The MAT INPUT statement assigns data you input to the elements
    of a specified array.  Elements are stored in row order as they
    are typed.
    MAT INPUT #num-exp%, array name
    100 MAT INPUT #2%, ARN
    The MAT INPUT # statement reads values from a terminal format
    file and assigns them to a specified array.  The elements are
    stored in the destination array in row order.

    MAT LINPUT string array name
    The MAT LINPUT statement assigns data you input to elements of
    a string array.
    MAT LINPUT #num-exp% string array name
    90 MAT LINPUT #1%,A$
    The MAT LINPUT statement reads string data from a terminal
    format file and assigns it to elements of a string array.
    MAT LINPUT # does not include the string's line terminator
    as part of the array element.

    MAT PRINT array(s)
    120 MAT PRINT A;
    The MAT PRINT statement prints all elements of a specified
    MAT PRINT #num-exp%, array name
    60 MAT PRINT #5%, TESTAR
    MAT PRINT # prints the contents of an array to a terminal
    format file.

    MAT READ array(s)
    50 MAT READ B,C
    The MAT READ statement reads data statement values into
    elements of a 1- or 2-dimensional array.

    MAT array name = array name
    15 MAT A = B
    In matrix assignment, the MAT statement sets each entry of
    Array A equal to the corresponding entry of Array B.  A is
    redimensioned to the size of B.

    Sets up an identity matrix:  all elements are zero
    except for those on the (I,I) diagonal, which are set
    to one.

    Generates a matrix that is the inverse of another.  For
    example, MAT N = INV(M) makes Matrix N the inverse of
    Matrix M.  Matrix M must be a square matrix.

...All of these functions are just specialized array
functions and can be implemented with FOR...NEXT loops.
For example, the IDN(mat) can be coded with...

DIM mat%(10,10)

FOR i%=1 to 10
  FOR j%=1 to 10
    IF i%=j% then mat%(i%,j%)=1 else mat%(i%,j%)=0
  NEXT j%


--- msged 2.07
 * Origin: PTL Pointwork (1:105/48.111)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET