-1

I know how to calculate the inverse of a matrix but I am having difficulty applying it in php. I am new to php and got an assignment to create a php program that gives inverse of a matrix. Can anyone please help me to create this program? It would be very useful for my learning. Below I have a 2x2 matrix in two arrays of which I took the Adjoint but now I'm having problems with further steps

Array
(
    [0] => Array
        (
            [0] => 1
            [1] => 2
        )

    [1] => Array
        (
            [0] => 4
            [1] => 5
        )

)
Array
(
    [0] => Array
        (
            [0] => 5
            [1] => -2
        )

    [1] => Array
        (
            [0] => -4
            [1] => 1
        )

)
SaidbakR
  • 13,303
  • 20
  • 101
  • 195
ali
  • 27
  • 1
  • 10
  • 1
    possible duplicate of [PHP inverse of a matrix](http://stackoverflow.com/questions/1811250/php-inverse-of-a-matrix) – Aman Rawat May 18 '15 at 11:54

1 Answers1

0

There are a lot of solutions.

Example

<?php

$a = array(
    array( 8, 1, 6 ),
    array( 3, 5, 7 ),
    array( 4, 9, 2 ),
);

$result = Lapack::pseudoInverse($a);
?>
Alexis Paques
  • 1,885
  • 15
  • 29