- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use the same set of coeff. but ZPORC and DZPORC give me two quiet different answers! Why?
The program is:
INTEGER NDEG
PARAMETER (NDEG=3)
!C
REAL*8 COEFF(NDEG+1)
COMPLEX*16 ROOTS(NDEG),ROOT(NDEG)
EXTERNAL WRCRN, ZPLRC
!C Set values of COEFF
!C
DATA COEFF/-9.77E-3, 0.1870, -0.9562, 1.0/
!C
CALL DZPORC (NDEG, COEFF, ROOTS)
CALL ZPORC (NDEG, COEFF, ROOT)
!C
CALL WRCRN ('The ROOTSs found are', 1, NDEG, ROOTS, 1, 0)
CALL WRCRN ('The ROOTSs found are', 1, NDEG, ROOT, 1, 0)
!C
END
The program is:
INTEGER NDEG
PARAMETER (NDEG=3)
!C
REAL*8 COEFF(NDEG+1)
COMPLEX*16 ROOTS(NDEG),ROOT(NDEG)
EXTERNAL WRCRN, ZPLRC
!C Set values of COEFF
!C
DATA COEFF/-9.77E-3, 0.1870, -0.9562, 1.0/
!C
CALL DZPORC (NDEG, COEFF, ROOTS)
CALL ZPORC (NDEG, COEFF, ROOT)
!C
CALL WRCRN ('The ROOTSs found are', 1, NDEG, ROOTS, 1, 0)
CALL WRCRN ('The ROOTSs found are', 1, NDEG, ROOT, 1, 0)
!C
END
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think your problem lies in ignoring the kind type parameters required for the arguments to the IMSL subroutines used. At least when I modified your code to call the appropriate subroutines with the right kinds of arguments I got identical results for both ZPORC and DZPORC:
! File: polynomial.f90 program polynomial INTEGER NDEG PARAMETER (NDEG=3) !C REAL*4 COEFF(NDEG+1) REAL*8 DCOEFF(NDEG+1) COMPLEX*16 ROOTS(NDEG) COMPLEX*8 ROOT(NDEG) EXTERNAL WRCRN, ZPORC, DZPORC, DWRCRN !C Set values of COEFF !C DATA DCOEFF/-9.77E-3, 0.1870, -0.9562, 1.0/ !C COEFF = DCOEFF CALL DZPORC (NDEG, DCOEFF, ROOTS) CALL ZPORC (NDEG, COEFF, ROOT) !C CALL DWRCRN ('The ROOTSs found are', 1, NDEG, ROOTS, 1, 0) CALL WRCRN ('The ROOTSs found are', 1, NDEG, ROOT, 1, 0) !C END program polynomial

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page