get_fa_fb Subroutine

private subroutine get_fa_fb(me, ax, bx, fax, fbx, fa, fb)

Returns the function values at ax and bx to start the root finding algorithm.

Type Bound

root_solver

Arguments

Type IntentOptional Attributes Name
class(root_solver), intent(inout) :: me
real(kind=wp), intent(in) :: ax

left endpoint of initial interval

real(kind=wp), intent(in) :: bx

right endpoint of initial interval

real(kind=wp), intent(in), optional :: fax

if f(ax) is already known, it can be input here

real(kind=wp), intent(in), optional :: fbx

if f(bx) is already known, it can be input here

real(kind=wp), intent(out) :: fa

f(ax) to use

real(kind=wp), intent(out) :: fb

f(ax) to use


Called by

proc~~get_fa_fb~~CalledByGraph proc~get_fa_fb root_module::root_solver%get_fa_fb proc~solve root_module::root_solver%solve proc~solve->proc~get_fa_fb interface~root_scalar root_module::root_scalar proc~solve->interface~root_scalar proc~root_scalar_by_type root_module::root_scalar_by_type proc~root_scalar_by_type->proc~solve interface~root_scalar->proc~root_scalar_by_type proc~root_scalar_by_name root_module::root_scalar_by_name interface~root_scalar->proc~root_scalar_by_name proc~root_scalar_by_name->interface~root_scalar

Source Code

    subroutine get_fa_fb(me,ax,bx,fax,fbx,fa,fb)

    implicit none

    class(root_solver),intent(inout) :: me
    real(wp),intent(in)              :: ax      !! left endpoint of initial interval
    real(wp),intent(in)              :: bx      !! right endpoint of initial interval
    real(wp),intent(in),optional     :: fax     !! if `f(ax)` is already known, it can be input here
    real(wp),intent(in),optional     :: fbx     !! if `f(bx)` is already known, it can be input here
    real(wp),intent(out)             :: fa      !! `f(ax)` to use
    real(wp),intent(out)             :: fb      !! `f(ax)` to use

    if (present(fax)) then
        fa = fax
    else
        fa = me%f(ax)
    end if

    if (present(fbx)) then
        fb = fbx
    else
        fb = me%f(bx)
    end if

    end subroutine get_fa_fb