How to resolve the algorithm Reduced row echelon form step by step in the Maxima programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Reduced row echelon form step by step in the Maxima programming language

Table of Contents

Problem Statement

Show how to compute the reduced row echelon form (a.k.a. row canonical form) of a matrix. The matrix can be stored in any datatype that is convenient (for most languages, this will probably be a two-dimensional array). Built-in functions or this pseudocode (from Wikipedia) may be used: For testing purposes, the RREF of this matrix: is:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Reduced row echelon form step by step in the Maxima programming language

Source code in the maxima programming language

rref(a):=block([p,q,k],[p,q]:matrix_size(a),a:echelon(a),
    k:min(p,q),
    for i thru min(p,q) do (if a[i,i]=0 then (k:i-1,return())),
    for i:k thru 2 step -1 do (for j from i-1 thru 1 step -1 do a:rowop(a,j,i,a[j,i])),
    a)$

a: matrix([12,-27,36,44,59],
          [26,41,-54,24,23],
          [33,70,59,15,-68],
          [43,16,29,-52,-61],
          [-43,20,71,88,11])$

rref(a);
matrix([1,0,0,0,1/2],[0,1,0,0,-1],[0,0,1,0,-1/2],[0,0,0,1,1],[0,0,0,0,0])


  

You may also check:How to resolve the algorithm SHA-1 step by step in the Liberty BASIC programming language
You may also check:How to resolve the algorithm Disarium numbers step by step in the BCPL programming language
You may also check:How to resolve the algorithm Monty Hall problem step by step in the 8086 Assembly programming language
You may also check:How to resolve the algorithm Sorting algorithms/Insertion sort step by step in the zkl programming language
You may also check:How to resolve the algorithm Elementary cellular automaton/Random number generator step by step in the Go programming language