DLA Sage Tutorials
Skip to main content \(\require{cancel}\DeclareMathOperator{\RREF}{RREF}
\DeclareMathOperator{\adj}{adj}
\DeclareMathOperator{\proj}{proj}
\DeclareMathOperator{\matrixring}{M}
\DeclareMathOperator{\poly}{P}
\DeclareMathOperator{\Span}{Span}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\nullity}{nullity}
\DeclareMathOperator{\null}{null}
\DeclareMathOperator{\uppermatring}{U}
\DeclareMathOperator{\trace}{trace}
\DeclareMathOperator{\dist}{dist}
\DeclareMathOperator{\neg}{neg}
\DeclareMathOperator{\Hom}{Hom}
\DeclareMathOperator{\im}{im}
\newcommand{\basisfont}[1]{\mathcal{#1}}
\newcommand{\bbrac}[1]{\bigl(#1\bigr)}
\newcommand{\Bbrac}[1]{\Bigl(#1\Bigr)}
\newcommand{\irst}[1][1]{{#1}^{\mathrm{st}}}
\newcommand{\ond}[1][2]{{#1}^{\mathrm{nd}}}
\newcommand{\ird}[1][3]{{#1}^{\mathrm{rd}}}
\newcommand{\nth}[1][n]{{#1}^{\mathrm{th}}}
\newcommand{\leftrightlinesubstitute}{\scriptstyle \overline{\phantom{xxx}}}
\newcommand{\inv}[2][1]{{#2}^{-{#1}}}
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}
\newcommand{\degree}[1]{{#1}^\circ}
\newcommand{\iddots}{{\kern3mu\raise1mu{.}\kern3mu\raise6mu{.}\kern3mu \raise12mu{.}}}
\newcommand{\blank}{-}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\ci}{\mathrm{i}}
\newcommand{\cconj}[1]{\bar{#1}}
\newcommand{\lcconj}[1]{\overline{#1}}
\newcommand{\cmodulus}[1]{\left\lvert #1 \right\rvert}
\newcommand{\iso}{\simeq}
\newcommand{\abctriangle}[1]{\triangle #1}
\newcommand{\mtrxvbar}{\mathord{|}}
\newcommand{\utrans}[1]{{#1}^{\mathrm{T}}}
\newcommand{\rowredarrow}{\xrightarrow[\text{reduce}]{\text{row}}}
\newcommand{\bidentmatfour}{\begin{bmatrix} 1 \amp 0 \amp 0 \amp 0 \\ 0 \amp 1 \amp 0 \amp 0 \\ 0 \amp 0 \amp 1 \amp 0 \\ 0 \amp 0 \amp 0 \amp 1\end{bmatrix}}
\newcommand{\uvec}[1]{\mathbf{#1}}
\newcommand{\zerovec}{\uvec{0}}
\newcommand{\bvec}[2]{#1\,\uvec{#2}}
\newcommand{\ivec}[1]{\bvec{#1}{i}}
\newcommand{\jvec}[1]{\bvec{#1}{j}}
\newcommand{\kvec}[1]{\bvec{#1}{k}}
\newcommand{\injkvec}[3]{\ivec{#1} - \jvec{#2} + \kvec{#3}}
\newcommand{\abray}[1]{\overrightarrow{#1}}
\newcommand{\norm}[1]{\left\lVert #1 \right\rVert}
\newcommand{\unorm}[1]{\norm{\uvec{#1}}}
\newcommand{\bigcdot}{\mathbin{\large\boldsymbol{\cdot}}}
\newcommand{\dotprod}[2]{#1\bigcdot#2}
\newcommand{\udotprod}[2]{\dotprod{\uvec{#1}}{\uvec{#2}}}
\newcommand{\crossprod}[2]{#1\times#2}
\newcommand{\ucrossprod}[2]{\crossprod{\uvec{#1}}{\uvec{#2}}}
\newcommand{\uproj}[2]{\proj_{\uvec{#2}} \uvec{#1}}
\newcommand{\adjoint}[1]{{#1}^\ast}
\newcommand{\matrixOfplain}[2]{{\left[#1\right]}_{#2}}
\newcommand{\rmatrixOfplain}[2]{{\left(#1\right)}_{#2}}
\newcommand{\rmatrixOf}[2]{\rmatrixOfplain{#1}{\basisfont{#2}}}
\newcommand{\matrixOf}[2]{\matrixOfplain{#1}{\basisfont{#2}}}
\newcommand{\invmatrixOfplain}[2]{\inv{\left[#1\right]}_{#2}}
\newcommand{\invrmatrixOfplain}[2]{\inv{\left(#1\right)}_{#2}}
\newcommand{\invmatrixOf}[2]{\invmatrixOfplain{#1}{\basisfont{#2}}}
\newcommand{\invrmatrixOf}[2]{\invrmatrixOfplain{#1}{\basisfont{#2}}}
\newcommand{\stdmatrixOf}[1]{\left[#1\right]}
\newcommand{\ucobmtrx}[2]{P_{\basisfont{#1} \to \basisfont{#2}}}
\newcommand{\uinvcobmtrx}[2]{\inv{P}_{\basisfont{#1} \to \basisfont{#2}}}
\newcommand{\uadjcobmtrx}[2]{\adjoint{P}_{\basisfont{#1} \to \basisfont{#2}}}
\newcommand{\coordmapplain}[1]{C_{#1}}
\newcommand{\coordmap}[1]{\coordmapplain{\basisfont{#1}}}
\newcommand{\invcoordmapplain}[1]{\inv{C}_{#1}}
\newcommand{\invcoordmap}[1]{\invcoordmapplain{\basisfont{#1}}}
\newcommand{\similar}{\sim}
\newcommand{\inprod}[2]{\left\langle\, #1,\, #2 \,\right\rangle}
\newcommand{\uvecinprod}[2]{\inprod{\uvec{#1}}{\uvec{#2}}}
\newcommand{\orthogcmp}[1]{{#1}^{\perp}}
\newcommand{\vecdual}[1]{{#1}^\ast}
\newcommand{\vecddual}[1]{{#1}^{\ast\ast}}
\newcommand{\dd}[2]{\frac{d{#1}}{d#2}}
\newcommand{\ddx}[1][x]{\dd{}{#1}}
\newcommand{\ddt}[1][t]{\dd{}{#1}}
\newcommand{\dydx}{\dd{y}{x}}
\newcommand{\dxdt}{\dd{x}{t}}
\newcommand{\dydt}{\dd{y}{t}}
\newcommand{\intspace}{\;}
\newcommand{\integral}[4]{\int^{#2}_{#1} #3 \intspace d{#4}}
\newcommand{\funcdef}[3]{#1\colon #2\to #3}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\)
Appendix B Sage Tutorials
All of the example commands in these tutorials can be run
in a Sage session locally on your computer,
in a Sage notebook locally on your computer,
in a Sage notebook on CoCalc (you can link a free account to your Google account if you want to be able to save your work or you can just run an “evaluation” session), or
just in an online sage cell .
Some further notes:
If you are using the online Sage cell, you will only get output for your last command. To get multiple outputs in one go, use the print
command.
One advantage of using a Sage session locally on your computer is that you don't have to remember full commands — you can use tab completion to search for likely commands. For example, if \(A\) is a matrix and you want to compute its characteristic polynomial, you might try the partial command A.char
in the Sage command interpreter and hit the tab key. The Sage interpreter will then prompt you with likely commands that start with char
and can be applied to a matrix.