#!/bin/python3

from random import randint
from math   import log
import time
import matplotlib.pyplot as plt

import argument as arg

def   euclide( a, b  ) :
   nbi = 0
   while  b > 0 :
      r = a % b
      a = b
      b = r
      nbi+= 1
   return nbi

arg.cmdline()

print( 'r=', arg.repetition, 'i=',arg.iteration )
x = []
y = []
z = []
t = []

A = 1E-12/3
B = 4*1E-11
for i in  range(2 , arg.iteration  , 500  ) :
    n = i
    a = randint( 1 << (n-1) , 1 << n ) 
    b = randint( 1 << (n-1) , 1 << n ) 
    deb = time.process_time()
    p = a*b
    fin = time.process_time()
    x.append( n )
    z.append( A*n*n   )
    y.append( B*n**1.5 )
    t.append( fin - deb )

plt.title("complexité multiplication python")
plt.ylabel('temps')
plt.xlabel('n')
plt.plot(x, y, label="B*n**1.5")
plt.plot(x, z, label="A*n*n")
plt.plot(x, t, label="temps")
plt.legend()
plt.grid(True)

plt.show()
plt.close()


