Nouvelle organisation
This commit is contained in:
parent
42a01b33d1
commit
08ded37f21
BIN
caml/test.cmi
Normal file
BIN
caml/test.cmi
Normal file
Binary file not shown.
BIN
caml/test.cmx
Normal file
BIN
caml/test.cmx
Normal file
Binary file not shown.
1
caml/test.ml
Normal file
1
caml/test.ml
Normal file
@ -0,0 +1 @@
|
||||
print_int 1;;
|
BIN
caml/test.o
Normal file
BIN
caml/test.o
Normal file
Binary file not shown.
19
obligatoire/Cours/methodes numeriques
Executable file
19
obligatoire/Cours/methodes numeriques
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Fri Jan 10 09:17:36 2020
|
||||
|
||||
@author: suwako
|
||||
"""
|
||||
|
||||
import scipy
|
||||
import numpy as np
|
||||
def dichotomie(f, a, b, epsilon=1e-15):
|
||||
g, d = a, b
|
||||
while abs(g - d) > 2*epsilon:
|
||||
m = (g+d)/2.
|
||||
if f(g)*f(m) <= 0:
|
||||
d = m
|
||||
else:
|
||||
g = m
|
||||
return (g+d)/m
|
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 2.7 MiB |
BIN
obligatoire/TP4/TP4 codage.pdf
Normal file
BIN
obligatoire/TP4/TP4 codage.pdf
Normal file
Binary file not shown.
@ -41,8 +41,8 @@ def graphe_frequences(t0):
|
||||
|
||||
# 7:
|
||||
|
||||
def max(l):
|
||||
m=__builtins__.max(l)
|
||||
def Max(l):
|
||||
m=max(l)
|
||||
res=(m, [])
|
||||
for i, char in enumerate(l):
|
||||
if char == m:
|
||||
@ -53,7 +53,8 @@ def max(l):
|
||||
|
||||
def decodageAuto(t0):
|
||||
codes=[]
|
||||
for c in max(frequences(t0))[1]:
|
||||
print(Max(frequences(t0)))
|
||||
for c in Max(frequences(t0))[1]:
|
||||
codes.append(decodageCesar(t0, tr('e')[0]-c))
|
||||
return codes
|
||||
|
||||
@ -78,15 +79,14 @@ def pgcd(a, b):
|
||||
return a
|
||||
|
||||
# 4:
|
||||
|
||||
texte="""desfoisbonsoirlesenfantsjemecontentederepetercequejentendsparcequecestrigoloparcequemaintenantjefaispourbonetjesaispluscequejedisaisneamoinsjemeretrouveaecrireuntextesansespacessansapostrophessanscaracterespecialquelquuilsoitetcestunpeucomplexedesyretrouvercarlaponctuationestfortutileenfrancais"""
|
||||
def pgcdDesDistancesEntreRepetitions(l, i):
|
||||
ecarts=[]
|
||||
sec=l[i:i+3]
|
||||
g=i
|
||||
for j in range(g+1, len(l)-2):
|
||||
g=i+1
|
||||
for j in range(g, len(l)-2):
|
||||
if sec==l[j:j+3]:
|
||||
ecarts.append(j-g)
|
||||
g=j
|
||||
ecarts.append(j-i)
|
||||
print(ecarts)
|
||||
while len(ecarts)>1:
|
||||
ecarts[0]=pgcd(ecarts.pop(0), ecarts[0])
|
||||
@ -94,3 +94,10 @@ def pgcdDesDistancesEntreRepetitions(l, i):
|
||||
return ecarts[0]
|
||||
return 0
|
||||
|
||||
def longueurDeLaCle(l):
|
||||
k=0
|
||||
for i in range(len(l)-5):
|
||||
v=pgcdDesDistancesEntreRepetitions(l, i)
|
||||
if v:
|
||||
k=pgcd(k,v)
|
||||
return k
|
Loading…
Reference in New Issue
Block a user