Ask Your Question

jh's profile - activity

2016-04-02 20:43:54 +0200 received badge  Nice Question (source)
2015-08-06 15:50:20 +0200 received badge  Famous Question (source)
2013-11-17 18:10:59 +0200 received badge  Good Answer (source)
2013-10-15 18:47:16 +0200 received badge  Notable Question (source)
2013-01-27 17:54:36 +0200 received badge  Popular Question (source)
2012-04-06 16:27:04 +0200 commented answer How to show the steps of Gauss' method

That *is* a nice interact. BTW, in case you can use it and need an explicit statement, license is pd.

2012-04-06 00:41:44 +0200 received badge  Nice Answer (source)
2012-04-05 22:28:37 +0200 received badge  Teacher (source)
2012-04-05 22:28:37 +0200 received badge  Self-Learner (source)
2012-04-05 18:52:08 +0200 answered a question How to show the steps of Gauss' method

In case it saves anyone some time, I am using the following routine. Since this is for pedagogical purposes only, I restricted the matrices to rational entries. Bug reports welcome.

# Naive Gaussian reduction
def gauss_method(M,rescale_leading_entry=False):
    """Describe the reduction to echelon form of the given matrix of rationals.

    M  matrix of rationals   e.g., M = matrix(QQ, [[..], [..], ..])
    rescale_leading_entry=False  boolean  make the leading entries to 1's

    Returns: None.  Side effect: M is reduced.  Note: this is echelon form, 
    not reduced echelon form; this routine does not end the same way as does 

    print M    

    col = 0   # all cols before this are already done
    for row in range(0,num_rows): 
        # ?Need to swap in a nonzero entry from below
        while (col < num_cols
               and M[row][col] == 0): 
            for i in M.nonzero_positions_in_column(col):
                if i > row:
                    print " swap row",row+1,"with row",i+1
                    print M
                col += 1

        if col >= num_cols:

        # Now guaranteed M[row][col] != 0
        if (rescale_leading_entry
           and M[row][col] != 1):
            print " take",1/M[row][col],"times row",row+1
            print M
        for changed_row in range(row+1,num_rows):
            if M[changed_row][col] != 0:
                print " take",factor,"times row",row+1,"plus row",changed_row+1 
        if change_flag:
            print M
        col +=1
2012-04-01 13:10:49 +0200 commented question How to show the steps of Gauss' method

Thanks for the reply. It is for pedagogical purposes. I'll think about implementing it.

2012-03-31 17:04:18 +0200 received badge  Student (source)
2012-03-31 14:09:50 +0200 asked a question How to show the steps of Gauss' method

I am new to Sage, so I apologize if this is dopey. I can get a matrix in Sage and I can get its reduced echelon form. I can get Sage to show the result of a single Gauss' method row operation. But is there a way to get Sage do Gauss' method out to reduced echelon form, while showing the steps? It would be especially sweet if it showed the intermediate matrices.