Class NumericalSolver
A numerical solver for systems of equations using the Jacobian matrix.
public class NumericalSolver
- Inheritance
-
NumericalSolver
- Inherited Members
- Extension Methods
Constructors
NumericalSolver(SetParasDelegate, int, GetRepondsDelegate, int, double, double, int)
Initializes a new instance of the NumericalSolver class.
public NumericalSolver(NumericalSolver.SetParasDelegate setParasFunc, int paraNum, NumericalSolver.GetRepondsDelegate getResponsesFunc, int targetNum, double partialInterval, double tolerance, int iterationLimit = 12)
Parameters
setParasFunc
NumericalSolver.SetParasDelegateFunction to set parameter values
paraNum
intNumber of parameters in the system
getResponsesFunc
NumericalSolver.GetRepondsDelegateFunction to get response values
targetNum
intNumber of target values (equations) in the system
partialInterval
doubleInterval for calculating partial derivatives
tolerance
doubleTolerance for convergence
iterationLimit
intMaximum number of iterations allowed
Properties
GetResponsesFunc
Gets the function used to get response values.
public NumericalSolver.GetRepondsDelegate GetResponsesFunc { get; }
Property Value
HalfPartialInterval
Gets half of the partial interval value for optimization.
public double HalfPartialInterval { get; }
Property Value
IterationLimit
Gets or sets the maximum number of iterations allowed.
public int IterationLimit { get; set; }
Property Value
ParaNum
Gets or sets the number of parameters in the system.
public int ParaNum { get; set; }
Property Value
Paras
Sets the parameter values in the system being solved.
public double[] Paras { set; }
Property Value
- double[]
PartialInterval
Gets or sets the interval used for calculating partial derivatives.
public double PartialInterval { get; set; }
Property Value
Responses
Gets the response values from the system being solved.
public double[] Responses { get; }
Property Value
- double[]
SetParasFunc
Gets the function used to set parameter values.
public NumericalSolver.SetParasDelegate SetParasFunc { get; }
Property Value
TargetNum
Gets or sets the number of target values (equations) in the system.
public int TargetNum { get; set; }
Property Value
Tolerance
Gets or sets the tolerance for convergence.
public double Tolerance { get; set; }
Property Value
Methods
ErrorFunc(double[], double[])
Calculates the error (difference) between the system responses and target values.
public double[] ErrorFunc(double[] paras, double[] targets)
Parameters
Returns
- double[]
An array of error values
Solve(double[], double[], out double, out double[,])
Solves the system of equations using numerical methods.
public SolvingResultStatus Solve(double[] paras, double[] targets, out double minBias, out double[,] jacob)
Parameters
paras
double[]The initial parameter values, will be modified during solving
targets
double[]The target values to solve for
minBias
doubleOutput parameter that will contain the minimum bias (error) found
jacob
double[,]Output parameter that will contain the final Jacobian matrix
Returns
- SolvingResultStatus
The status of the solving process
Remarks
Note that the paras
array will be modified during solving.