Ask Your Question
1

.rref() over the reals?

asked 2022-04-13 17:17:15 +0200

mouss5ss gravatar image

Hi everyone,

I just discovered sage and was trying to obtain the reduced echelon form of a real augmented matrix with the following code:

A = matrix(RR,[[27.6, 30.2], [3100, 6400], [250, 360]]);
B = column_matrix(RR, [162 , 23610, 1623]);
C = A.augment(B, subdivide = True);
C.rref();

The output is the identity matrix:

[1.0 0.0|0.0]
[0.0 1.0|0.0]
[0.0 0.0|1.0]

This is not right over the reals, as A\B yields

[3.90000000000000]
[1.80000000000000]

Is there any way I obtain the correct output with rref(), that is

[ 1.00000000000000 0.000000000000000| 3.90000000000000]
[0.000000000000000  1.00000000000000| 1.80000000000000]
[0.000000000000000 0.000000000000000|0.000000000000000]
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-04-13 17:31:09 +0200

mouss5ss gravatar image

I found the answer, simply using QQ and getting back to RR does the trick:

A = matrix([[27.6, 30.2], [3100, 6400], [250, 360]]);
B = vector([162 , 23610, 1623]);
C = A.augment(B, subdivide = True);
C.change_ring(QQ).rref().change_ring(RR);
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2022-04-13 16:59:51 +0200

Seen: 22 times

Last updated: Apr 13