TransWikia.com

Gauss Jordan code for mathematica

Mathematica Asked by furkan on March 21, 2021

I want to find the inverse of the matrix using a unit matrix. I know it’s done directly using Inverse, but I need to write a simple code. I can’t write because I’m just starting to learn. How can I write this?

One Answer

Probably not what you are asking for but RowReduce performs the Gauss-Jordan elimination.

A = RandomReal[{-1, 1}, {1, 1} 3];
Ainv = RowReduce[
    Join[A, IdentityMatrix[Length[A]], 2]
    ][[All, Length[A] + 1 ;;]];

Test:

Max[Abs[Ainv - Inverse[A]]]

1.11022*10^-16

Answered by Henrik Schumacher on March 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP