On Tue, Dec 30, 2014 at 8:45 PM, Dan Drake <ddr...@math.wisc.edu> wrote:
> Hi,
>
> I'm teaching linear algebra and would like to automatically get a list
> of the row operations one can use to put a matrix into reduced row
> echelon form. So I coded up the usual algorithm:
>
> https://gist.github.com/dandrake/6fa2f03b5dff632706a9
>
> You can get a list of elementary matrices or a list of strings that
> describe what one does:
>
>     sage: A
>     [ 1  2  0 -2  0]
>     [ 1 -2  1 -2  0]
>     [-1  0  0 -2  0]
>     sage: rref_steps(A)
>     ['add $-1$ times row 1 to row 2',
>      'add $1$ times row 1 to row 3',
>      'scale row 2 by $-1/4$',
>      'add $-2$ times row 2 to row 1',
>      'add $-2$ times row 2 to row 3',
>      'scale row 3 by $2$',
>      'add $-1/2$ times row 3 to row 1',
>      'add $1/4$ times row 3 to row 2']
>     sage: prod(rref(A)) * A == A.rref()
>     True
>

Very useful, thanks!

>
> Just sharing. Enjoy.
>
> Dan
>
> --
> ---  Dan Drake
> -----  www.math.wisc.edu/~ddrake/
> -------
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-edu" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-edu+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-edu@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-edu.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-edu+unsubscr...@googlegroups.com.
To post to this group, send email to sage-edu@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-edu.
For more options, visit https://groups.google.com/d/optout.

Reply via email to