


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Question 1:
On retrouve la méthode d'Euler pour (α,β) = (1,0)
Question 2:
def Heun (f,t0,y0,T,N) : t,h,y = t0,T/N,y tt,yh = [t0],[y0] while t <= t0+T : y += (h/2)(f(t,y)+f(t+h,y+(hf(t,y)))) t += h tt.append(t) yh.append(y) return tt,yh
Question 3:
def Euler (f,t0,y0,T,N) : t,h,y = t0,T/N,y tt,yh = [t0],[y0] while t <= t0+T : y += h*(f(t,y) t += h tt.append(t) yh.append(y) return tt,yh
Question 4 :
La complexité de la fonction Euler : O(N)
Question 5 :
y 0 (t) = y 1 (t) y 1 ’(t)= - 4π²cos(2πt)-y 1 (t)-y 0 (t)
Question 6 :
F(t,X) = (X[1] , - 4π²cos(2πt)-X[1]-X[0])
Question 7 :
Question 8 :
def indice(c,ch) : for i in range(len(ch)) : if ch[i] == c : return i return - 1 # n’existe pas
def enMajuscule (CH) : alphabet_min = 'abcdefghijklmnopqrstuvwxyzâàéèêëïîôùûüÿç' alphabet_maj = 'ABCDEFGHIJKLMNOPQRSTUVWXYZAAEEEEIIOUUUYC' s = '' for c in CH : i = indice(c,alphabet_min) if i != -1 : s += alphabet_maj[i] else : s += c return s
Question 9 :
def majusculesSeules (CH) : alphabet_min = 'abcdefghijklmnopqrstuvwxyzâàéèêëïîôùûüÿç' alphabet_maj = 'ABCDEFGHIJKLMNOPQRSTUVWXYZAAEEEEIIOUUUYC' s = '' for c in CH : i = indice(c,alphabet_min) if i != -1 : s += alphabet_maj[i] return s
Question 10 :
def vigenereEncode (CH,CL) : alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' n = len(CH) m = len(CL) ch_criptée = '' for i in range(n) : lettre_clé = CL[i%m] k = indice(CH[i],alphabet) h = indice(lettre_clé,alphabet) p = (k+h)% ch_cryptée += alphabet[p] return ch_cryptée
Question 11 :
La complexité de la fonction vigenereEncode est O(len(CH))
Question 12 :
def vigenereEncodeRec (CH,CL,i) : alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' n = len(CH) m = len(CL) if i>n : return '' lettre_clé = CL[i%m]
Question 19 :
def code (CH,p) : alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' clé = '' LSC = listeSousChaines(CH,p) for s in LSC : L = frequencesCaracteres (s) i = indiceMax(L) clé += alphabet[(6-i)%26] return clé