Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
0

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

asked 8 years ago

daviddgl gravatar image

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

Is there any specific command like

u.ginv()

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

Any hint will help me lot.

Defn:

for a vector un×1 a vector v1×n is said to be generalized inverse of u if uvu=u.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
0

answered 8 years ago

This is sufficient for vectors:

V = matrix(4,1,[1,2,2,1])
V.transpose() / V.norm()^2
Preview: (hide)
link
0

answered 8 years ago

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))
matrix(linalg.pinv2(M))
Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 8 years ago

Seen: 1,131 times

Last updated: Oct 26 '16