Simple exercises have pedagogical advantages, but some disadvantages with respect to programming, because the programs may easily become too specialized. In such cases, the exercise may explicitly ask the student to divide the program into functions and make general mathematical methods available as general, reusable functions for a set of problems. This requirement can be motivated by an extended exercise where a piece of code are needed many times, typically that several methods are applied to several problems.

Especially when using Matlab, students may be too lazy to use functions when this is not explicitly required. The result is that testing becomes absent and that extensions to more complicated cases get more error-prone.

**Final remark.**
Linear algebra is an excellent example where the traditional mathematical
recipes (algorithms) taught in the standard linear algebra courses all over
the world are not compatible with how linear algebra calculations are
carried out in the real world. Students are drilled in computing
the inverse of \( 2\times 2 \) and \( 3\times 3 \) matrices, computing
determinants using co-factors, computing eigenvalues using the
characteristic polynomial, and so on. In the real world, however, golden
rules of linear algebra go instead as follows:

- Never compute the matrix inverse.
- Never compute a determinant using co-factors.
- Never compute eigenvalues using the characteristic polynomial.
- Never compute \( \det A \) to decide if \( A \) is approximately singular.
- Never compute the eigenvalues of \( A \) to determine whether it is symmetric positive definite. Rather compute the Cholesky factorization; if successful, \( A \) is symmetric and positive definite.
- Never compute \( A^TA \) when solving least squares problems.