In [35]:
f = open("stats.txt")

In [36]:
lin

In [37]:
lines


Out[37]:
['5 122\n',
 '50 1038\n',
 '100 3443\n',
 '200 11178\n',
 '500 91670\n',
 '1000 374056\n',
 '2000 2181069\n',
 '3000 5932163\n',
 '4000 11869356\n',
 '5000 21925123\n']

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]:
[[5, 122],
 [50, 1038],
 [100, 3443],
 [200, 11178],
 [500, 91670],
 [1000, 374056],
 [2000, 2181069],
 [3000, 5932163],
 [4000, 11869356],
 [5000, 21925123]]

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]:
[<matplotlib.lines.Line2D at 0x111d18630>]

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 [ ]: