It is done ! There is the new code, hope you find it more clear.
Still with the message error :
File "F:\TIPE\Modélisation Python\Programme.py", line 65
Temperature.append( l_row[N] + dt / (dr*rho*capa(l_row[N])) * ( h*(Text - l_row[N]) + lambd(l_row[N])/dr * (l_row[N-1] - l_row[N]) ) )
^
SyntaxError: invalid syntax
Still with the message error :
File "F:\TIPE\Modélisation Python\Programme.py", line 65
Temperature.append( l_row[N] + dt / (dr*rho*capa(l_row[N])) * ( h*(Text - l_row[N]) + lambd(l_row[N])/dr * (l_row[N-1] - l_row[N]) ) )
^
SyntaxError: invalid syntax
## TIPE #Importation import matplotlib.pyplot as plt #Numeric values rho=2500 le=1.4e-3 ce=4186 rhoe=1000 h=10 e=5e-3 #Coefficients for thermal dependency conduc0=-11.91 conduc1=87.6e-3 conduc2=-145e-6 capa0=-243e3 capa1=2e3 capa2=-2 #Functions for thrmal dependency def conduc(T, coeff1=conduc1, coeff2=conduc2): #Thermal conductivity return (conduc0 + conduc1*T + conduc2*T**2) def capa(T, coeff1=capa1, coeff2=capa2): #Thermal capacity per mass return (capa0 + coeff1*T + coeff2*T**2) #Parameters of discreditation N=10 dt=10 dr=e/N+1 #Initial parameters T_start=90 T_ext=20 #Function def résolution(M): '''Stop at time_max=M*dt, return the list of Temperatures at the interface with the water at every time''' Interface_water=[T_start] Time = [elt for elt in range(M+1)] L = [ [T_start] + N*[T_ext] ] #List where every temperature calculated will remain for l_row in L: Temperature=[] #Calculation at the interface water (i=0) Temperature.append( l_row[0] + lambd(l_row[0])*dr*dt / (dr*rho*capa(l_row[0]) - le*rhoe*ce) /dr/dr * (l_row[1] - l_row[0]) ) #Calculation in the mug (i from 1 to N) for i in range(1, N+1): Temperature.append( (l_row[i] + lambd(l_row[i])*dr*dt / (dr*rho*capa(l_row[i])) /dr/dr * (l_row[i+1] + l_row[i-1] - 2*l_row[i]) ) #Calculation at the interface air (i=N+1) Temperature.append( l_row[N] + dt / (dr*rho*capa(l_row[N])) * ( h*(Text - l_row[N]) + lambd(l_row[N])/dr * (l_row[N-1] - l_row[N]) ) ) L.append(Temperature) Interface_water.append(Temperature[0]) plt.plot(Time, Interface_water) return (Interface_water) #Execution résolution(10)