Ask Your Question
0

Get decomposition of vector in basis

asked 2015-05-20 22:11:32 +0100

mimoo gravatar image

Hey!

I have a matrix that represents my basis (it's actually a lattice so the vectors are rows, but it's not important I can transpose)

I have a vector aa in a canonical basis, I want to know what's the linear combination in R of my lattice's vectors that gives my vector aa

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-05-20 23:44:20 +0100

tmonteil gravatar image

updated 2015-05-21 11:58:25 +0100

This is not very specific to Sage: if $M$ is the matrix whose columns $C_0,...,C_{n-1}$ represent your basis expressed in the canonical basis, you have $MX=aa$ where $X$ is a column vector, whose entries $x_0,...x_{n-1}$ correspond to the coefficients of the linear combination you are looking for, that is $aa = x_0C_0+...+x_{n-1}C_{n-1}$ .

So, if you want to find $X$ you just have to compute:

sage: X = M^(-1)*aa

Then, if you want to manipulate the coefficients $x_i$ as in a list, you can do:

sage: L = X.list()
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

1 follower

Stats

Asked: 2015-05-20 22:11:32 +0100

Seen: 783 times

Last updated: May 21 '15