# -*- coding: utf-8 -*- """ Created on Mon Dec 08 14:11:09 2014 @author: grivet Exercice 2.5 : Calcul et tracé des fonctions d'Airy A(x) et B(x) """ from pylab import * def f(x): terme = 1.0; somme = terme; k = 0 while abs(terme) > 10**(-7): terme = x*x*x*terme/(3*k+2)/(3*k+3) somme = somme + terme k = k+1 return somme def g(x): terme = x; somme = terme; k = 0 while abs(terme) > 10**(-7): terme = x*x*x*terme/(3*k+3)/(3*k+4) somme = somme + terme k = k+1 return somme c1 = 0.3550281; c2 = 0.2588194 def Ai(x): return c1*f(x) - c2*g(x) def Bi(x): return sqrt(3)*(c1*f(x) + c2*g(x)) pas = 0.01; x = -14.0; i = 0 X = zeros(1500); AA = zeros(1500); BB = zeros(1500) while x < 0.99: X[i] = x; AA[i] = Ai(x); BB[i] = Bi(x); i = i+1; x = x+pas plot(X,AA,'-k',X,BB,'-b') show()