JSPM

gaussian-elimination-co

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q37815F
  • License Boost

A library implementing Gauissian Elmination in typescript

Package Exports

  • gaussian-elimination-co
  • gaussian-elimination-co/bin/main.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gaussian-elimination-co) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Gaussian Elimination

This simple library facilitates the solving of simultaneous equations and finding the inverse of matrices via Gaussian Elimination.

Docs: View Docs

Usage

Simultaneous Equations

Create a Tableau to represent this set of equations

equations

import { Tableau } from './main'

const tableau = Tableau.from([
  [[ 2 ,  1 , -1 ], [ 8 ]],
  [[-3 , -1 ,  2 ], [-11]],
  [[-2 ,  1 ,  2 ], [-3 ]],
])

Then to solve the equations

tableau.solve() // Returns [[2, 3, -1]]

After solving, to get just the first elements of all right-hand side of the tableau, you can use

tableau.getLHSFirsts() // Returns [2, 3, -1]

Matrix Inversion

Finding the inverse the above LHS

import { Tableau } from './main'

const tableau = Tableau.from([
  [[ 2 ,  1 , -1 ], [ 1 , 0 , 0 ]],
  [[-3 , -1 ,  2 ], [ 0 , 1 , 0 ]],
  [[-2 ,  1 ,  2 ], [ 0 , 0 , 1 ]],
])

tableau.solve() // Returns [ [ 4, 3, -1 ], [-2, -2, 1 ], [ 5, 4, -1 ] ]