Solver¶
-
class
Solver
(*args)¶ SolverImplementation of 1D non linear equations.
- Available constructor:
SolverImplementation()
SolverImplementation(solverImplementation)
SolverImplementation(absError, relError, resError, maximumFunctionEvaluation)
- Parameters
- solverImplementationSolverImplementationImplementation
The implementation of a particular solver which is
Bisection
,Brent
orSecant
.- absErrorpositive float
Absolute error: distance between two successive iterates at the end point. Default is .
- relErrorpositive float
Relative error: distance between the two last successive iterates with regards to the last iterate. Default is .
- resErrorpositive float
Residual error: difference between the last iterate value and the expected value. Default is .
- maximumFunctionEvaluationint
The maximum number of evaluations of the function. Default is .
Notes
This class enables to solve 1D non linear equations :
if is a continuous function from to , and if is such that , then has at least a zero in the interval . In particular, it is used in the root research of a
Directional Sampling simulation
.Methods
getAbsoluteError
(self)Accessor to the absolute error.
getClassName
(self)Accessor to the object’s name.
getId
(self)Accessor to the object’s id.
getImplementation
(self)Accessor to the underlying implementation.
Accessor to the maximum number of evaluations of the function.
getName
(self)Accessor to the object’s name.
getRelativeError
(self)Accessor to the relative error.
getResidualError
(self)Accessor to the residual error.
Accessor to the number of evaluations of the function.
setAbsoluteError
(self, absoluteError)Accessor to the absolute error.
setMaximumFunctionEvaluation
(self, …)Accessor to the maximum number of evaluations of the function.
setName
(self, name)Accessor to the object’s name.
setRelativeError
(self, relativeError)Accessor to the relative error.
setResidualError
(self, residualError)Accessor to the residual error.
solve
-
__init__
(self, \*args)¶ Initialize self. See help(type(self)) for accurate signature.
-
getAbsoluteError
(self)¶ Accessor to the absolute error.
- Returns
- absErrorfloat
The absolute error: distance between two successive iterates at the end point.
-
getClassName
(self)¶ Accessor to the object’s name.
- Returns
- class_namestr
The object class name (object.__class__.__name__).
-
getId
(self)¶ Accessor to the object’s id.
- Returns
- idint
Internal unique identifier.
-
getImplementation
(self)¶ Accessor to the underlying implementation.
- Returns
- implImplementation
The implementation class.
-
getMaximumFunctionEvaluation
(self)¶ Accessor to the maximum number of evaluations of the function.
- Returns
- maxEvalint
The maximum number of evaluations of the function.
-
getName
(self)¶ Accessor to the object’s name.
- Returns
- namestr
The name of the object.
-
getRelativeError
(self)¶ Accessor to the relative error.
- Returns
- relErrorfloat
The relative error: distance between the two last successive iterates with regards to the last iterate.
-
getResidualError
(self)¶ Accessor to the residual error.
- Returns
- resErrorfloat
The residual errors: difference between the last iterate value and the expected value.
-
getUsedFunctionEvaluation
(self)¶ Accessor to the number of evaluations of the function.
- Returns
- nEvalint
The number of evaluations of the function.
-
setAbsoluteError
(self, absoluteError)¶ Accessor to the absolute error.
- Parameters
- absErrorfloat
The absolute error: distance between two successive iterates at the end point.
-
setMaximumFunctionEvaluation
(self, maximumFunctionEvaluation)¶ Accessor to the maximum number of evaluations of the function.
- Parameters
- maxEvalint
The maximum number of evaluations of the function.
-
setName
(self, name)¶ Accessor to the object’s name.
- Parameters
- namestr
The name of the object.
-
setRelativeError
(self, relativeError)¶ Accessor to the relative error.
- Parameters
- relErrorfloat
The relative error: distance between the two last successive iterates with regards to the last iterate.
-
setResidualError
(self, residualError)¶ Accessor to the residual error.
- Parameters
- resErrorfloat
The residual errors: difference between the last iterate value and the expected value.