In [35]:
f = open("stats.txt")
In [36]:
lin
In [37]:
lines
Out[37]:
In [38]:
x = [[int(el[0]), int(el[1])] for el in list(map(lambda x: x[:-1].split(" "), lines))]
In [39]:
x
Out[39]:
In [42]:
import matplotlib.pyplot as plt
In [55]:
plt.plot([a[0] for a in x], [a[1] for a in x], '-o')
Out[55]:
In [56]:
plt.show()
In [74]:
import matplotlib.pyplot as plt
def statistics(filename):
with open(filename) as f:
lines = f.readlines()
x = [[int(el[0]), int(el[1])] for el in list(map(lambda x: x[:-1].split(" "), lines))]
plt.plot([a[0] for a in x], [a[1] for a in x], '-o')
plt.ylabel("time (us)")
plt.xlabel("number of digits")
plt.title("Algorithm: " + filename.split(".")[0][6:])
plt.show()
In [75]:
statistics("stats_division.txt")
In [72]:
statistics("stats_factorization.txt")
In [73]:
statistics("stats_subtraction.txt")
In [ ]: