一个fortran程序无法成功运行
subroutinestart1(j0,j1,x)implicitnonereal*16j0,j1,xreal*16b,c,d,e,f,gg=3/xb=x/3if(x<3...
subroutine start1(j0,j1,x)
implicit none
real*16 j0,j1,x
real*16 b,c,d,e,f,g
g=3/x
b=x/3
if(x<3)then
j0=1.0-2.2499997*b**2+1.2656208*b**4-0.3163866*b**60.444479*b**8-0.0039444*b**10+0.00021*b**12
j1=x*(0.5-0.56249985*b**2+0.21093573*b**4-0.03954289*b**6+0.00443319*b**8-0.00031761*b**10+0.00001109*b**12)
else if (x>=3)then
c=0.79788456-0.00000077*g-0.00552740*g**2-0.00009512*g**3+0.00137237*g**4-0.00072805*g**5+0.00014476*g**6
d=x-0.78539816-0.04166397*g-0.00003954*g**2+0.00262573*g**3-0.00054125*g**4-0.00029333*g**5+0.00013558*g**6
j0=x**(-0.5)*c*cos(d)
e=0.79788456+0.00000156*g+0.01659667*g**2+0.00017105*g**3-0.00249511*g**4+0.00113653*g**5-0.00020033*g**6
f=x-2.35619449+0.12499612*g+0.00005650*g**2-0.00637879*g**3+0.00074348*g**4+0.00079824*g**5-0.00029166*g**6
j1=x**(-0.5)*e*cos(f)
else
end if
end subroutine
subroutine start2(n,x,j2)
real*16 j0,j1,j2,j3,x
integer n,i
call start1(j0,j1,x)
if(n==0)then
write(*,*) j0
else if(n==1)then
write(*,*) j1
else
do i=2,n
j2=2*(i-1)/x*j1-j0
if(i<n)then
j0=j1
j1=j2
else
end if
end do
end if
end subroutine
subroutine start3(n,x,j3)
real*16 j0,j1,j2,j3,x
integer n,m,i
real total
m=2*((n+sqrt(real(n*160)))/2)
j0=1
j1=0
j2=0
total=2
do i=m,1,-1
j2=2*i/x*j0-j1
if(mod(i-1,2)==0.and.i/=n)then
total=total+2*j2
else if(mod(i-1,2)==0.and.i==n)then
total=total+2*j2
j3=j0
else if(mod(i-1,2)/=0.and.i==n)then
j3=j0
end if
j1=j0
j0=j2
end do
total=total-j2
j3=j3/total
end subroutine
subroutine start(n,x,j)
implicit none
real*16 x,j
integer n
if(x>n) then
call start2(n,x,j)
else
call start3(n,x,j)
end if
stop
end subroutine
program main
implicit none
real*16 x1,x2,j1,j2
integer n,p,q
integer,parameter::limit=50*10**3
real,parameter::add=1/10**3
x1=0
x2=add
n=5
q=1
j1=0
j2=0
do p=1,limit
call start(n,x1,j1)
call start(n,x2,j2)
write(*,*) n,x1
if((j1<0.and.j2>0).or.(j1>0.and.j2<0))then
write(*,*) q,x1,"<X<",x2
q=q+1
else
end if
x1=x1+add
x2=x2+add
end do
end
运行之后,没有任何输出,怎么回事啊 展开
implicit none
real*16 j0,j1,x
real*16 b,c,d,e,f,g
g=3/x
b=x/3
if(x<3)then
j0=1.0-2.2499997*b**2+1.2656208*b**4-0.3163866*b**60.444479*b**8-0.0039444*b**10+0.00021*b**12
j1=x*(0.5-0.56249985*b**2+0.21093573*b**4-0.03954289*b**6+0.00443319*b**8-0.00031761*b**10+0.00001109*b**12)
else if (x>=3)then
c=0.79788456-0.00000077*g-0.00552740*g**2-0.00009512*g**3+0.00137237*g**4-0.00072805*g**5+0.00014476*g**6
d=x-0.78539816-0.04166397*g-0.00003954*g**2+0.00262573*g**3-0.00054125*g**4-0.00029333*g**5+0.00013558*g**6
j0=x**(-0.5)*c*cos(d)
e=0.79788456+0.00000156*g+0.01659667*g**2+0.00017105*g**3-0.00249511*g**4+0.00113653*g**5-0.00020033*g**6
f=x-2.35619449+0.12499612*g+0.00005650*g**2-0.00637879*g**3+0.00074348*g**4+0.00079824*g**5-0.00029166*g**6
j1=x**(-0.5)*e*cos(f)
else
end if
end subroutine
subroutine start2(n,x,j2)
real*16 j0,j1,j2,j3,x
integer n,i
call start1(j0,j1,x)
if(n==0)then
write(*,*) j0
else if(n==1)then
write(*,*) j1
else
do i=2,n
j2=2*(i-1)/x*j1-j0
if(i<n)then
j0=j1
j1=j2
else
end if
end do
end if
end subroutine
subroutine start3(n,x,j3)
real*16 j0,j1,j2,j3,x
integer n,m,i
real total
m=2*((n+sqrt(real(n*160)))/2)
j0=1
j1=0
j2=0
total=2
do i=m,1,-1
j2=2*i/x*j0-j1
if(mod(i-1,2)==0.and.i/=n)then
total=total+2*j2
else if(mod(i-1,2)==0.and.i==n)then
total=total+2*j2
j3=j0
else if(mod(i-1,2)/=0.and.i==n)then
j3=j0
end if
j1=j0
j0=j2
end do
total=total-j2
j3=j3/total
end subroutine
subroutine start(n,x,j)
implicit none
real*16 x,j
integer n
if(x>n) then
call start2(n,x,j)
else
call start3(n,x,j)
end if
stop
end subroutine
program main
implicit none
real*16 x1,x2,j1,j2
integer n,p,q
integer,parameter::limit=50*10**3
real,parameter::add=1/10**3
x1=0
x2=add
n=5
q=1
j1=0
j2=0
do p=1,limit
call start(n,x1,j1)
call start(n,x2,j2)
write(*,*) n,x1
if((j1<0.and.j2>0).or.(j1>0.and.j2<0))then
write(*,*) q,x1,"<X<",x2
q=q+1
else
end if
x1=x1+add
x2=x2+add
end do
end
运行之后,没有任何输出,怎么回事啊 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询