Jamuna

12-18-2012, 02:22 AM

IMSL subroutine UMPOL example fortran code produces wrong results please assist

http://www.roguewave.com/Portals/0/products/imsl-numerical-libraries/fortran-library/docs/6.0/math/default.htm?turl=umpol.htm

mecej4

12-18-2012, 05:54 AM

IMSL subroutine UMPOL example fortran code produces wrong results please assist

http://www.roguewave.com/Portals/0/products/imsl-numerical-libraries/fortran-library/docs/6.0/math/default.htm?turl=umpol.htm Using IMSL FNL7 and Intel Fortran I get the same results as in the IMSL manual. These results compare well with the exact solution X = [1,1], FVALUE = 0.

Provide sufficient detail to enable one to reproduce the claimed wrong results.

Jamuna

12-18-2012, 11:40 PM

example code for UMPOL subroutine in the IMSL Help document follows

------------------------------------------------------------

C Variable declarations

INTEGER N

PARAMETER (N=2)

C

INTEGER K, MAXFCN, NOUT

REAL FTOL, FVALUE, S, X(N), XGUESS(N)

EXTERNAL FCN, UMACH, UMPOL

C

C Initializations

C XGUESS = ( -1.2, 1.0)

C

DATA XGUESS/-1.2, 1.0/

C

FTOL = 1.0E-10

MAXFCN = 200

S = 1.0

C

CALL UMPOL (FCN, N, XGUESS, S, FTOL, MAXFCN, X, FVALUE)

C

CALL UMACH (2, NOUT)

WRITE (NOUT,99999) (X(K),K=1,N), FVALUE

99999 FORMAT (' The best estimate for the minimum value of the', /,

& ' function is X = (', 2(2X,F4.2), ')', /, ' with ',

& 'function value FVALUE = ', E12.6)

C

END

C External function to be minimized

SUBROUTINE FCN (N, X, F)

INTEGER N

REAL X(N), F

C

F = 100.0*(X(1)*X(1)-X(2))**2 + (1.0-X(1))**2

RETURN

END

Output

The best estimate for the minimum value of the

function is X = ( 1.00 1.00)

with function value FVALUE = 0.502496E-10

----------------------------

i have compiled this code in compaq visual fortran 6.0 and it gives following results

The best estimate for the minimum value of the

function is X = ( 1.00 1.00)

with function value FVALUE = 0.247835E-10

Press any key to continue

Please assits ASAP

mecej4

12-19-2012, 06:33 AM

Although you did not say this explicitly, I think that you view the final FVALUE as given by CVF6 (0.247835E-10) to disagree with the value in the manual (0.502496E-10) so much as to declare the result to be "wrong". You should change your viewpoint of what "wrong" means when considering results from finite-precision arithmetic. Some points to consider

(i) Both final FVALUE results differ from the exact result by less than the specified convergence tolerance 1E-10. Any result that satisfies | F - F<sub>exact</sub> | < Ftol should be regarded as "correct". Note that for this problem F<sub>exact</sub> = 0, compared to which any non-zero value expressed as a floating decimal would disagree in the very first significant digit.

(ii) You ran the example in single precision. You can try double precision in combination with smaller Ftol values to see if you can improve the result.

(iii) UMPOL is not a good choice for obtaining high accuracy in the optimum of a smooth function.

(iv) IMSL comes in a number of binary versions for different compilers and operating systems, whereas the documentation attempts to cover all of them in a unified way. In general, there will be small differences among the results given by the several distributions, since such differences are inherent in finite-precision calculations.

Powered by vBulletin® Version 4.2.3 Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.