Hello. How can I convert an expression to LaTex while substituting a variable value without evaluating the expression after substitution?
For example,
I have an expression 5*x*y
.
The latex(5*x*y)
is 5 \, x y
as expected.
But now I want to substitute a constant instead of a variable.
For example 8
instead of x
. The LaTex representation (latex((5*x*y).subs(x=8))
) of which is would be 40 \, y
, so the expression is automatically evaluated.
But I want get something like 5 \\cdot 8 y
instead.
Is that possible to do with sagemath?
I know something like that exists in SymPy. For example, take a look at this StackOverflow answer: stackoverflow.com/questions/49842196/substitute-in-sympy-wihout-evaluating-or-simplifying-the-expression.
It uses sympy.UnevaluatedExpr
to wrap an expression to substitude the variable with.
Is there anything like that in sagemath?