任何人都可以在这个 python 3.2 代码中找到语法错误吗?
import math
import numpy
vinf = 10
vfr = 4
x = numpy.linspace(-10,10,50)
y = numpy.linspace(-10,10,50)
a = numpy.zeros(shape=(len(x),len(y)))
b = numpy.zeros(shape=(len(x),len(y)))
u = numpy.zeros(shape=(len(x),len(y)))
v = numpy.zeros(shape=(len(x),len(y)))
p = numpy.zeros(shape=(len(x),len(y)))
s = numpy.zeros(shape=(len(x),len(y)))
for i in range (0,len(x)):
for j in range (0,len(y)):
a[i][j]=x[i]
b[i][j]=y[j]
for i in range (0,len(x)):
for j in range (0,len(y)):
v[i][j] = (vfr/(2*math.pi))*math.pow((b[i][j]+.0047)/(a[i][j]+.05)+(b[i][j]+.0517)/(a[i][j]+.2084)+(b[i][j]-.0271)/(a[i][j]+.2084)+(b[i][j]+.0583)/(a[i][j]+.525)+(b[i][j]-.0228)/(a[i][j]+.525)+(b[i][j]+.0242)/(a[i][j]+.8417)+(b[i][j]-.0087)/(a[i][j]+.8417),-2)*((b[i][j]+.0047)/(math.pow(a[i][j]+.05,2)*(1+math.pow((b[i][j]+.0047)/(a[i][j]+.05),2)))+(b[i][j]+.0517)/(math.pow(a[i][j]+.2084,2)*(1+math.pow((b[i][j]+.0517)/(a[i][j]+.2084),2)))+(b[i][j]-.0271)/(math.pow(a[i][j]+.2084,2)*(1+math.pow((b[i][j]-.0271)/(a[i][j]+.2084),2)))+(b[i][j]+.0583)/(math.pow(a[i][j]+.525,2)*(1+math.pow((b[i][j]+.0583)/(a[i][j]+.525),2)))+(b[i][j]-.0228)/(math.pow(a[i][j]+.525,2)*(1+math.pow((b[i][j]-.0228)/(a[i][j]+.525),2)))+(b[i][j]+.0242)/(math.pow(a[i][j]+.8417,2)*(1+math.pow((b[i][j]+.0242)/(a[i][j]+.8417),2)))+(b[i][j]-.0087)/(math.pow(a[i][j]+.8417,2)*(1+math.pow((b[i][j]+.0087)/(a[i][j]+.8417),2))))
u[i][j] = vinf+(vfr/(2*math.pi))*math.pow((b[i][j]+.0047)/(a[i][j]+.05)+(b[i][j]+.0517)/(a[i][j]+.2084)+(b[i][j]-.0271)/(a[i][j]+.2084)+(b[i][j]+.0583)/(a[i][j]+.525)+(b[i][j]-.0228)/(a[i][j]+.525)+(b[i][j]+.0242)/(a[i][j]+.8417)+(b[i][j]-.0087)/(a[i][j]+.8417),-2)*(1/((a[i][j]+.05)*(1+math.pow((b[i][j]+.0047)/(a[i][j]+.05),2)))+1/((a[i][j]+.2084)*(1+math.pow((b[i][j]+.0517)/(a[i][j]+.2084),2)))+1/((a[i][j]+.2084)*(1+math.pow((b[i][j]-.0271)/(a[i][j]+.2084),2)))+1/((a[i][j]+.525)*(1+math.pow((b[i][j]+.0583)/(a[i][j]+.525),2)))+1/((a[i][j]+.525)*(1+math.pow((b[i][j]-.0228)/(a[i][j]+.525),2)))+1/(a[i][j]+.8417)*(1+math.pow((b[i][j]+.0242)/(a[i][j]+.8417),2)))+1/((a[i][j]+.8417)*(1+math.pow((b[i][j]+.0087)/(a[i][j]+.8417),2))))
p[i][j] = 1-math.pow(math.sqrt(math.pow(u[i][j],2)+math.pow(v[i][j],2)),2)
file = open("data.dat","w")
file.write('title = "Driven Cavity"\r\n')
file.write('variables = "x", "y", "u", "v", "p"\r\n')
file.write('ZONE T="All"\r\n')
file.write(' I={}'.format(len(x)))
file.write(' J={}'.format(len(x)))
file.write(' K=1')
file.write(' ZONETYPE=Ordered\r\n')
file.write(' DATAPACKING=POINT\r\n')
for i in range (0,len(x)):
for j in range (0,len(y)):
file.write('{}\t'.format(a[i][j]))
file.write('{}\t'.format(b[i][j]))
file.write('{}\t'.format(u[i][j]))
file.write('{}\t'.format(v[i][j]))
file.write('{}\t\n'.format(p[i][j]))
file.close()
该错误表示它位于 u[i][j]= 行的末尾,它可能是一个括号或我只是看不到它的东西。我从昨晚 5 点开始一直在研究这个,现在是第二天下午 3:40。