Ask Your Question

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

asked 2016-10-25 12:31:14 -0500

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-25 19:41:33 -0500

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-25 17:22:41 -0500

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 12:31:14 -0500

Seen: 50 times

Last updated: Oct 25 '16