-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunction_graph.py
More file actions
28 lines (24 loc) · 815 Bytes
/
function_graph.py
File metadata and controls
28 lines (24 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import matplotlib.pyplot as plt
import numpy as np
n = int(input("Give me number of functions = "))
print("Give me the equation (If use numpy then use np.function r nato run korta hobe na) = ")
E = []
for i in range(n):
eq = input("f(%s)"%(i))
E.append(eq)
x1 = float(input("Give the lower limit of x = "))#2
x2 = float(input("Give the upper limit of x = "))#-2
y1 = float(input("Give the lower limit of y = "))#-1
y2 = float(input("Give the upper limit of y = "))#10
color = ['red','blue','green','black']
axes = plt.gca()
axes.set_ylim([y1,y2])
x = np.arange(x1,x2,0.001)
for i in range(n):
Y = eval(E[i])
plt.plot(x,Y,c=color[i],label='f(x) = %s'%E[i])
plt.legend(loc='best',prop={'size':12})
plt.xlabel("x")
plt.ylabel("functions")
plt.title(" General Functions")
plt.show()