\ Example set of 4 linear equations \ --------------------------------------------------- \ (c) Copyright 1999 Julian V. Noble. \ \ Permission is granted by the author to \ \ use this software for any application pro- \ \ vided this copyright notice is preserved. \ \ --------------------------------------------------- \ This is an ANS Forth program requiring the \ FLOAT, FLOAT EXT, FILE and TOOLS EXT wordsets. \ \ Environmental dependences: \ Assumes independent floating point stack MARKER -mex BL PARSE undefined DUP PAD C! PAD CHAR+ SWAP CHARS MOVE PAD FIND NIP 0= [IF] : undefined BL WORD FIND NIP 0= ; [THEN] undefined tab->vec [IF] include mat_util.f [THEN] 4 long 1 floats 1array v{ 4 long 4 wide 1 floats 2array a{{ 4 long 1 cells 1array Irow{ 0 Irow{ 0 } ! 1 Irow{ 1 } ! 2 Irow{ 2 } ! 3 Irow{ 3 } ! v{ 4 tab->vec 1.0e, 3.0e, 5.0e, -7.0e, a{{ 4 4 tab->mat 3.0e, 2.0e, 4.0e, 6.0e, -5.0e, 5.0e, 7.0e, -6.0e, 0.0e, 18.0e, 0.0e, -8.0e, -9.0e, 9.0e, 1.0e, 1.0e, \ FALSE [IF] \ [THEN] \ Solution (for test purposes) \ A{{ V{ ' }row{ }}SOLVE ok \ A{{ ' }row{ .M \ 0.999999e0 -9.999999e-1 -11.111111e-2 -11.111111e-2 \ 0.0 9.999999e-1 0.0 -4.444445e-1 \ 0.0 0.0 0.999999e0 -1.017242e0 \ 0.0 4.768371e-7 0.0 9.999999e-1 ok \ V{ ' }row{ .V \ 7.950347e-1 \ 2.563911e-2 \ 4.918724e-1 \ -5.673119e-1 ok