Plot a graph using Python Plot the graph of f(x) = x**2 in [-5,5]

 Plot a graph using Python graph  plot the graph of f(x) = x**2 in [-5,5]

plot the graph of f(x) = x**2 in [-5,5]


In this program, we are polt a graph using python

The program is divide into 3 step


Step1:-- import  python package  using 

from pylab import *
import numpy as np


Step2 :-  assign the value of  x  and  function

= np.linspace(-55100)
= x**2


Step3 :-  Plot  the graph and show it using plot() , show function

# plot the graph
plot(x, f)
# show output/ graph
show()


Complete program


# plot the graph of f(x) = x**2 in [-5,5]
from pylab import *
import numpy as np
= np.linspace(-55100)
# write a function
= x**2
# plot the graph
plot(x, f)
# show output/ graph
show()


Output

Post a Comment

0 Comments