
| |
Using IMSL
IMSL (International Mathematical and Statistical Library) is a set of computational subroutines written in FORTRAN. It consists of MATH/LIBRARY - Mathematical Applications, MATH/LIBRARY SPECIAL FUNCTIONS - Math Special Functions and STAT/LIBRARY - Statistical Analysis.
To use IMSL, you write a FORTRAN program that calls IMSL routines. As an example, you might write a FORTRAN program, POLY.FOR, to solve an n-th polynomial equation.
POLY.FOR - Example Program
COMPLEX*16 Z(100)
REAL*8 A(100)
1 PRINT *,'ENTER DEGREE OF POLYNOMIAL:'
READ *,NDEG
PRINT *,'ENTER COEFFICIENTS IN DESCENDING ORDER:'
READ *,(A(I),I=1,NDEG+1)
C *** Most routines are available in both a single and double
C precision version, with names of the two versions sharing
C a common root.
C The name of the double precision version begins with a `D'.
C *** ZPLRC/DZPORC (p. 931) and ZPORC/DZPORC (p. 933):
C Find the zeros of a polynomial with real coefficients.
C *** ZPOCC/DZPOCC (p. 935):
C Find the zeros of a polynomial with complex coefficients.
CALL DZPORC (NDEG,A,Z)
C *** User can use CALL WRCRN('ROOTS ARE:',NDEG,1,Z,NDEG,0)
C instead of the following two lines.
PRINT *,'ROOTS ARE:'
PRINT *,(Z(I),I=1,NDEG)
PRINT *,'MORE (1=YES, 0=NO)?'
READ *,MORE
IF (MORE .EQ. 1) GOTO 1
STOP
END
Once you've created the FORTRAN program which calls the IMSL routines, you'll need to compile and link it with either the shareable or static image library. For example, if your program is named POLY.FOR, use one of the following two methods:
$ FORTRAN POLY
$ LINK POLY,IMSLIB_SHARE/OPT
$ RUN POLY
$ FORTRAN POLY
$ LINK POLY,IMSLIB_STATIC/OPT
$ RUN POLY
Using the logical name IMSLIB_SHARE/OPT will result in faster link times and a smaller executable file than that obtained by linking with IMSLIB_STATIC/OPT. However, the resulting program may run slower, so you will have to decide which is more important for your particular circumstances.
IMSL manuals are available for use in the Clement Hall 313 computer lab. If you need additional assistance, contact Paul Tsai in Clement Hall 310 (phone 372-3983).
This page maintained by: Jim Johnson
For additional information, contact Paul Tsai, PTsai@tntech.edu
Last updated: September 10, 2001