Mathematical functions downloaded from John Burkardt page fSolve and brent
Modified:
Author:
Reference:
User-supplied system of equations
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fSolve_t), | intent(in) | :: | me |
User-defined object transmitted to the solver |
||
| integer, | intent(in) | :: | n |
number of functions and variables |
||
| real(kind=dp), | intent(inout) | :: | x(n) |
result or initial point where the jacobian is evaluated |
||
| real(kind=dp), | intent(inout) | :: | fVec(n) |
the functions evaluated at 'x' |
user-supplied function, of the form which evaluates the function whose zero is being sought.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(brent_t), | intent(in) | :: | me |
User-defined object transmitted to the solver |
||
| real(kind=dp), | intent(in) | :: | x |
'x' parameter of the function f(x) |
returned value
Procedure 'fcn' of this class is the parameter to fSolve subroutine.
| procedure(fSolve_function), public, deferred :: fcn |
Computes the Euclidean norm of a vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer | :: | n |
Length of the vector |
|||
| real(kind=dp) | :: | x(n) |
Vector whose norm is desired |
Euclidean norm of the vector
Seeks the root of a function F(X) in an interval [A,B].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(brent_t), | intent(in) | :: | obj |
external object with the user-supplied subroutine which calculates the functions. |
||
| real(kind=dp), | intent(in) | :: | a |
the endpoints of the change of sign interval |
||
| real(kind=dp), | intent(in) | :: | b |
the endpoints of the change of sign interval |
||
| real(kind=dp), | intent(in) | :: | machep |
an estimate for the relative machine precision. |
||
| real(kind=dp), | intent(in) | :: | t |
a positive error tolerance |
the estimated value of a zero of the function F
Finds the minimizing combination of Gauss-Newton and gradient steps.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer | :: | n |
In - order of the matrix R |
|||
| real(kind=dp) | :: | r(lr) |
In - upper triangular matrix R stored by rows. |
|||
| integer | :: | lr |
In - size of the R array, which must be no less than (N*(N+1))/2. |
|||
| real(kind=dp) | :: | diag(n) |
In - diagonal elements of the matrix D. |
|||
| real(kind=dp) | :: | qtb(n) |
In - first N elements of the vector Q'* B. |
|||
| real(kind=dp) | :: | delta |
In - positive upper bound on the euclidean norm of D*X(1:N). |
|||
| real(kind=dp) | :: | x(n) |
Out - desired convex combination of the Gauss-Newton direction and the scaled gradient direction. |
Estimates a jacobian matrix using forward differences.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fSolve_t), | intent(in) | :: | obj |
External object with the user-supplied subroutine which calculates the functions. |
||
| integer, | intent(in) | :: | n |
Number of functions and variables |
||
| real(kind=dp), | intent(inout) | :: | x(n) |
Point where the jacobian is evaluated |
||
| real(kind=dp), | intent(in) | :: | fVec(n) |
Functions evaluated at 'x' |
||
| real(kind=dp), | intent(inout) | :: | fjac(ldfjac,n) |
The N by N approximate |
||
| integer, | intent(in) | :: | ldfjac |
Leading dimension of FJAC, which must not be less than N. |
||
| integer, | intent(in) | :: | ml |
Number of sub-diagonals within the band of the jacobian matrix If the jacobian is not banded, set ML and MU to N-1. |
||
| integer, | intent(in) | :: | mu |
Number of super-diagonals within the band of the jacobian matrix If the jacobian is not banded, set ML and MU to N-1. |
||
| real(kind=dp), | intent(in) | :: | epsFcn |
Is used in determining a suitable step length for the forward-difference approximation. |
Seeks a zero of N non-linear equations in N variables
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fSolve_t), | intent(in) | :: | obj |
External object with the user-supplied subroutine which calculates the functions. |
||
| integer, | intent(in) | :: | n |
Number of functions and variables |
||
| real(kind=dp), | intent(inout) | :: | x(n) |
Initial estimate of the solution vector / the estimate of the solution vector |
||
| real(kind=dp), | intent(out) | :: | fVec(n) |
The functions evaluated at the output X |
||
| real(kind=dp), | intent(in) | :: | tol |
Satisfactory termination occurs when the algorithm estimates that the relative error between X and the solution is at most TOL. TOL should be non-negative. |
||
| integer, | intent(out) | :: | info |
Status flag |
Seeks a zero of N non-linear equations in N variables.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fSolve_t), | intent(in) | :: | obj |
External object with the user-supplied subroutine which calculates the functions. |
||
| integer, | intent(in) | :: | n |
The number of functions and variables |
||
| real(kind=dp), | intent(inout) | :: | x(n) |
Input initial estimate of the solution vector / output X final estimate of the solution vector |
||
| real(kind=dp), | intent(out) | :: | fVec(n) |
The functions evaluated at the output X |
||
| real(kind=dp), | intent(in) | :: | xTol |
Termination occurs when the relative error between two consecutive iterates is at most XTOL. XTOL should be non-negative. |
||
| integer, | intent(in) | :: | maxFev |
Termination occurs when the number of calls to FCN is at least MAXFEV by the end of an iteration |
||
| integer, | intent(in) | :: | ml |
Specify the number of sub-diagonals within the band of the jacobian matrix. If the jacobian is not banded, set ML to at least n - 1. |
||
| integer, | intent(in) | :: | mu |
Specify the number of super-diagonals within the band of the jacobian matrix. If the jacobian is not banded, set MU to at least n - 1. |
||
| real(kind=dp), | intent(in) | :: | epsFcn |
is used in determining a suitable step length for the forward-difference approximation. This approximation assumes that the relative errors in the functions are of the order of EPSFCN. If EPSFCN is less than the machine precision, it is assumed that the relative errors in the functions are of the order of the machine precision. |
||
| real(kind=dp), | intent(inout) | :: | diag(n) |
If MODE = 1, then DIAG is set internally. If MODE = 2, then DIAG must contain positive entries that serve as multiplicative scale factors for the variables. |
||
| integer, | intent(in) | :: | mode |
variables will be scaled internally. 2, scaling is specified by the input DIAG vector. |
||
| real(kind=dp), | intent(in) | :: | factor |
determines the initial step bound. This bound is set to the product of FACTOR and the euclidean norm of DIAG*X if non-zero, or else to FACTOR itself. In most cases, FACTOR should lie in the interval (0.1, 100) with 100 the recommended value. |
||
| integer, | intent(out) | :: | info |
Error flag |
||
| integer, | intent(out) | :: | nFev |
The number of calls to FCN. produced by the QR factorization of the final approximate jacobian. |
||
| real(kind=dp), | intent(out) | :: | fjac(ldfjac,n) |
Out - N by N array which contains the orthogonal matrix Q |
||
| integer, | intent(in) | :: | ldfjac |
The leading dimension of FJAC. LDFJAC must be at least N. |
||
| real(kind=dp), | intent(out) | :: | r(lr) |
Upper triangular matrix produced by the QR factorization of the final approximate jacobian, stored row-wise. |
||
| integer, | intent(in) | :: | lr |
Size of the R array, which must be no less than (N*(N+1))/2. |
||
| real(kind=dp), | intent(out) | :: | qtf(n) |
Contains the vector Q'*FVEC. |
Produces the explicit QR factorization of a matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer | :: | m |
In - number of rows of A and the order of Q |
|||
| integer | :: | n |
In - number of columns of A |
|||
| real(kind=dp) | :: | q(ldq,m) |
In/Out - lower trapezoid in the first min(M,N) / accumulated into a square matrix |
|||
| integer | :: | ldq |
In - not less than M which specifies the leading dimension of the array Q |
computes a QR factorization using Householder transformations.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer | :: | m |
In - number of rows of A. |
|||
| integer | :: | n |
In - number of columns of A. |
|||
| real(kind=dp) | :: | a(lda,n) |
In/Out - before/after QR factosiation size should be the M by N array. |
|||
| integer | :: | lda |
In - leading dimension of A, which must be no less than M. |
|||
| logical | :: | pivot |
Out - is TRUE if column pivoting is to be carried out |
|||
| integer | :: | ipvt(lipvt) |
Out - defines the permutation matrix P such that AP = QR. |
|||
| integer | :: | lipvt |
In - dimension of IPVT, which should be N if pivoting is used. |
|||
| real(kind=dp) | :: | rdiag(n) |
Out - contains the diagonal elements of R. |
|||
| real(kind=dp) | :: | acnorm(n) |
computes A*Q, where Q is the product of Householder transformations
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer | :: | m |
In - number of rows of A |
|||
| integer | :: | n |
In - number of columns of A |
|||
| real(kind=dp) | :: | a(lda,n) |
In/Out - the M by N array. On input, the matrix A to be postmultiplied by the orthogonal matrix Q. On output, the value of A*Q. |
|||
| integer | :: | lda |
In - leading dimension of A, which must not be less than M. |
|||
| real(kind=dp) | :: | v(n) |
In - contain the information necessary to recover the Givens rotations GV |
|||
| real(kind=dp) | :: | w(n) |
In - contain the information necessary to recover the Givens rotations GW |
re-triangularizes a matrix after a rank one update
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer | :: | m |
In - number of rows of S. |
|||
| integer | :: | n |
In - number of columns of S. N must not exceed M. |
|||
| real(kind=dp) | :: | s(ls) |
In/Out - On input, the lower trapezoidal matrix S stored by columns. On output S contains the lower trapezoidal matrix produced as described above. |
|||
| integer | :: | ls |
In - length of the S array. LS must be at least (N(2M-N+1))/2. |
|||
| real(kind=dp) | :: | u(m) |
In - the U vector. |
|||
| real(kind=dp) | :: | v(n) |
In/Out - On input, V must contain the vector V. On output V contains the information necessary to recover the Givens rotations GV described above. |
|||
| real(kind=dp) | :: | w(m) |
Out - contains information necessary to recover the Givens rotations GW described above. |
|||
| logical | :: | sing |
Out - is set to TRUE if any of the diagonal elements of the output S are zero. Otherwise SING is set FALSE. |