Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm a little confused here. If you enter a matrix with different types, it should just find the smallest 'ring' that contains all of them. Usually SR does the trick.

sage: M = matrix([[1,.9,1/5,x^2],[2,1.9,2/5,x^3],[3,2.9,3/5,x^4],[4,3.9,4/5,x^5]])
sage: type(M)<type 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
sage: M
[ 1.00000000000000 0.900000000000000 0.200000000000000               x^2]
[                2  1.90000000000000               2/5               x^3]
[                3  2.90000000000000               3/5               x^4]
[                4  3.90000000000000               4/5               x^5]
sage: latex(M)
\left(\begin{array}{rrrr}
1.00000000000000 & 0.900000000000000 & 0.200000000000000 & x^{2} \\
2 & 1.90000000000000 & \frac{2}{5} & x^{3} \\
3 & 2.90000000000000 & \frac{3}{5} & x^{4} \\
4 & 3.90000000000000 & \frac{4}{5} & x^{5}
\end{array}\right)

Am I misunderstanding the question somehow?

You'll note there is a bug revealed here; the first row for some reason coerces the numerical entries to RR (though not x^2), but the others don't. See Trac 12778.