Section 1.6 Computations With SageMath
SageMath is a powerful, free, and open-source mathematical software system built on the Python programming language. It integrates numerous specialized mathematical software packages into a common interface, providing capabilities for symbolic computation, numerical analysis, algebra, calculus, and much more. SageMath is particularly well-suited for linear algebra, offering efficient implementations of matrix operations, solving systems of equations, computing eigenvalues and eigenvectors, and performing various matrix decompositions. Its interactive environment allows students and researchers to experiment with mathematical concepts, visualize results, and verify theoretical calculations with computational evidence.
In this course, mastering SageMath is essential because the practical applications of linear algebra are deeply dependent on computational ability. While understanding the theoretical foundations is crucial, real-world problems in engineering, data science, machine learning, computer graphics, and scientific computing often involve matrices with hundreds or thousands of rows and columns—far too large for hand calculation. SageMath bridges the gap between theory and practice, enabling you to tackle realistic problems efficiently. By learning to use SageMath alongside the mathematical concepts, you will develop both the theoretical understanding and the computational skills necessary to apply linear algebra effectively in your future studies and career. This dual competency—knowing why methods work mathematically and how to implement them computationally—is what makes linear algebra such a powerful and practical tool in modern applications.
Subsection 1.6.1 How to input a regular matrix
Example: Input the matrix below to the SageMath cell.
\begin{equation*}
\begin{pmatrix}
0 & 2 & -8 & 8 \\
1 & -2 & 1 & 0 \\
5 & 0 & -5 & 10
\end{pmatrix}
\end{equation*}
Exercise: Input the matrix below to the SageMath cell.
\begin{equation*}
\begin{pmatrix}
0 & 3 & -6 & 6 & 4 & -5 \\
3 & -7 & 8 & -5 & 8 & 9 \\
3 & -9 & 12 & -9 & 6 & 15
\end{pmatrix}
\end{equation*}
Subsection 1.6.2 How to input a matrix with variables
In SageMath, the variable \(x\) is automatically variable. All the others must be declared.
Example: Input the matrix below to the SageMath cell.
\begin{equation*}
\begin{pmatrix}
a & 1\\
3 & x
\end{pmatrix}
\end{equation*}
This example is extremely important in this course.
