Bonjour,
Je cherche à faire un programme Python résolvant cette récurrence :
Voici ce que j'ai fait :
Il s'agit d'un des premiers programme que je fais en python, soyez indulgent
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 import numpy as np import matplotlib.pyplot as plt a=1 b=50 n=1000 def P_0(x) : n=0 return i,1 def P_1(x) : n=1 return i,x def P_n(n,x) : f=(2*n-1)/(n)*x*P_n(n-1,x)-P_n(n-2,x)*(n-1)/(n) return n, f x = np.linspace(a, b, n+1) y=P_n(30,x) plt.plot(x, y) plt.show()
A vous lire
Partager