Show graph of equation using python

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Matplotlib makes easy things ...

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Matplotlib makes easy things easy and hard things possible.

  • Create publication quality plots.
  • Make interactive figures that can zoom, pan, update.
  • Customize visual style and layout.
  • Export to many file formats.
  • Embed in JupyterLab and Graphical User Interfaces.
  • Use a rich array of third-party packages built on Matplotlib.

The tokenize module provides a lexical scanner for Python source code, implemented in Python. The scanner in this module returns comments as tokens as well, making it useful for implementing “pretty-printers”, including colorizers for on-screen displays.
# General Linear Equation : y = mx + c
# General Quadratic Equation  : y = ax^2 + bx + c
# General Cubic Equation : y = ax^3 + bx^2 + cx + d
# """
from tokenize import PlainToken
import matplotlib.pyplot as plt
# def linearEquation(xmin, xmax, m, c):
def linearEquation(xmin, xmax):
    y=[]
    for i in range(xmin, xmax + 1):
        # y = m * i + c
        a = 2*i + 2
        y.append(a)
    return y

# def quadraticEquation(xmin, xmax, a, b, c):
def quadraticEquation(xmin, xmax):
    y=[]
    for i in range(xmin, xmax + 1):
        # y = a * (i ** 2) + b * i + c
        a = i ** 2 + 2*i +1
        y.append(a)
    return y

# def cubicEquation(xmin, xmax, a, b, c, d):
def cubicEquation(xmin, xmax):
    y=[]
    for i in range(xmin, xmax + 1):
        # y = a * (i ** 3) + b * (i ** 2) + c * i + d
        a = 2*i ** 3 + i ** 2 + 3*i + 7
        y.append(a)
    return y

def graphGenerate():
    xmin = int(input("Enter xmin : "))
    xmax = int(input("Enter xmax : "))
    ylin = linearEquation(xmin, xmax)
    yquad =quadraticEquation(xmin,xmax)
    ycub = cubicEquation(xmin,xmax)
    x = []
    for i in range (xmin,xmax+1):
        x.append(i)
   

    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1)
    ax.spines['left'].set_position('center')
    ax.spines['bottom'].set_position('zero')
    ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')
    ax.xaxis.set_ticks_position('bottom')
    ax.yaxis.set_ticks_position('left')  
    plt.plot(x,ylin)
    plt.plot(x,yquad)
    plt.plot(x,ycub)
    plt.title("hlo kx")
    plt.yscale('linear')
    plt.xlabel('x')
    plt.ylabel('y')
    plt.show()

if __name__=='__main__':
    graphGenerate()
For other code you can check our github also.

COMMENTS

Name

Accident Alert,1,AI,2,Array,1,Aurdino,1,C,2,Computer Graphics,9,Data Science,3,Dataset,1,Decoratot,1,Django,1,ESP32,1,Fixed point/iteration method,1,Greater or smaller,1,html,1,Image Processing,1,JAVA,1,Javascript,22,Machine Learning,1,Matlab,3,Numerical Method,13,OOP,1,Other,3,PHP,1,Point operation,1,Python,11,Raspberry pi,1,Recommendation System,1,Regression,1,Reservation System,1,Robotics,1,Simulation,2,sine wave,1,String Handling Function,1,Web scrap,1,Webpage,1,
ltr
item
COMPUTER PROGRAMMING: Show graph of equation using python
Show graph of equation using python
COMPUTER PROGRAMMING
https://computerprogram4ru.blogspot.com/2022/07/show-graph-of-equation-using-python.html
https://computerprogram4ru.blogspot.com/
https://computerprogram4ru.blogspot.com/
https://computerprogram4ru.blogspot.com/2022/07/show-graph-of-equation-using-python.html
true
8672391763020279633
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy