Some simple Newton solvers
constructor for the Min1D type wrapped for Root1D
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Min1D), | intent(in) | :: | parent |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Min1D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Root1D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Root1D_FdF), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Min2D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x(2) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Min2D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x(2) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Min2D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x(2) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Root2D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x(2) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Root2D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x(2) |
| procedure(i_newton_Min1D), public, deferred :: FR | |
| procedure(i_newton_Min1D), public, deferred :: dFR | |
| procedure(i_newton_Min1D), public, deferred :: ddFR |
| procedure(i_newton_Root1D), public, deferred :: FR | |
| procedure(i_newton_Root1D), public, deferred :: dFR |
This functional wraps a functional passed to Min1D for use with Root1D (returns the derivative: FR -> dFR, dFR -> ddFR)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| class(c_newton_Min1D), | public, | ALLOCATABLE | :: | parent |
| public function newton_Root1D_wrap_Min1D_new (parent) | constructor for the Min1D type wrapped for Root1D |
| procedure, public :: FR => newton_Root1D_wrap_Min1D_FR | |
| procedure, public :: dFR => newton_Root1D_wrap_Min1D_dFR |
| procedure(i_newton_Root1D_FdF), public, deferred :: FRdFR |
| procedure(i_newton_Min2D_FR), public, deferred :: FR | |
| procedure(i_newton_Min2D_dFR), public, deferred :: dFR | |
| procedure(i_newton_Min2D_ddFR), public, deferred :: ddFR |
| procedure(i_newton_Root2D_FR), public, deferred :: FR | |
| procedure(i_newton_Root2D_dFR), public, deferred :: dFR |
Newton's iterative algorithm to find the minimimum of function f(x) in the interval [a,b], using df(x)=0 and the derivative
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | tol |
abort tolerance |
||
| real(kind=wp), | intent(in) | :: | a |
search interval |
||
| real(kind=wp), | intent(in) | :: | b |
search interval |
||
| real(kind=wp), | intent(in) | :: | maxstep |
max|dx| allowed |
||
| real(kind=wp), | intent(inout) | :: | x |
initial guess on input, result on output |
||
| class(c_newton_Min1D), | intent(in) | :: | fobj |
functional to minimize with f(x), d/dx f(x), d^2/dx^2 f(x) |
on output =f(x)
constructor for the Min1D type wrapped for Root1D
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_newton_Min1D), | intent(in) | :: | parent |
f(x) function of the Min1D type wrapped for Root1D
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_newton_Root1D_wrap_Min1D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x |
d/dx f(x) function of the Min1D type wrapped for Root1D
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_newton_Root1D_wrap_Min1D), | intent(in) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | x |
Newton's iterative algorithm to find the root of function FR(x(:)) in the interval [a(:),b(:)], using d/dx(:)F(x)=0 and the derivative
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | tol |
abort tolerance |
||
| real(kind=wp), | intent(in) | :: | a |
search interval |
||
| real(kind=wp), | intent(in) | :: | b |
search interval |
||
| real(kind=wp), | intent(in) | :: | maxstep |
max|dx| allowed |
||
| real(kind=wp), | intent(in) | :: | xin |
initial guess |
||
| real(kind=wp), | intent(in) | :: | F0 |
function to find root is FR(x)-F0 |
||
| class(c_newton_Root1D) | :: | fobj |
on output =f(x)
Newton's iterative algorithm to find the root of function FR(x(:)) in the interval [a(:),b(:)], using d/dx(:)F(x)=0 and the derivative
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | tol |
abort tolerance |
||
| real(kind=wp), | intent(in) | :: | a |
search interval |
||
| real(kind=wp), | intent(in) | :: | b |
search interval |
||
| real(kind=wp), | intent(in) | :: | maxstep |
max|dx| allowed |
||
| real(kind=wp), | intent(in) | :: | xin |
initial guess on input |
||
| real(kind=wp), | intent(in) | :: | F0 |
function to find root is FR(x)-F0 |
||
| class(c_newton_Root1D_FdF) | :: | fobj |
function to find root f(x) & derivative d/dx f(x) as FRdFR method |
output x for f(x)=0
Newton's iterative algorithm to find the minimimum of function f(x,y) in the interval x(i)[a(i),b(i)], using grad(f(x)=0 and the derivative
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | tol |
abort tolerance |
||
| real(kind=wp), | intent(in) | :: | a(2) |
search interval (2D) |
||
| real(kind=wp), | intent(in) | :: | b(2) |
search interval (2D) |
||
| real(kind=wp), | intent(inout) | :: | x(2) |
initial guess on input, result on output |
||
| class(c_newton_Min2D) | :: | fobj |
functional f(x,y) to minimize with f, f', f'' |
on output =f(x,y)
Newton's iterative algorithm to find the root of function [f1(x1,x2),f2(x1,x2)]=[0,0] in the interval a(i)<=x(i)<=b(i), using the Jacobian dfi/dxj, i=1,2, j=1,2, such that fi(x1,x2)=fi(x1_0,x2_0)+ [dfi/dx1,dfi/dx2].[dx1,dx2] in each step, we find dx1,dx2 st -[[dfi/dxj]] dxj =fi(x1_0,x2_0)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | tol |
abort tolerance |
||
| real(kind=wp), | intent(in) | :: | a(2) |
search interval (2D) |
||
| real(kind=wp), | intent(in) | :: | b(2) |
search interval (2D) |
||
| real(kind=wp), | intent(in) | :: | maxstep(2) |
max|dx| allowed |
||
| real(kind=wp), | intent(in) | :: | xin(2) |
initial guess |
||
| class(c_newton_Root2D) | :: | fobj |
function to find root f1(x1,x2)=0,f2(x1,x2)=0 and derivatives d fi(x1,x2)/dxj |
x1,x2 that have f1(x1,x2)=0 and f2(x1,x2)=0