# Linear System Solver

The routine solveLinearSystem in the linearLib.ps file is a JavaScript function that uses a Guasian elimination technique to solve systems of linear equations. It uses row interchange to reduce roundoff error and handle 0's on the diagonal. It benefits from Javascript's default use of double precision real arithmetic and is suitable for ill conditioned systems. However, it suffers in efficiency because of Javascript's handling of double subscripts. For efficiency reasons it is generally recommended for systems of 10 equations or less in high production situations although the solution of a 10 equation system appears instantaneous on my computer.

Because it can handle multiple right hand sides, it can solve multiple systems with the same matrix simulataneously. It can also find the inverse of a matrix by using the identity matrix as the right hand side although this technique is not the most efficient way possible.

The demo program solveLinear.js calculates the solution of the linear system(s) and then checks the answer (in systems of 10 equations or less). The menu has several predefined systems and also allows users to input their own system using menu option 0. For example, to solve the linear systems with two right hand sides

```  2x + 4y + 2z = 16 or 16
1x - 2y + 1z = 0 or -4
1x + 6y + 6z = 13 or 16
```
they would chose menu option 0 then respond they wanted 3 equations and type
2, 4, 2, 16, 16
1, -2, 1, 0, -4
1, 6, 6, 13, 16
(one line at a time) when the coefficients are requested.

solveLinear.js Source for the main program.
linearLib.js Source for the library of linear system routines used by this program.

James Brink
5/22/2021