stealthbadger
10-31-2006, 09:04 AM
Hi, I've been attempting to write a program that uses qtrap to integrate sinx between 0 and pi. (i actually need to do a much bigger integration, but i wanted to check i could get qtrap working first-i can't!
I get the following errors:
QTRAP - in file workwithnumrec.f95 at line 18 [+0068]
main - in file workwithnumrec.f95 at line 6 [+0061]
I think it thinks 'sinx' is a real number, rather than a function, but if i don't define sinx at the start, it won't let me compile!
Any help would be greatly appreciated, thanks!
The program looks like this (but with qtrap and trapzd on the end):
!-------------------------------------------------------------------------
program workworkwork
implicit none
real:: sinx, ans, mu, md
md=0.00
mu=(atan(1.00)*4.00)
call qtrap(sinx,md,mu,ans)
write(*,*) ans
end program workworkwork
!-------------------------------------------------------------------
function sinx (x) result(y)
implicit none
double precision:: x, y
y=sin(x)
end function sinx
!-------------------------------------------------------------------
(trapzd and qtrap are down here)
I get the following errors:
QTRAP - in file workwithnumrec.f95 at line 18 [+0068]
main - in file workwithnumrec.f95 at line 6 [+0061]
I think it thinks 'sinx' is a real number, rather than a function, but if i don't define sinx at the start, it won't let me compile!
Any help would be greatly appreciated, thanks!
The program looks like this (but with qtrap and trapzd on the end):
!-------------------------------------------------------------------------
program workworkwork
implicit none
real:: sinx, ans, mu, md
md=0.00
mu=(atan(1.00)*4.00)
call qtrap(sinx,md,mu,ans)
write(*,*) ans
end program workworkwork
!-------------------------------------------------------------------
function sinx (x) result(y)
implicit none
double precision:: x, y
y=sin(x)
end function sinx
!-------------------------------------------------------------------
(trapzd and qtrap are down here)