08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Matrices</strong> <strong>and</strong> <strong>Spaces</strong> <strong>of</strong> <strong>Matrices</strong>, Release 6.1.1<br />

sage: B = A.change_ring(CDF)<br />

sage: B.solve_left(b)<br />

(0.5 - 1.5*I, 0.5 + 0.5*I)<br />

solve_left_LU(b)<br />

Solve the equation Ax = b using LU decomposition.<br />

Warning: This function is broken. See trac 4932.<br />

INPUT:<br />

•self – an invertible matrix<br />

•b – a vector<br />

Note: This method precomputes <strong>and</strong> stores the LU decomposition before solving. If many equations <strong>of</strong><br />

the form Ax=b need to be solved for a singe matrix A, then this method should be used instead <strong>of</strong> solve.<br />

The first time this method is called it will compute the LU decomposition. If the matrix has not changed<br />

then subsequent calls will be very fast as the precomputed LU decomposition will be reused.<br />

EXAMPLES:<br />

sage: A = matrix(RDF, 3,3, [1,2,5,7.6,2.3,1,1,2,-1]); A<br />

[ 1.0 2.0 5.0]<br />

[ 7.6 2.3 1.0]<br />

[ 1.0 2.0 -1.0]<br />

sage: b = vector(RDF,[1,2,3])<br />

sage: x = A.solve_left_LU(b); x<br />

Traceback (most recent call last):<br />

...<br />

NotImplementedError: this function is not finished (see trac 4932)<br />

TESTS:<br />

We test two degenerate cases:<br />

sage: A = matrix(RDF, 0, 3, [])<br />

sage: A.solve_left_LU(vector(RDF,[]))<br />

(0.0, 0.0, 0.0)<br />

sage: A = matrix(RDF, 3, 0, [])<br />

sage: A.solve_left_LU(vector(RDF,3, [1,2,3]))<br />

()<br />

solve_right(b)<br />

Solve the vector equation A*x = b for a nonsingular A.<br />

INPUT:<br />

•self - a square matrix that is nonsigular (<strong>of</strong> full rank).<br />

•b - a vector <strong>of</strong> the correct size. Elements <strong>of</strong> the vector must coerce into the base ring <strong>of</strong> the coefficient<br />

matrix. In particular, if b has entries from CDF then self must have CDF as its base ring.<br />

OUTPUT:<br />

The unique solution x to the matrix equation A*x = b, as a vector over the same base ring as self.<br />

ALGORITHM:<br />

Uses the solve() routine from the SciPy scipy.linalg module.<br />

391

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!