Jun-20-2019, 03:10 PM
Hello !
Spyder tells me i've an indentation problem here, line 4, "unexpected indent" :
While you're here, it also does me a "syntax error" here, line 5 :
Spyder tells me i've an indentation problem here, line 4, "unexpected indent" :
def A(i, j, Nz, Nr, dr, dz, dt, he, Bir, Biz) : if i == 1 : if j == 1 : "partie 1" return ((1/(16*dt))+(1/(8*dz**2))+(1/(4*he*he*dr*dr))+(Biz/(8*dz))) elif j==Nr : "partie 3" return ((Nr-1)/(2*dt))+(Bir*(Nr-1)/(2*he*he*dr))+(Biz*(Nr-1)/dz)+((Nr-1)/dz**2)+((Nr-1.5)/(2*he*he*dr*dr)) else : "partie 2" return (j-1)*((1/(2*dt))+(1/(he*dr)**2)+(1/dz**2)+(Biz/dz)) elif j==1 : if i==Nz : "partie 7" return (1/(16*dt))+(1/(16*dz**2))+(1/(4*dr*dr*he*he))+(Biz/(8*dz)) else : "partie 4" return (1/(8*dt))+(2/(8*dz))+(1/(2*he*he*dr*dr)) elif i==Nz : if j==Nr : "partie 9" return ((Nr-1.5)/(he*he*dr*dr))+(Nr-1)*((1/2*dt)+(Bir/(2*he*he*dr))+(Biz/dz)+((1/dz**2))) else : "partie 8" return (j-1)*((1/(2*dt))+(1/(he*he*dr*dr))+(1/(dz**2))+(Biz/dz)) elif j==Nr : "partie 6" return ((Nr-1.5)/(he*he*dr*dr))+(Nr-1)*((1/(2*dt))+(Bir/(he*he*dr))+(Biz/dz)+(1/dz**2)) else : "partie 5" return (j-1)*((1/dt) + (2/(he*dr)**2) + (2/dz**2))I've tried online website that shows errors in indentation, trying to replace tabs by spaces, avoiding blank lines, etc... Python doesn't want a loop in another loop (i have the same problem with a "while" loop in a "for" loop). It wants me to put the "return" line 4 at the same level as the "if" line 3. If I do it (because I've tried almost everything), the unexpected indentation error goes to the next line, etc. I don't know what to do, I've asked friends and read others forums (and this one too) before but I can't find a solution.
While you're here, it also does me a "syntax error" here, line 5 :
import numpy as np """ Paramètres : """ tf = 5 "temps final" N = 1 "nombre d'incréments de temps" t_laser = 1 "durée de l'émission laser" dt = tf / N "pas de temps" DT = dt * alpha / H^2 "pas de temps adimensionné"Thank you for your help !