\begin{Verbatim}[commandchars=\\\{\}]
\PY{c}{# Infinitesimal strain tensor}
\PY{k}{def} \PY{n+nf}{InfinitesimalStrain}\PY{p}{(}\PY{n}{u}\PY{p}{)}\PY{p}{:}
    \PY{k}{return} \PY{n}{variable}\PY{p}{(}\PY{l+m+mf}{0.5}\PY{o}{*}\PY{p}{(}\PY{n}{Grad}\PY{p}{(}\PY{n}{u}\PY{p}{)} \PY{o}{+} \PY{n}{Grad}\PY{p}{(}\PY{n}{u}\PY{p}{)}\PY{o}{.}\PY{n}{T}\PY{p}{)}\PY{p}{)}

\PY{c}{# Second order identity tensor}
\PY{k}{def} \PY{n+nf}{SecondOrderIdentity}\PY{p}{(}\PY{n}{u}\PY{p}{)}\PY{p}{:}
    \PY{k}{return} \PY{n}{variable}\PY{p}{(}\PY{n}{Identity}\PY{p}{(}\PY{n}{u}\PY{o}{.}\PY{n}{cell}\PY{p}{(}\PY{p}{)}\PY{o}{.}\PY{n}{d}\PY{p}{)}\PY{p}{)}

\PY{c}{# Deformation gradient}
\PY{k}{def} \PY{n+nf}{DeformationGradient}\PY{p}{(}\PY{n}{u}\PY{p}{)}\PY{p}{:}
    \PY{n}{I} \PY{o}{=} \PY{n}{SecondOrderIdentity}\PY{p}{(}\PY{n}{u}\PY{p}{)}
    \PY{k}{return} \PY{n}{variable}\PY{p}{(}\PY{n}{I} \PY{o}{+} \PY{n}{Grad}\PY{p}{(}\PY{n}{u}\PY{p}{)}\PY{p}{)}

\PY{c}{# Determinant of the deformation gradient}
\PY{k}{def} \PY{n+nf}{Jacobian}\PY{p}{(}\PY{n}{u}\PY{p}{)}\PY{p}{:}
    \PY{n}{F} \PY{o}{=} \PY{n}{DeformationGradient}\PY{p}{(}\PY{n}{u}\PY{p}{)}
    \PY{k}{return} \PY{n}{variable}\PY{p}{(}\PY{n}{det}\PY{p}{(}\PY{n}{F}\PY{p}{)}\PY{p}{)}

\PY{c}{# Right Cauchy-Green tensor}
\PY{k}{def} \PY{n+nf}{RightCauchyGreen}\PY{p}{(}\PY{n}{u}\PY{p}{)}\PY{p}{:}
    \PY{n}{F} \PY{o}{=} \PY{n}{DeformationGradient}\PY{p}{(}\PY{n}{u}\PY{p}{)}
    \PY{k}{return} \PY{n}{variable}\PY{p}{(}\PY{n}{F}\PY{o}{.}\PY{n}{T}\PY{o}{*}\PY{n}{F}\PY{p}{)}

\PY{c}{# Green-Lagrange strain tensor}
\PY{k}{def} \PY{n+nf}{GreenLagrangeStrain}\PY{p}{(}\PY{n}{u}\PY{p}{)}\PY{p}{:}
    \PY{n}{I} \PY{o}{=} \PY{n}{SecondOrderIdentity}\PY{p}{(}\PY{n}{u}\PY{p}{)}
    \PY{n}{C} \PY{o}{=} \PY{n}{RightCauchyGreen}\PY{p}{(}\PY{n}{u}\PY{p}{)}
    \PY{k}{return} \PY{n}{variable}\PY{p}{(}\PY{l+m+mf}{0.5}\PY{o}{*}\PY{p}{(}\PY{n}{C} \PY{o}{-} \PY{n}{I}\PY{p}{)}\PY{p}{)}


\end{Verbatim}
