CCINP Informatique Commune PC 2015
Notez ce sujet en cliquant sur l'étoile
0.0(0 votes)
Téléchargements disponibles
Lecture web du sujet
Version HTML avec rendu des formules, intégrée sur la page canonique.
\# II.B.2.j.(iv)
T_tous_k[ : , 0]=T0
\# II.B.2.j. (v)
T_tous_k[0,1]=r*Tint+(1-2*r)*T_tous_k[0,0]+r*T_tous_k[1,0]
T_tous_k[N-1,1] $=r^{*}$ T_tous_k[N-2,0]+(1-2*r)*T_tous_k[N-1,0]+r*Text
for i in range ( $2, \mathrm{~N}$ ) :
T_tous_k[i-1,1]=r*T_tous_k[i-2,0]+(1-2*r)*T_tous_k[i-1,0]+r*T_tous_k[i,0]
\# II.B.2.j. (vi)
def calc_norme(V):
$\mathrm{N}=$ len (V)
$s=0$
for
$i$ in $\operatorname{range}(N):$
$s+=V[i]^{* * 2}$
return sqrt(s)
\# II.B.2.j.(vii)
k=1
while calc_norm( $\mathrm{T}[:, \mathrm{k}]-\mathrm{T}[:, \mathrm{k}-1])>=10^{* *}(-2)$ and $\mathrm{k}<$ ItMax-1:
k+=1
T_tous_k[0,k]=r*Tint+(1-2*r)*T_tous_k[0,k-1] +r*T_tous_k[1,k-1]
T_tous_k[N-1,k]=r*T_tous_k[N-2, k-1]+(1-2*r)*T_tous_k[N-1, k-1]+r*Text
for i in range $(2, N)$ :
[i,k-1]
\# II.B.2.j.(viii)
nbIter=k
return nbIter, T_tous_k
\# II.B.3.a. l'équation (1) donne
\# alpha * ( T^\{k+1\}_i - T^k_i )/( Delta t ) = ( T^\{k+1\}_\{i+1\} + T^\{k+1\}_\{i-1\} -
2. $\mathrm{T} \wedge\{\mathrm{k}+1\} \_$i )/( Delta $\mathrm{x}^{\wedge} 2$ )
\# II.B.3.b.on a donc
\# T^k_i=-r. T^\{k+1\}_\{i-1\}+(1+2r). T^\{k+1\}_i-r.t^\{k+1\}_\{i+1\}
\# toujours avec r=(Delta t / (alpha*Delta x^2))
\# II.B.3.c.
\# M est tridiagonale: sur la diagonale principale tous les coefficients valent 1
$+2 r$
\# sur la diagonale supérieure tous les coefficients valent $r$
\# sur la diagonale inférieure tous les coefficients valent $r$
\# v=[Tint,0,.....,0,Text2]
\# II.B.3.d.
def CalcTkp1(M,d):
N=1en(d)
cprime=[ 0 for k in range( N )
cprime[0]=M[0,1]/float(M[0,0]) \# Python 2.7
for 1 range(1, N-1):
dprime=
dprime[0]=float(d[0])/M[0,0] \# Python 2.7
dprimplon 2.7
for i in range( $1, \mathrm{~N}$ ):
\# dprime[i]=float(d[i]-M[i,i-1]*dprime[i-1])/(M[i,i]-M[i,i-1]*cprime[i-1])
\# Python 2.7
- [ or k in range(N) ]
u[-1]=dprime[-1]
for $i$ in range( $N-2,-1,-1$ ):
| févr. 24, 16 9:50 stdin | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||
|
Pas de description pour le moment
