1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Is there a way in which a polynomial equation can be graphed via the input()?

Discussão em 'Python' iniciado por Stack, Setembro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I started learning Python a few months back (in 11th grade), and decided to test my knowledge by creating a miniature Graphing Calculator in Python. Using matplotlib.pyplot, I was able to graph basic trigonometric functions like sin(), cos() and tan(). I now wanted the user to enter a polynomial equation y(x), and then display the graph of the equation, but I am getting a Type Error.

    import matplotlib.pyplot as plt
    import numpy as np

    x = np.arange(-10, 10, 0.1)
    y = input("Enter polynomial equation in terms of y\ny = ")
    plt.plot(x, y)
    plt.show()

    Continue reading...

Compartilhe esta Página