GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Download
  • News
  • Community
  • Resources
  • Language Reference
  • SmallBASIC Manual

This view

  • Original page
  • New address

GeezerVison is showing smallbasic.github.io — SmallBASIC | LINEQN

Edit History

LINEQN

C = LINEQN (A, B [, toler])

Home > Reference > Math

Solves linear equations using the Gauss-Jordan method.

  • A equation coefficience as a matrix
  • B results of the equations as a column-vector
  • C result as a Nx1 matrix with the values of the unknowns
  • toler tolerance number (the absolute value of the lowest acceptable number). Default value is 0 (tolerance not applied).

One possible problem is numerical instability, caused by the possibility of dividing by very small numbers. If, for example, the leading coefficient of one of the rows is very close to zero, […] one would need to divide by that number. This means that any error existed for the number that was close to zero would be amplified. Wikipedia

The tolerance number can be used to ensure, that no division by numbers smaller than toler will be performed.

Example

' Solve:
'  x -  y + 2z =  6
' 2x + 3y + 2z = 11
' 3x + 2y +  z =  8

A = [1,-1,2; 2,3,2; 3,2,1]
B = [6; 11; 8]

C = LINEQN(A, B)

print "x = "; C(0,0)
print "y = "; C(0,1)
print "z = "; C(0,2)

' Output: x = 1; y = 1; z = 3
Code samples using LINEQN
gaussj.bas   lineqn.bas  
Math
ABS   ABSMAX   ABSMIN   ACOS   ACOSH   ACOT   ACOTH   ACSC   ACSCH   ASEC   ASECH   ASIN   ASINH   ATAN   ATAN2   ATANH   ATN   CEIL   COS   COSH   COT   COTH   CSC   CSCH   DEG   DERIV   DETERM   DIFFEQN   EXP   EXPRSEQ   FIX   FLOOR   FRAC   INT   INTERSECT   INVERSE   LINEQN   LOG   LOG10   M3APPLY   M3IDENT   M3ROTATE   M3SCALE   M3TRANS   MAX   MIN   POLYAREA   POLYCENT   POLYEXT   POW   PTDISTLN   PTDISTSEG   PTSIGN   RAD   RND   ROOT   ROUND   SEC   SECH   SEGCOS   SEGLEN   SEGSIN   SEQ   SGN   SIN   SINH   SQR   STATMEAN   STATMEANDEV   STATMEDIAN   STATSPREADP   STATSPREADS   STATSTD   SUM   SUMSQ   TAN   TANH   TRANSPOSE  
This page was last edited on Mon, 15 May 2023 16:24:43 +0200 | Markdown processed with pandoc 3.1.12.1
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.