[SciPy-user] How to calculate minors.

Stephen Kelly steveire at gmail.com
Tue Oct 10 13:33:19 CDT 2006


I was looking for a way to do this a while ago too. I got it working by
multiplying the inverse of the matrix by the determinant, which gave me the
adjoint of the original matrix.

>>> from numpy import *
>>> from numpy.linalg import *
>>> a = array([[1, 2, 3],[4, 5, 6],[7, 8, 9]])
>>> adj = det(a) * inv(a)
>>> print adj
array([[ -3.,   6.,  -3.],
       [  6., -12.,   6.],
       [ -3.,   6.,  -3.]])

So you can access the diagonal elements now to get the minors. It's a work
around, and I think it should be built in to scipy properly.

Steve.

On 10/10/06, Armando Serrano Lombillo <arserlom at gmail.com> wrote:
>
> Hello, is there any way to easily calculate minors of matrixes with
> scipy/numpy.
>
> For example if we have matrix a:
> [[1 2 3]
>  [4 5 6]
>  [7 8 9]]
>
> then minor(a,0) should be the same as det([[5,6],[8,9]]) and minor (a,1)
> should be the same as det([[1,3],[7,9]]).
>
> Armando.
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20061010/6a61d4e6/attachment.html 


More information about the SciPy-user mailing list