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:
|
# 7:
|
||||||
|
|
||||||
def max(l):
|
def Max(l):
|
||||||
m=__builtins__.max(l)
|
m=max(l)
|
||||||
res=(m, [])
|
res=(m, [])
|
||||||
for i, char in enumerate(l):
|
for i, char in enumerate(l):
|
||||||
if char == m:
|
if char == m:
|
||||||
@ -53,7 +53,8 @@ def max(l):
|
|||||||
|
|
||||||
def decodageAuto(t0):
|
def decodageAuto(t0):
|
||||||
codes=[]
|
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))
|
codes.append(decodageCesar(t0, tr('e')[0]-c))
|
||||||
return codes
|
return codes
|
||||||
|
|
||||||
@ -78,15 +79,14 @@ def pgcd(a, b):
|
|||||||
return a
|
return a
|
||||||
|
|
||||||
# 4:
|
# 4:
|
||||||
|
texte="""desfoisbonsoirlesenfantsjemecontentederepetercequejentendsparcequecestrigoloparcequemaintenantjefaispourbonetjesaispluscequejedisaisneamoinsjemeretrouveaecrireuntextesansespacessansapostrophessanscaracterespecialquelquuilsoitetcestunpeucomplexedesyretrouvercarlaponctuationestfortutileenfrancais"""
|
||||||
def pgcdDesDistancesEntreRepetitions(l, i):
|
def pgcdDesDistancesEntreRepetitions(l, i):
|
||||||
ecarts=[]
|
ecarts=[]
|
||||||
sec=l[i:i+3]
|
sec=l[i:i+3]
|
||||||
g=i
|
g=i+1
|
||||||
for j in range(g+1, len(l)-2):
|
for j in range(g, len(l)-2):
|
||||||
if sec==l[j:j+3]:
|
if sec==l[j:j+3]:
|
||||||
ecarts.append(j-g)
|
ecarts.append(j-i)
|
||||||
g=j
|
|
||||||
print(ecarts)
|
print(ecarts)
|
||||||
while len(ecarts)>1:
|
while len(ecarts)>1:
|
||||||
ecarts[0]=pgcd(ecarts.pop(0), ecarts[0])
|
ecarts[0]=pgcd(ecarts.pop(0), ecarts[0])
|
||||||
@ -94,3 +94,10 @@ def pgcdDesDistancesEntreRepetitions(l, i):
|
|||||||
return ecarts[0]
|
return ecarts[0]
|
||||||
return 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