Ask Your Question

Revision history [back]

\documentclass[a4paper]{article}

\usepackage{amsmath}
\usepackage{sagetex}

\newcommand{\tension}{\operatorname{tension}}

\begin{document}
\pagestyle{empty}

\begin{sagesilent}
tension(lambda_z, s_k) = lambda_z * s_k
lambda_za = 5
s_ka = 4
s = str(tension(lambda_z,s_k))
ss = s.replace('lambda_z','\lambda_z')
sss = s.replace('lambda_z',str(lambda_za)).replace('s_k',str(s_ka))
\end{sagesilent}

Evaluating the function
$$\tension : \sage{tension}$$
at the values
$$\lambda_z = \sage{lambda_za},\quad s_k = \sage{s_ka},$$
step by step:
$$\tension(\lambda_z,s_k) = \sagestr{ss} = \sagestr{sss} = 
\sage{tension(lambda_za,s_ka)}.$$

\end{document}