Ask Your Question

How to find a generalized inverse of a vector in sagemath?

asked 2016-10-25 19:31:14 +0200

daviddgl gravatar image

Given a vector $u$ of size $n\times 1 $. How to find the g-inverse of $u$?

Is there any specific command like


to find the ginverse or we have define it?? If so, how to do that?

Any hint will help me lot.


for a vector $u_{n\times 1} $ a vector $v_{1\times n}$ is said to be generalized inverse of $u$ if $$uvu=u.$$

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-10-26 02:41:33 +0200

This is sufficient for vectors:

V = matrix(4,1,[1,2,2,1])
V.transpose() / V.norm()^2
edit flag offensive delete link more

answered 2016-10-26 00:22:41 +0200

ndomes gravatar image

Scipy provides methods to calculate a generalized inverse (linalg.pinv , linalg.pinv2, linalg.pinvh)

from scipy import linalg
M = matrix(4,1,(1,2,2,1))
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-10-25 19:31:14 +0200

Seen: 1,009 times

Last updated: Oct 26 '16