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: C = SymmetricGroup(5).character_table()<br />

sage: C.base_ring()<br />

Cyclotomic Field <strong>of</strong> order 1 <strong>and</strong> degree 1<br />

sage: P, L, U = C.LU(pivot=’partial’)<br />

sage: C == P*L*U<br />

True<br />

AUTHOR:<br />

•Rob Beezer (2011-04-26)<br />

N(prec=None, digits=None)<br />

Return a numerical approximation <strong>of</strong> self as either a real or complex number with at least the requested<br />

number <strong>of</strong> bits or digits <strong>of</strong> precision.<br />

INPUT:<br />

•prec - an integer: the number <strong>of</strong> bits <strong>of</strong> precision<br />

•digits - an integer: digits <strong>of</strong> precision<br />

OUTPUT: A matrix coerced to a real or complex field with prec bits <strong>of</strong> precision.<br />

EXAMPLES:<br />

sage: d = matrix([[3, 0],[0,sqrt(2)]]) ;<br />

sage: b = matrix([[1, -1], [2, 2]]) ; e = b * d * b.inverse();e<br />

[ 1/2*sqrt(2) + 3/2 -1/4*sqrt(2) + 3/4]<br />

[ -sqrt(2) + 3 1/2*sqrt(2) + 3/2]<br />

sage: e.numerical_approx(53)<br />

[ 2.20710678118655 0.396446609406726]<br />

[ 1.58578643762690 2.20710678118655]<br />

sage: e.numerical_approx(20)<br />

[ 2.2071 0.39645]<br />

[ 1.5858 2.2071]<br />

sage: (e-I).numerical_approx(20)<br />

[2.2071 - 1.0000*I 0.39645]<br />

[ 1.5858 2.2071 - 1.0000*I]<br />

sage: M=matrix(QQ,4,[i/(i+1) for i in range(12)]);M<br />

[ 0 1/2 2/3]<br />

[ 3/4 4/5 5/6]<br />

[ 6/7 7/8 8/9]<br />

[ 9/10 10/11 11/12]<br />

sage: M.numerical_approx()<br />

[0.000000000000000 0.500000000000000 0.666666666666667]<br />

[0.750000000000000 0.800000000000000 0.833333333333333]<br />

[0.857142857142857 0.875000000000000 0.888888888888889]<br />

[0.900000000000000 0.909090909090909 0.916666666666667]<br />

sage: matrix(SR, 2, 2, range(4)).n()<br />

[0.000000000000000 1.00000000000000]<br />

[ 2.00000000000000 3.00000000000000]<br />

sage: numerical_approx(M)<br />

[0.000000000000000 0.500000000000000 0.666666666666667]<br />

[0.750000000000000 0.800000000000000 0.833333333333333]<br />

126 Chapter 7. Base class for matrices, part 2

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

Saved successfully!

Ooh no, something went wrong!