Ask Your Question

Revision history [back]

It seems your matrix was defined with entries in Sage's symbolic ring.

Elements in the symbolic ring are symbolic expressions, which don't get automatically simplified.

One way to make the matrix more readable would be to think of it as a matrix whose entries are rational functions in E with coefficients in the real algebraic numbers.

Try this:

sage: Hf.change_ring(AA['E'].fraction_field())

It seems your matrix was defined with entries in Sage's symbolic ring.

Elements in the symbolic ring are symbolic expressions, which don't get automatically simplified.

One way to make the matrix more readable would be to think of it as a matrix whose entries are rational functions in E with coefficients in the real algebraic numbers.

Try this:

sage: Hf.change_ring(AA['E'].fraction_field())

If that does not work, then maybe rational functions in the (floating-point) "reals".

sage: Hf.change_ring(RR['E'].fraction_field())

It seems your matrix was defined with entries in Sage's symbolic ring.

Elements in the symbolic ring are symbolic expressions, which don't get automatically simplified.

One way to make the matrix more readable would be to think of it as a matrix whose entries are rational functions in E with coefficients in the real algebraic numbers.

Try this:

sage: Hf.change_ring(AA['E'].fraction_field())

If that does not work, then maybe rational functions in the (floating-point) "reals".

sage: Hf.change_ring(RR['E'].fraction_field())

Maybe the matrix was the following?

sage: Hf = matrix([
[(6.09052646594497e-6)*(𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒))/𝙴,
-0.000217613825100006*(𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)-𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒))/𝙴
+1000-0.000217613825100006*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))/𝙴
+(6.09052646594497e-6)*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)-𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))/𝙴,
0.000211523298634061*𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(1/18*𝚙𝚒)/𝙴],
[-0.000156250000000000*𝚜𝚚𝚛𝚝(2)*(𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)-𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒))*𝚌𝚘𝚜(1/18*𝚙𝚒)/𝙴
+(4.68750000000000e-6)*(𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒))*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)-𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))/𝙴,
-0.000156250000000000*𝚜𝚚𝚛𝚝(2)*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))*𝚌𝚘𝚜(1/18*𝚙𝚒)/𝙴
+(4.68750000000000e-6)*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)-𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))^2/𝙴,
-(4.68750000000000e-6)*𝚜𝚚𝚛𝚝(2)*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)-𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))*𝚌𝚘𝚜(1/18*𝚙𝚒)/𝙴
+0.000312500000000000*𝚌𝚘𝚜(1/18*𝚙𝚒)^2/𝙴],
[-0.000156250000000000*𝚜𝚚𝚛𝚝(2)*(𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)-𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒))*𝚌𝚘𝚜(1/18*𝚙𝚒)/𝙴
+(4.68750000000000e-6)*(𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒))*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))/𝙴,
-0.000156250000000000*𝚜𝚚𝚛𝚝(2)*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))*𝚌𝚘𝚜(1/18*𝚙𝚒)/𝙴
+(4.68750000000000e-6)*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)-𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))/𝙴,
-(4.68750000000000e-6)*𝚜𝚚𝚛𝚝(2)*(𝚜𝚚𝚛𝚝(2)*𝚜𝚒𝚗(7/36*𝚙𝚒)*𝚜𝚒𝚗(1/18*𝚙𝚒)+𝚜𝚚𝚛𝚝(2)*𝚌𝚘𝚜(7/36*𝚙𝚒))*𝚌𝚘𝚜(1/18*𝚙𝚒)/𝙴
+0.000312500000000000*𝚌𝚘𝚜(1/18*𝚙𝚒)^2/𝙴],
])

in which case rational functions over RR give:

sage: Hf.change_ring(RR['E'].fraction_field())
[                        6.16558207374834e-6/E (1000.00000000000*E - 0.000156202516960468)/E                        0.000294594522326585/E]
[                       0.000127914742222187/E                       -0.000277894374679915/E                        0.000309720283903677/E]
[                       0.000138909104469688/E                       -0.000288946039356407/E                        0.000294594522326585/E]

and rational functions over RDF give:

sage: Hf.change_ring(RDF['E'].fraction_field())
[              6.165582073748336e-06/E (1000.0*E - 0.00015620251696046755)/E               0.0002945945223265847/E]
[             0.00012791474222218708/E              -0.0002778943746799149/E              0.00030972028390367713/E]
[              0.0001389091044696876/E             -0.00028894603935640675/E              0.00029459452232658467/E]

Using a version of floating-point numbers with less bits (only 20 instead of the usual 53):

sage: Hf.change_ring(RealField(20)['E'].fraction_field())
[              6.1656e-6/E (1000.0*E - 0.00015620)/E              0.00029459/E]
[             0.00012791/E             -0.00027790/E              0.00030972/E]
[             0.00013891/E             -0.00028895/E              0.00029459/E]

Going down to 12 bits gives roughly three decimal digits as required in the question:

sage: Hf.change_ring(RealField(12)['E'].fraction_field())
[             6.17e-6/E (1000.*E - 0.000156)/E             0.000295/E]
[            0.000128/E            -0.000278/E             0.000310/E]
[            0.000139/E            -0.000289/E             0.000295/E]