Open Educational Resources

Mathematica Lab Tutorials: Lab 5

Lab Questions

Modify the code for the Cramer method so that it would give a warning message if the determinant of A is equal to zero. Otherwise, it proceeds with the solution. Test it and show that it works in both cases if the determinant is equal to zero or not.

Modify the code for the Gauss Elimination method so that it would give a warning message if a zero pivot is detected during elimination. Otherwise, it proceeds with the solution. Test it using two examples, one where the method finds a solution to a system of equations of n>3, and another where the warning message works when a zero pivot element is detected.

Bonus (2% of final grade): Modify the code for the Gauss Elimination method so that if a zero pivot is detected during elimination, the equations are re-ordered by picking the next row with non-zero element in the appropriate position, exchanging it with the current row and then continuing with the procedure. If no appropriate rows are found, a warning message is produced and the procedure is stopped. Test it using three examples, one example where no ordering is required, one example where ordering is required and another example where where the matrix A is not invertible (in this case the error message will be produced).

Video Tutorials

“Do” function, and “Insert” functions in Mathematica


Cramer’s Rule


Gauss Elimination


Leave a Reply

Your email address will not be published. Required fields are marked *