How to resolve the algorithm Gauss-Jordan matrix inversion step by step in the Wren programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Gauss-Jordan matrix inversion step by step in the Wren programming language

Table of Contents

Problem Statement

Invert matrix   A   using Gauss-Jordan method. A   being an   n × n   matrix.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Gauss-Jordan matrix inversion step by step in the Wren programming language

Source code in the wren programming language

import "./matrix" for Matrix
import "./fmt" for Fmt

var arrays = [
    [ [ 1,  2,  3],
      [ 4,  1,  6],
      [ 7,  8,  9] ],

    [ [ 2, -1,  0 ],
      [-1,  2, -1 ],
      [ 0, -1,  2 ] ],

    [ [ -1, -2, 3, 2 ],
      [ -4, -1, 6, 2 ],
      [  7, -8, 9, 1 ],
      [  1, -2, 1, 3 ] ]
]

for (array in arrays) {
    System.print("Original:\n")
    var m = Matrix.new(array)
    Fmt.mprint(m, 2, 0)
    System.print("\nInverse:\n")
    Fmt.mprint(m.inverse, 9, 6)
    System.print()
}


  

You may also check:How to resolve the algorithm Reflection/List methods step by step in the Factor programming language
You may also check:How to resolve the algorithm File input/output step by step in the SenseTalk programming language
You may also check:How to resolve the algorithm A+B step by step in the Arc programming language
You may also check:How to resolve the algorithm Variadic function step by step in the Free Pascal programming language
You may also check:How to resolve the algorithm Radical of an integer step by step in the J programming language