Plot a graph using Python plot the graph of g(x)=1+2x^2+3x^3+4x^4 in [-10,10].
Plot the graph of g(x)=1+2x^2+3x^3+4x^4 in [-10,10].
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
x = np.linspace(-10, 10, 50)
# 1+2x ^ 2+3x ^ 3+4x ^ 4
g = 1+2*x**2+3*x**3+4*x**4
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 g(x)=1+2x^2+3x^3+4x^4 in [-10,10].
from pylab import *
import numpy as np
x = np.linspace(-10, 10, 50)
# 1+2x ^ 2+3x ^ 3+4x ^ 4
g = 1+2*x**2+3*x**3+4*x**4
plot(x, g)
show()
Output
0 Comments