Symbol 'k' at (1) has not IMPLICIT type (Fortran g95)

1

I am programming a program in Fortran (g95) to approximate the zeros of a Bessel function of order n (the exercise requires that you use the series that defines it). My modules are these:

The module that contains the Bessel function in the form of a series:

module besselmod
public::BessJ,faktorial

contains
!---FAKTORIALA---!
function faktorial(k)
integer,intent(in)::k
integer::i,faktorial
faktorial=1
do i=1,k
   faktorial=faktorial*i
enddo
end function faktorial
!-----------------!

!---BESSEL FUNTZ.---!
function BessJ(x,n,k)
integer,intent(in)::k,n
real,intent(in)::x
real::BessJ
integer::i,kf,knf

BessJ=0
do i=k,0,-1
   kf=faktorial(i)
   knf=faktorial(i+n)
   BessJ=BessJ+((((-1.0)**i)*(x/2.0)**(2*i+n))/(kf*knf))
enddo
end function BessJ
!-------------------!

end module besselmod

The module that contains the method to approximate the zeros of the function:

module besselerro
use besselmod
public::besselerdi

contains
!-------ERDIRAKETA MET.-----!
subroutine besselerdi(a,b,BessJ,z,em)
!--------aldagaiak----------!
real,intent(in)::a,b,z      !
real,intent(out)::em        !
real::a1,b1,sig,d,i         !
                            !
interface                   !
function Bessj(x,n,k)       !
real,intent(in)::x          !
integer,intent(in)::n,k     !
real::BessJ                 !
end function BessJ          !
end interface               !
!---------------------------!
a1=a
b1=b
if (BessJ(a1,n,k)*BessJ(b1,n,k)>0) then
    print*,"Soluzioa ez dago sartutako tartean. Saiatu berriro."
    stop
endif
d=b1-a1
i=0
do
   d=b1-a1
   if (d<z) then
       exit
   else if (i>1000) then
       exit
    else
      sig=BessJ(a1,n,k)*BessJ((a1+b1)/2,n,k)
      if (sig>0) then
         a1=(a1+b1)/2
      else if (sig<0) then
         b1=(a1+b1)/2
      else
         if (BessJ(a1,n,k)==0) then
            em=a1
         else
            em=b1
         endif
      endif
      em=(a1+b1)/2
      i=i+1
    endif
enddo
end subroutine besselerdi


end module besselerro

When I compile them, I receive these errors:

In file besselerro.f90:23

if (BessJ(a1,n,k)*BessJ(b1,n,k)>0) then
         1
Error: Symbol 'n' at (1) has no IMPLICIT type
In file besselerro.f90:23

if (BessJ(a1,n,k)*BessJ(b1,n,k)>0) then
           1
Error: Symbol 'k' at (1) has no IMPLICIT type

Come on, we would expect that what happens is that I have not declared n and k. However, I have done it (and I ask the user in the main program, as well as a and b). Does anyone know what happens?

    
asked by forameus 28.12.2016 в 11:12
source

0 answers