0

I have a sympy expression with two variables

exp = x*y

I want to evaluate this function with y = 1 (to return a new expression new_exp = x)

I could only find the evalf function in the doc but it's not working (returns new_exp = x*y)

e.evalf(subs={y:1})

Any idea on this?

Thanks!

hulyce
  • 438
  • 3
  • 15
  • did you read here https://stackoverflow.com/questions/15197673/using-pythons-eval-vs-ast-literal-eval – Beny Gj Apr 30 '20 at 14:02

1 Answers1

0

juste found out the sub function :

https://www.geeksforgeeks.org/python-sympy-subs-method-2/

doing exactly the job

hulyce
  • 438
  • 3
  • 15