Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Get a matrix to display answers as decimals/floats, not fraction?

I searched and couldn't find a viable solution:

I successfully executed the following:

ma = matrix([[25, 5, 1], [49, 7, 1], [81, 9, 1]])
mb = matrix([[1121], [626], [967]])
show(ma)
show(mb)
ms = ma^-1 * mb
show(ms)

Unfotunately though, the statement, show(ms), displays the answer/values as fractions, meaning I have to manually enter each of the value 3 separate times, as part of a float function, i.e., float(fraction/number).

How can I force show(ms), to display the values as decimals?

Also I find the matrix more readable/writable if I can enter each row's values by their own line, instead of the same line, as seen on the the, ma= & mb= statements. I remember I could this with ease in MatLab. I'd appreciate knowing how to that as well.

This post also has an unanswered question if anyone is up for the challenge, :P, j/k: http://ask.sagemath.org/question/2732/display-y-intercept