non_linear_solvers Module

Module for solving non-linear equations of the form: There are specific functions for the scalar case.


Uses

  • module~~non_linear_solvers~~UsesGraph module~non_linear_solvers non_linear_solvers module~linear_solvers linear_solvers module~non_linear_solvers->module~linear_solvers

Used by

  • module~~non_linear_solvers~~UsedByGraph module~non_linear_solvers non_linear_solvers program~test_non_linear_solvers test_non_linear_solvers program~test_non_linear_solvers->module~non_linear_solvers

Functions

public function Bisection(f, a, b, err_x) result(x)

Solves the scalar non-linear equation: using the bisection method on the interval

Arguments

Type IntentOptional Attributes Name
public function f(x) result(y)

function defining the non-linear equation

Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x

independent variable

Return Value real

dependent variable

real, intent(in) :: a

left boundary of the interval

real, intent(in) :: b

right boundary of the interval

real, intent(in) :: err_x

admisible error in the solution, that is:

Return Value real

numerical aproximation to the solution

public function Newton(f, df, x0, err_x, err_f, max_iter) result(x)

Solves the scalar non-linear equation: using Newton's method.

Arguments

Type IntentOptional Attributes Name
public function f(x) result(y)

function defining the non-linear equation

Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x

independent variable

Return Value real

dependent variable

public function df(x) result(y)

derivative of function

Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x

independent variable

Return Value real

dependent variable

real, intent(in) :: x0

initial aproximation to the solution

real, intent(in) :: err_x

admisible error in the solution

real, intent(in) :: err_f

admisible error in the equation

integer, intent(in) :: max_iter

maximum number of iterations

Return Value real

numerical aproximation to the solution

public function Secant(f, x0, err_x, err_f, max_iter) result(x)

Solves the scalar non-linear equation: using the secant method.

Arguments

Type IntentOptional Attributes Name
public function f(x) result(y)

function defining the non-linear equation

Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x

independent variable

Return Value real

dependent variable

real, intent(in) :: x0(2)

array containing the first and second aproximations to the solution

real, intent(in) :: err_x

admisible error in the solution

real, intent(in) :: err_f

admisible error in the equation

integer, intent(in) :: max_iter

maximum number of iterations

Return Value real

numerical aproximation to the solution

public function VectorNewton(f, J, x0, err_x, err_f, max_iter) result(x)

Solves the vector non-linear equation: using Newton's method.

Arguments

Type IntentOptional Attributes Name
public function f(x) result(y)

function defining the non-linear equation

Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x(:)

independent variable

Return Value real, (size(x))

dependent variable

public function J(x) result(y)

jacobian of function

Arguments
Type IntentOptional Attributes Name
real, intent(in) :: x(:)

independent variable

Return Value real, (size(x),size(x))

dependent variable

real, intent(in) :: x0(:)

initial aproximation to the solution:

real, intent(in) :: err_x

admisible error in the solution

real, intent(in) :: err_f

admisible error in the equation

integer, intent(in) :: max_iter

maximum number of iterations

Return Value real, (size(x0))

numerical aproximation to the solution