一个FORTRAN的程序,编译没有错误,有很多警告,为什么??求解答!!!
PROGRAMMAINIMPLICITNONEINTEGER,PARAMETER::K=2,MM=2!设定K及MM的值INTEGER::MI=1,MJ=1REAL::ZU...
PROGRAM MAIN
IMPLICIT NONE
INTEGER,PARAMETER::K=2,MM=2 !设定K及MM的值
INTEGER::MI=1,MJ=1
REAL::ZUIHOU(MM,MM)
REAL::XYU(MM)=(/0.1,0.2/) !赋值
REAL::YYU(MM)=(/0.2,0.3/)
REAL::ZYU(MM)=(/0.3,0.4/)
CALL NJ(K,MI,MJ,ZUIHOU)
WRITE(*,*)ZUIHOU(MI,MJ)
END
SUBROUTINE NJ(K,MI,MJ,ZUIHOU) !最终的计算结果
IMPLICIT NONE
INTEGER K
INTEGER::KI,KJ=0,KKI
INTEGER::MI,MJ,XX=1,KPIE=0
REAL,ALLOCATABLE::ZUIHOU(:,:)
REAL,ALLOCATABLE::COSS(:,:)
INTEGER::JIEGUO
ZUIHOU(:,:)=0
KI=K
DO KKI=K,0,-2
CALL PQ(MI,MJ,COSS) !调用单倍角公式
CALL ZUHE(K,KPIE,JIEGUO) !调用组合公式子程序
ZUIHOU(MI,MJ)=ZUIHOU(MI,MJ)+JIEGUO*(COSS(MI,MJ)**KI)*((1-COSS(MI,MJ)**2)**KJ)*XX !计算得到结果
KPIE=KPIE+2
KI=K-2
KJ=KJ+1
XX=-XX
ENDDO !最终的结果
RETURN
END
SUBROUTINE ZUHE(K,KPIE,JIEGUO) !组合公式的计算
IMPLICIT NONE
INTEGER::K,KKPIE,KPIE,JIEGUO
INTEGER::JIEGUO1,JIEGUO2,JIEGUO3
IF(KPIE>K)THEN
WRITE(*,*)"次数与阶数颠倒"
ENDIF
KKPIE=K-KPIE
CALL JIECHEN(K,JIEGUO1)
CALL JIECHEN(KPIE,JIEGUO2)
CALL JIECHEN(KKPIE,JIEGUO3)
JIEGUO=JIEGUO1/(JIEGUO2*JIEGUO3)
RETURN
ENDSUBROUTINE
SUBROUTINE JIECHEN(KK,JJIEGUO) !阶乘的计算
IMPLICIT NONE
INTEGER::KK,JJIEGUO,KKBIAN
JJIEGUO=1
DO KKBIAN=1,KK
JJIEGUO=JJIEGUO*KKBIAN
ENDDO
RETURN
END
SUBROUTINE PQ(MI,MJ,COSS) !单倍角的计算公式
IMPLICIT NONE
INTEGER::MI,MJ,MM
REAL,ALLOCATABLE::COSS(:,:)
REAL,ALLOCATABLE::SINS(:)
REAL,ALLOCATABLE::CONS(:)
REAL,ALLOCATABLE::XYU(:)
REAL,ALLOCATABLE::YYU(:)
REAL,ALLOCATABLE::ZYU(:)
CALL PP(XYU,ZYU,SINS) !调用正弦公式
CALL QQ(XYU,YYU,CONS) !调用余弦公式
COSS(MI,MJ)=SINS(MI)*SINS(MJ)+CONS(MI)*CONS(MJ)
RETURN
END
SUBROUTINE PP(XYU,ZYU,SINS) !单倍角展开后正弦的计算
IMPLICIT NONE
INTEGER::MM
REAL,ALLOCATABLE::XYU(:)
REAL,ALLOCATABLE::ZYU(:)
REAL,ALLOCATABLE::SINS(:)
INTEGER::MMI
DO MMI=1,MM
SINS(MMI)=ZYU(MMI)/(1-XYU(MMI)**2)**(1/2)
ENDDO
RETURN
END
SUBROUTINE QQ(XYU,YYU,CONS) !单倍角展开后余弦的计算
IMPLICIT NONE
INTEGER::MM
REAL,ALLOCATABLE::XYU(:)
REAL,ALLOCATABLE::YYU(:)
REAL,ALLOCATABLE::CONS(:)
INTEGER::MMJ
DO MMJ=1,MM
CONS(MMJ)=YYU(MMJ)/(1-XYU(MMJ)**2)**(1/2)
ENDDO
RETURN
END 展开
IMPLICIT NONE
INTEGER,PARAMETER::K=2,MM=2 !设定K及MM的值
INTEGER::MI=1,MJ=1
REAL::ZUIHOU(MM,MM)
REAL::XYU(MM)=(/0.1,0.2/) !赋值
REAL::YYU(MM)=(/0.2,0.3/)
REAL::ZYU(MM)=(/0.3,0.4/)
CALL NJ(K,MI,MJ,ZUIHOU)
WRITE(*,*)ZUIHOU(MI,MJ)
END
SUBROUTINE NJ(K,MI,MJ,ZUIHOU) !最终的计算结果
IMPLICIT NONE
INTEGER K
INTEGER::KI,KJ=0,KKI
INTEGER::MI,MJ,XX=1,KPIE=0
REAL,ALLOCATABLE::ZUIHOU(:,:)
REAL,ALLOCATABLE::COSS(:,:)
INTEGER::JIEGUO
ZUIHOU(:,:)=0
KI=K
DO KKI=K,0,-2
CALL PQ(MI,MJ,COSS) !调用单倍角公式
CALL ZUHE(K,KPIE,JIEGUO) !调用组合公式子程序
ZUIHOU(MI,MJ)=ZUIHOU(MI,MJ)+JIEGUO*(COSS(MI,MJ)**KI)*((1-COSS(MI,MJ)**2)**KJ)*XX !计算得到结果
KPIE=KPIE+2
KI=K-2
KJ=KJ+1
XX=-XX
ENDDO !最终的结果
RETURN
END
SUBROUTINE ZUHE(K,KPIE,JIEGUO) !组合公式的计算
IMPLICIT NONE
INTEGER::K,KKPIE,KPIE,JIEGUO
INTEGER::JIEGUO1,JIEGUO2,JIEGUO3
IF(KPIE>K)THEN
WRITE(*,*)"次数与阶数颠倒"
ENDIF
KKPIE=K-KPIE
CALL JIECHEN(K,JIEGUO1)
CALL JIECHEN(KPIE,JIEGUO2)
CALL JIECHEN(KKPIE,JIEGUO3)
JIEGUO=JIEGUO1/(JIEGUO2*JIEGUO3)
RETURN
ENDSUBROUTINE
SUBROUTINE JIECHEN(KK,JJIEGUO) !阶乘的计算
IMPLICIT NONE
INTEGER::KK,JJIEGUO,KKBIAN
JJIEGUO=1
DO KKBIAN=1,KK
JJIEGUO=JJIEGUO*KKBIAN
ENDDO
RETURN
END
SUBROUTINE PQ(MI,MJ,COSS) !单倍角的计算公式
IMPLICIT NONE
INTEGER::MI,MJ,MM
REAL,ALLOCATABLE::COSS(:,:)
REAL,ALLOCATABLE::SINS(:)
REAL,ALLOCATABLE::CONS(:)
REAL,ALLOCATABLE::XYU(:)
REAL,ALLOCATABLE::YYU(:)
REAL,ALLOCATABLE::ZYU(:)
CALL PP(XYU,ZYU,SINS) !调用正弦公式
CALL QQ(XYU,YYU,CONS) !调用余弦公式
COSS(MI,MJ)=SINS(MI)*SINS(MJ)+CONS(MI)*CONS(MJ)
RETURN
END
SUBROUTINE PP(XYU,ZYU,SINS) !单倍角展开后正弦的计算
IMPLICIT NONE
INTEGER::MM
REAL,ALLOCATABLE::XYU(:)
REAL,ALLOCATABLE::ZYU(:)
REAL,ALLOCATABLE::SINS(:)
INTEGER::MMI
DO MMI=1,MM
SINS(MMI)=ZYU(MMI)/(1-XYU(MMI)**2)**(1/2)
ENDDO
RETURN
END
SUBROUTINE QQ(XYU,YYU,CONS) !单倍角展开后余弦的计算
IMPLICIT NONE
INTEGER::MM
REAL,ALLOCATABLE::XYU(:)
REAL,ALLOCATABLE::YYU(:)
REAL,ALLOCATABLE::CONS(:)
INTEGER::MMJ
DO MMJ=1,MM
CONS(MMJ)=YYU(MMJ)/(1-XYU(MMJ)**2)**(1/2)
ENDDO
RETURN
END 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询