Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to substitude a value into an expression without evaluation to convert it to LaTex?

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?

How to substitude a value into an expression without evaluation to convert it to LaTex?

Hello. How can I convert an expression to LaTex while substituting a variable value 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 to get something like 5 \\cdot 8 y instead. Is that possible to do with sagemath?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.
the answer to:

It uses sympy.UnevaluatedExpr to wrap an expression to substitude substitute the variable with. Is there anything like that in sagemath?SageMath?

How to substitude a value into an expression without evaluation to convert it to LaTex?

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 to 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 the answer to:

It uses sympy.UnevaluatedExpr to wrap an expression to substitute the variable with. Is there anything like that in SageMath?