Sympy:“在绘制的所有单变量表达式中都应使用相同的变量。”

时间:2019-08-06 22:13:20

标签: python-3.x sympy

我试图将V(\ phi)绘制为\ phi的函数,但是此错误阻止了我。我在做什么错了?

    from sympy import symbols
    from sympy.plotting import plot as symplot
    from sympy import varfrom sympy import plot_implicit, Eq

    V_phi, phi, lamb, mu = symbols(r'V \phi \lambda \mu')
    V_phi = mu*phi**2 + lamb*phi**4
    symplot(Eq(V_phi),(phi,-100,100))

错误:

    ValueError Traceback (most recent call last)
   <ipython-input-26-a4e0c44827e2> in <module>
           ----> 1 symplot(Eq(V_phi),(phi,-100,100))

   ~/Anaconda3/envs/Py37/lib/python3.7/sitepackages/sympy/plotting/plot.py in plot(*args, **kwargs)
   1351             if len(free) > 1:
   1352                 raise ValueError(
-> 1353                     'The same variable should be used in all '
   1354                     'univariate expressions being plotted.')
   1355     x = free.pop() if free else Symbol('x')

ValueError: The same variable should be used in all univariate expressions being plotted.

0 个答案:

没有答案