Print substituted expression without numerical evaluation

Viewed 61

Is it possible to print a substitute SymPy expression without calculation? I want to print both substituted express and result.

e.g.

x = Symbol('x')
expr = x**2
pprint(expr) # this prints expression
result = expr.subs({x:2}) 
print(result) # this print result 4

How can I print the "middle result", the expression 2**2?

1 Answers
Related