CoCalc -- Collaborative Calculation in the Cloud
Sharedsupport / 2015-03-07-063910-floating.sagewsOpen in CoCalc

Examples for support purposes...

reset()
RealNumber0 = RealNumber; RealNumber = lambda x : QQ(RealNumber0(x))
.3
3/10
.3333
3333/10000
n = matrix([ [-0.3, 0.2, 0.1],[0.2, -0.4, 0.4], [0.1, 0.2, -0.5] ])
n
[-3/10 1/5 1/10] [ 1/5 -2/5 2/5] [ 1/10 1/5 -1/2]
n.rank()
2


Their rational form is deceptive.

In Octave:

octave:1> format rat;
octave:2> a = [-86/17,40/29,-68/43,-20/11;-24/17,-1/38,-2/25,49/17]
a = -86/17 40/29 -68/43 -20/11 -24/17 -1/38 -2/25 49/17
octave:3> rref(a)
ans = 1 0 155/2122 -725/384 0 1 -152/173 -6553/795

In Matlab:
>> format rat;
>> a = [-86/17,40/29,-68/43,-20/11;-24/17,-1/38,-2/25,49/17]
a = -86/17 40/29 -68/43 -20/11 -24/17 -1/38 -2/25 49/17
>> rref(a)
ans = 1 0 13/178 -725/384 0 1 -152/173 -1426/173

sage: F = matrix(2,[-86/17, 40/29, -68/43, -20/11, -24/17, -1/38, -2/25, 49/17])
sage: F.rref()
[                 1                  0     306034/4189705     -404710/214357]
[                 0                  1 -18405604/20948525  -30037214/3644069]