Question: Can anyone help me write a procedure to solve a system of equations in Maple 15?

Can anyone help me write a procedure for Maple 15 that does the following:

INPUT: number of unknowns and equations n; augmented matrix A=[aij], where 1<=i<=n and 1<=j<=n+1.
OUTPUT: solution x[1], x[2], ... , x[n] or message that the linear system has no unique solution.

Step 1: For i=1,...,n-1 do steps 2-4.  # Elimination process.

Step 2: Let p be the smallest integer with i<=p<=n and A[p,i]≠0.
           If no integer p can be found then OUTPUT ('no unique solution exists');

           STOP.

Step 3: if p≠i then perform (E[p]↔E[i])  # interchange row p with row i.

Step 4: For j=i+1, ... , n do steps 5 and 6.

    Step 5: set m[j,i]=A[j,i]/A[i,i]

    Step 6: Perform (E[j]-m[j,i]*E[i])→E[j];  #row j minus m[j,i] times row i replaces row j.

Step 7: If A[n,n]=0 then OUTPUT ('no unique solution exists');

           STOP.

Step 8: Set x[n]=A[n,n+1]/A[n,n]   #start backward substitution.

Step 9: For i=n-1, ... , 1 set x[i]=(A[i,n+1]-sum(A[i,j]*x[j],j=i+1..n)/A[i,i]

Step 10: OUTPUT (x[1], x[2], ... , x[n]);   #procedure completed successfully.

             STOP.

 

I know that Maple will do this using with(LinearAlgebra) and ReducedRowEchelonForm(A), but I want to learn how to write procedures on my own, and since I have no programming experience I can't figure out how this works. Any help would be greatly appreciated.

Thanks,

Please Wait...