


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Various numerical methods for solving differential equations, including the euler method, heun's method, and the runge-kutta method. It provides the implementation of these methods in python and discusses their complexity and properties. The document also covers the encoding and decoding of text using the vigenère cipher, including the implementation of the encoding and decoding functions, as well as the analysis of the complexity and robustness of the cipher. Additionally, the document includes questions and solutions related to these topics, making it a valuable resource for students and researchers interested in numerical methods and cryptography.
Typology: Exercises
1 / 4
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é