我正在尝试使用 gfortran 求解方程,但我不断收到错误
我正在使用下面的程序,但我不断收到错误。我的程序出了什么问题?
real x
complex y
real m1,H0,Ms,P1,P2,P3,w0,wm,wh
complex w1,w2,o1,o2
integer i,n
real pi
n=4000000000
pi=4*atan(1.0)
m1=4*pi*1e-7
H0=39.79e3
Ms=1400e3
P1=0.7*0.12
P2=0.3*0.12
P3=P1-P2
w0=m1*(1.76e11)*H0
wm=m1*(1.76e11)*Ms
wh=w0-P3*wm
im=cmplx(0,1)
w1=wm/2+wh-im*0.06*2*pi*x
w2=wm/2-wh-im*0.06*2*pi*x
o1=x**2-x*(2*wh-(P3*wm)/2)-w1*w2+(wm/2)*(P1*w2+P2*w1)
o2=x**2+x*(2*wh-(P3*wm)/2)-w1*w2+(wm/2)*(P1*w2+P2*w1)
do i=0,n
x=i
y=1+wm*(P1*w1*((w2)**2-x**2))/(o1*o2)
& +wm*(P2*w2*((w1)**2-x**2))/(o1*o2)
& -wm*((wm/2)*((P1*w2+P2*w1)**2)))/(o1*o2)
& +wm*((wm/2)*((P3*x)**2))/(o1*o2)
write(10,*)x,y
enddo
return
end
i'm using the below program but i keep getting error.What is wrong with my progam?
real x
complex y
real m1,H0,Ms,P1,P2,P3,w0,wm,wh
complex w1,w2,o1,o2
integer i,n
real pi
n=4000000000
pi=4*atan(1.0)
m1=4*pi*1e-7
H0=39.79e3
Ms=1400e3
P1=0.7*0.12
P2=0.3*0.12
P3=P1-P2
w0=m1*(1.76e11)*H0
wm=m1*(1.76e11)*Ms
wh=w0-P3*wm
im=cmplx(0,1)
w1=wm/2+wh-im*0.06*2*pi*x
w2=wm/2-wh-im*0.06*2*pi*x
o1=x**2-x*(2*wh-(P3*wm)/2)-w1*w2+(wm/2)*(P1*w2+P2*w1)
o2=x**2+x*(2*wh-(P3*wm)/2)-w1*w2+(wm/2)*(P1*w2+P2*w1)
do i=0,n
x=i
y=1+wm*(P1*w1*((w2)**2-x**2))/(o1*o2)
& +wm*(P2*w2*((w1)**2-x**2))/(o1*o2)
& -wm*((wm/2)*((P1*w2+P2*w1)**2)))/(o1*o2)
& +wm*((wm/2)*((P3*x)**2))/(o1*o2)
write(10,*)x,y
enddo
return
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这一行(多行语句中的第三行):
有太多右括号{为我出色的绘画技巧而颤抖:-)}。它应该是:
我从该来源得到的问题的完整列表是:
第二个是您可能遇到的问题(并且您可以使用上述解决方案修复该问题)。第一个,如果你有它,会引起问题,但我怀疑这只是因为我的环境。
This line (the third in the multiline statement):
has one too many closing parentheses {tremble in fear at my awesome drawing skills :-) }. It should be:
The full list of problems I got from that source was:
The second of those is the one you're probably having (and the one you can fix with the above solution). The first, if you're having it, will cause a problem but I suspect it's just because of my environment.