from sympy import pi, exp, limit, oo
from sympy.abc import x, y
print((1 + xy).subs({x:pi,y:2}))
print((1 + xy).subs([(x, pi),(y, 2)]))
reps_01 = {y:x**2, x:2}
reps_02 = [(y, x**2),(x,2)]
print((x + y).subs(reps_01))
print((x + y).subs(reps_02))
我是刚学习python,希望有了解的大神能给出解答!
祝园子里的朋友“五一”快乐!
看来reps_02 = [(y, x**2),(x,2)] 是比较注重顺序的,调换顺序成 [(x,2),(y, x**2)] 结果就不一样了。