ZANLY
Finds the zeros of a univariate complex function using Müller’s method.
Required Arguments
F — User-supplied COMPLEX FUNCTION to compute the value of the function
of which the zeros will be found. The form is F(Z), where
Z — The complex value at which the function is evaluated. (Input)
Z should not be changed by F.
F — The computed complex function value at the point Z. (Output)
F must be declared EXTERNAL in the calling program.
Z — A complex vector of length NKNOWN + NNEW. (Output)
Z(1), …, Z(NKNOWN) contain the known zeros. Z(NKNOWN + 1), …, Z(NKNOWN + NNEW) contain the new zeros found by ZANLY. If ZINIT is not needed, ZINIT and Z can share the same storage locations.
Optional Arguments
ERRABS — First stopping criterion. (Input)
Let FP(Z) = F(Z)/P where P = (Z Z(1)) * (ZZ(2)) ** (Z Z(K – 1)) and Z(1), …, Z(K – 1) are previously found zeros. If (CABS(F(Z)).LE.ERRABS.AND.CABS(FP(Z)).LE.ERRABS), then Z is accepted as a zero.
Default: ERRABS = 1.e-4 for single precision and 1.d-8 for double precision.
ERRREL — Second stopping criterion is the relative error. (Input)
A zero is accepted if the difference in two successive approximations to this zero is within ERRREL. ERRREL must be less than 0.01; otherwise, 0.01 will be used.
Default: ERRREL = 1.e-4 for single precision and 1.d-8 for double precision.
NKNOWN — The number of previously known zeros, if any, that must be stored in ZINIT(1), ZINIT(NKNOWN) prior to entry to ZANLY. (Input)
NKNOWN must be set equal to zero if no zeros are known.
Default: NKNOWN = 0.
NNEW — The number of new zeros to be found by ZANLY. (Input)
Default: NNEW = 1.
NGUESS — The number of initial guesses provided. (Input)
These guesses must be stored in ZINIT(NKNOWN + 1), …, ZINIT(NKNOWN + NGUESS). NGUESS must be set equal to zero if no guesses are provided.
Default: NGUESS = 0.
ITMAX — The maximum allowable number of iterations per zero. (Input)
Default: ITMAX = 100.
ZINIT — A complex vector of length NKNOWN + NNEW. (Input)
ZINIT(1), …, ZINIT(NKNOWN) must contain the known zeros. ZINIT(NKNOWN + 1), …, ZINIT(NKNOWN + NNEW) may, on user option, contain initial guesses for the NNEW new zeros that are to be computed. If the user does not provide an initial guess, zero is used.
INFO — An integer vector of length NKNOWN + NNEW. (Output)
INFO(J) contains the number of iterations used in finding the J-th zero when convergence was achieved. If convergence was not obtained in ITMAX iterations, INFO(J) will be greater than ITMAX.
FORTRAN 90 Interface
Generic: CALL ZANLY (F, Z [])
Specific: The specific interface names are S_ZANLY and D_ZANLY.
FORTRAN 77 Interface
Single: CALL ZANLY (F, ERRABS, ERRREL, NKNOWN, NNEW, NGUESS, ZINIT, ITMAX, Z, INFO)
Double: The double precision name is DZANLY.
Description
Müller’s method with deflation is used. It assumes that the complex function f(z) has at least two continuous derivatives. For more details, see Müller (1965).
Comments
1. Informational error
Type
Code
Description
3
1
Failure to converge within ITMAX iterations for at least one of the NNEW new roots.
2. Routine ZANLY always returns the last approximation for zero J in Z(J). If the convergence criterion is satisfied, then INFO(J) is less than or equal to ITMAX. If the convergence criterion is not satisfied, then INFO(J) is set to either ITMAX + 1 or ITMAX + K, with K greater than 1. INFO(J) = ITMAX + 1 indicates that ZANLY did not obtain convergence in the allowed number of iterations. In this case, the user may wish to set ITMAX to a larger value. INFO(J) = ITMAX + K means that convergence was obtained (on iteration K) for the deflated function FP(Z) = F(Z)/((Z  Z(1))...(Z  Z(J  1))) but failed for F(Z). In this case, better initial guesses might help or it might be necessary to relax the convergence criterion.
Example
This example finds the zeros of the equation f(z) = z3 + 5z2 + 9z + 45, where z is a complex variable.
 
USE ZANLY_INT
USE WRCRN_INT
 
IMPLICIT NONE
! Declare variables
INTEGER INFO(3), NGUESS, NNEW
COMPLEX F, Z(3), ZINIT(3)
EXTERNAL F
! Set the guessed zero values in ZINIT
!
! ZINIT = (1.0+1.0i 1.0+1.0i 1.0+1.0i)
DATA ZINIT/3*(1.0,1.0)/
! Set values for all input parameters
NNEW = 3
NGUESS = 3
! Find the zeros of F
CALL ZANLY (F, Z, NNEW=NNEW, NGUESS=NGUESS, &
ZINIT=ZINIT, INFO=INFO)
! Print results
CALL WRCRN ('The zeros are', Z)
END
! External complex function
COMPLEX FUNCTION F (Z)
COMPLEX Z
!
F = Z**3 + 5.0*Z**2 + 9.0*Z + 45.0
RETURN
END
Output
 
The zeros are
1 2 3
( 0.000, 3.000) ( 0.000,-3.000) (-5.000, 0.000)
Published date: 03/19/2020
Last modified date: 03/19/2020