my matplotlib, within tkinter, wont plot. how do i solve this issue

  Kiến thức lập trình

im trying to get an equation to plot and nothing seems to work. it keeps giving me the error of: “float() argument must be a string or a real number, not ‘function'” when i try to use lambdify() and when i try to use a simply y = x**2 + 4 (or any other equation) it gives me the error of “Cannot convert expression to float”

i tried:

from sympy import symbols, Derivative, sympify, lambdify
import matplotlib.pyplot as plt
x, y = symbols("x y")
expr = x**2 + 4
x = lambdify(x, expr, 'math')
plt.plot(x)
plt.show()

i also tried:

from sympy import symbols, Derivative, sympify, lambdify
import matplotlib.pyplot as plt
x, y = symbols("x y")
y = x**2 + 4*x + 4
plt.plot(x,y)
plt.show

New contributor

Biggiecheese is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT