For Programmers: Free Programming Magazines  


Home > Archive > Fortran > April 2006 > numerical integration DQAND (IMSL)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author numerical integration DQAND (IMSL)
olav

2006-04-13, 4:07 am

Hallo,

Here is an example of the use of QAND:

http://gams.nist.gov/serve.cgi/Modu...ample/ITL/dqand

I want the function to integrate to be variable, that is, now I have to
define:

Function F(N,X)
declarations
F=-x**+3
End function

However, I want to make the '3' variable, that is:

Function F(N,X,a)
declarations
F=-x**+a
End function

However, there is no way to use the QAND for it, as it requires a function
F(N,X).


Anyone an idea?



Thanks,


Olav


Joost

2006-04-13, 4:07 am

you should be able to use a common block for this:

FUNCTION F1(x)
real*8 x,f1
real*8 a
COMMON /Fparam/ a
f1=x*a
END FUNCTION F1
PROGRAM T
real*8 a,f1
COMMON /Fparam/ a
a=2.0D0
write(6,*) F1(1.0D0)
a=3.0D0
write(6,*) F1(1.0D0)
END PROGRAM T

Cheers,

Joost

beliavsky@aol.com

2006-04-13, 8:01 am


Joost wrote:
> you should be able to use a common block for this:


Yes, but even though the function will be called by an IMSL routine, it
can still USE a MODULE containing a variable Fparam. MODULEs are
preferable to COMMON in new code IMO.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com