Modules nécessaires : from time import time import matplotlib.pyplot as plt from random import randint def ecartMax(t): L_max_global = [] for i in range(len(t)): L_max_local = [] for j in range(i, len(t)): L_max_local.append(abs([t[i]-t[j]])) L_max_global.append(max(L_max_local)) return max(L_max_local) data = [randint(0, 20) for k in range(48)] Renvoie : [0, 4, 9, 12, 16, 1, 1, 4, 3, 20, 7, 11, 2, 0, 11, 4, 12, 6, 3, 4, 11, 8, 0, 14, 9, 9, 1, 8, 17, 18, 6, 19, 8, 8, 16, 0, 3, 18, 5, 12, 18, 3, 16, 10, 18, 16, 17, 16] TODO : faire la moyenne
Plus…Dernières publications
TP n°8 de physique
J’ai fait ce TP sous forme d’un script python. Télécharger le script ici. Renvoie une figure : import matplotlib.pyplot as plt import math Ue = [18.0, 17.9, 17.4, 16.3, 13.4, 13.1, 13.0, 12.8, 12.8, 12.8, 13.0, 13.2, 13.4, 13.8, 14.1, 14.7, 15.0, 15.2, 15.4] Us = [2.08, 2.88, 4.24, 6.64, 10.1, 10.4, 10.6, 10.6, 10.7, 10.6, 10.5, 10.3, 10.1, 9.84, 9.52, 8.88, 8.56, 8.22, 8.00] Ue = [20 * math.log(x) for x in Ue] Us = [20 * math.
Plus…Tutoriel python de Derek Banas
Here are some notes from a video about python from Derek Banas. I skipped parts that weren’t interesting for me. Max size sys.maxsize # get the maximum size of an integer sys.float_info.max # get the maximum size of a float Float are accurate up to 151515 digits. Complex numbers : real part +++ imaginary: cn1 = 4 + 3j Common maths functions abs(float) max(float, float) min(float, float) pow(float, float) # power round(float) With math: math.
Plus…