Nouvelle organisation

This commit is contained in:
Suwako Moriya 2020-01-10 13:06:43 +01:00
parent 42a01b33d1
commit 08ded37f21
Signed by: SuwakoMmh
GPG Key ID: A27482B806F13CD5
35 changed files with 36 additions and 9 deletions

BIN
caml/bin Executable file

Binary file not shown.

BIN
caml/test.cmi Normal file

Binary file not shown.

BIN
caml/test.cmx Normal file

Binary file not shown.

1
caml/test.ml Normal file
View File

@ -0,0 +1 @@
print_int 1;;

BIN
caml/test.o Normal file

Binary file not shown.

View 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

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

View File

@ -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,19 +79,25 @@ 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])
if ecarts:
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