Hi Ron, thank you for your answer.
I've done as you suggested and the program is O.K
Now, I use the program calling the subroutine of the integration
(QDAG,IMSL libray) to define f(x) as the integral of h(x,y) (respect to
y); to do this the function h must be declared ad EXTERNAL.
Adding the line - external h - before the calling there is the error:
Error: A specification statement cannot appear in the executable section.
external h.
But I have to declare h external in some way (as it is also written in the
imsl doc). How can I solve this? Thank you for your help!!!
cheers,
celevic
Here is the program:
MODULE shared
implicit none
real :: x_copy
contains
FUNCTION f(x)
real, intent(in):: x
real :: f
real :: lower=1.,upper=10.
real :: res
x_copy=x
external h <------------------- error
call qdag(h,lower,upper,res)
f=res
END FUNCTION
FUNCTION h(y)
real, intent(in) :: y
real :: h
h=(x_copy*y)*(y**2)
END FUNCTION
end MODULE shared
PROGRAM proof
use shared
real :: a,b
do a=1.,5.,1.
b=f(a)
write(*,*) b
enddo
END PROGRAM
|