Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Checking what the span is for a vector

Let's assume I have a vector called v1 and I have a matrix called Matrix.

Let us assume that the vector is in the span of the rows of Matrix. How would I know what the linear combination is? Here is what I do know. Let's assume this is a m by n matrix. I do know there is the span function. So

I can do something like make a list of vectors out of the Matrix. Say something like make an empty list ListofVectors=[].

i=0

while i< m:

ListofVectors.append(M[i])

i+=1

Now doing

v1 in span(ListofVectors)

will give me true assuming v1 is in the span. However, is there a function that tells me what the coefficients are for each term. For example, the vector v1=[3,2,1] for the ListofVectors being [1,1,1], [1,0,0], and [0,1,0] should give me coefficients 1,2,1 respectively as 1[1,1,1] + 2[1,0,0] + 1*[0,1,0] gives [3,2,1].

click to hide/show revision 2
retagged

Checking what the span is for a vector

Let's assume I have a vector called v1 and I have a matrix called Matrix.

Let us assume that the vector is in the span of the rows of Matrix. How would I know what the linear combination is? Here is what I do know. Let's assume this is a m by n matrix. I do know there is the span function. So

I can do something like make a list of vectors out of the Matrix. Say something like make an empty list ListofVectors=[].

i=0

while i< m:

ListofVectors.append(M[i])

i+=1

Now doing

v1 in span(ListofVectors)

will give me true assuming v1 is in the span. However, is there a function that tells me what the coefficients are for each term. For example, the vector v1=[3,2,1] for the ListofVectors being [1,1,1], [1,0,0], and [0,1,0] should give me coefficients 1,2,1 respectively as 1[1,1,1] + 2[1,0,0] + 1*[0,1,0] gives [3,2,1].