运行出来全是0 ,请大家找错
dimension x(3),w(3),v(3),h(3),e(3),ee(3),fa(3),fa1(3)external f
real f,he1,he2,ha,hk1,bat,x,af,hr,fi
real hef,y,a,hh,j
open(7,file='7f50.dat')
open(5,file='5f50.dat')
read(*,*)x1,x2
do 5 j=0.0,3.14,0.01
bat=0.0
hh=0.5
af=0.5
he1=0.5
he2=0.0
hr=0.1
hk1=-0.5
hk2=-0.1
ha=0.005
hef=-10.0
fi=j
call dhrt(y,x,fi)
write(7,*)fi,x
! end if
!continue
! end
5 continue
end
function f(x,fi)
! real fi
bat=0.0
af=0.5
he1=0.5
hk1=-0.5
hr=0.1
ha=0.005
hef=-10
hh=0.5
f=hh*sin(bat-x)-he1*sin(x)/sqrt(abs(1.+2.*af*cos(x)+af*af))&
-ha*sin(2.*x)/2-hk1*sin(4.*x)/4-3*hr*cos(2*(fi-x))/2
! write(7,*)f
return
end
subroutine dhrt(y,x,fi)
real y,x,fi
! read(*,*)x1,x2
y1=f(x1,fi)
y2=f(x2,fi)
10 x=(x1+x2)/2
y=f(x,fi)
if (sign(y,y1).eq.y) then
x1=x
y1=y
else
x2=x
y2=y
end if
if((abs(x1-x2).gt.1e-5).and.(abs(y).gt.1e-6)) goto 10
if(abs(y).gt.1e-6) x=(x1+x2)/2
write(5,*)x
end
页:
[1]