How to substitute multiple symbols in an expression in sympy?

后端 未结 3 1596
我寻月下人不归
我寻月下人不归 2020-12-11 00:38

Assigning a variable directly does not modify expressions that used the variable retroactively.

>>> from sympy import Symbol
>>> x = Symbol         


        
3条回答
  •  长情又很酷
    2020-12-11 01:13

    Actually sympy is designed not to substitute values until you really want to substitute them with subs (see http://docs.sympy.org/latest/tutorial/basic_operations.html)

    Try

    f.subs({x:0})
    f.subs(x, 0) # as alternative
    

    instead of

    x = 0
    

提交回复
热议问题