m_n_kappa.solver.Newton#
- class m_n_kappa.solver.Newton(data, target, variable)#
Bases:
SolverSolver using the newton method
New in version 0.1.0.
- Parameters:
data (list[dict] | list[list]) – data containing target and variable keys
target (str | int) – key of the target (e.g. str for dictionaries or int for lists)
variable (str | int) – variable of the target (e.g. str for dictionaries or int for lists)
Methods
compute([use_fallback])compute a new value using the newton algorithm
Attributes
passed data
function to compute
x_n_plus_1maximum variable value given in
dataminimum variable value given in
datakey of the target in
datakey of the variable in
datalastly computed variable value
new computed value
- compute(use_fallback=False)#
compute a new value using the newton algorithm
In case the newton algorithm does not lead to an optimization of the variable value then bi-section will be used as fallback. Optimization means improvement of variable-value leading to a target-value nearer zero.
- Parameters:
use_fallback (bool) – use the fallback algorithm (i.e.
Bisection)- Returns:
computed new value leading to target-value nearer zero
- Return type:
float
- property data: list#
passed data
- property function#
function to compute
x_n_plus_1
- property maximum_variable: float#
maximum variable value given in
data
- property minimum_variable: float#
minimum variable value given in
data
- property target: str | int#
key of the target in
data
- property variable: str | int#
key of the variable in
data
- property x_n: float#
lastly computed variable value
- property x_n_plus_1: float#
new computed value