- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfirstgraph.py
More file actions
Latest commit
20 lines (16 loc) · 446 Bytes
/
Copy pathfirstgraph.py
File metadata and controls
20 lines (16 loc) · 446 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
importnumpyasnp
frommatplotlibimportpyplotasplt
importnumpyasnp
deffound_fit(x):
return0.388*x**2
x_data=list(range(10))
y_data= [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
x_func=np.linspace(0, 10, 50)
y_func=found_fit(x_func)
plt.scatter(x_data, y_data, c="r", label='data')
plt.plot(x_func, y_func, label='$f(x) = 0.388 x^2$')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Fitting primes')
plt.legend()
print(plt.show())