Module for solving non-linear equations of the form: There are specific functions for the scalar case.
Solves the scalar non-linear equation: using the bisection method on the interval
| Type | Intent | Optional | Attributes | Name | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public function f(x) result(y)function defining the non-linear equation Arguments
Return Value realdependent 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: |
||||||||||||||||
numerical aproximation to the solution
Solves the scalar non-linear equation: using Newton's method.
| Type | Intent | Optional | Attributes | Name | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public function f(x) result(y)function defining the non-linear equation Arguments
Return Value realdependent variable |
||||||||||||||||||||
public function df(x) result(y)derivative of function Arguments
Return Value realdependent 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 |
||||||||||||||||
numerical aproximation to the solution
Solves the scalar non-linear equation: using the secant method.
| Type | Intent | Optional | Attributes | Name | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public function f(x) result(y)function defining the non-linear equation Arguments
Return Value realdependent 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 |
||||||||||||||||
numerical aproximation to the solution
Solves the vector non-linear equation: using Newton's method.
| Type | Intent | Optional | Attributes | Name | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public function f(x) result(y)function defining the non-linear equation Arguments
Return Value real, (size(x))dependent variable |
||||||||||||||||||||
public function J(x) result(y)jacobian of function Arguments
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 |
||||||||||||||||
numerical aproximation to the solution