Overload List
| # | Signature | Description |
|---|---|---|
| 1 | procedure PowerEval(const B: TVec; const X: TVec; const YHat: TVec); | Evaluate power function model (vectorized version). |
| 2 | procedure PowerEval(const B: TDoubleArray; const X: TVec; const YHat: TVec); | Evaluates b[0]*X^b[1] for given values in X vector, parameters in B array, and returns the results in XHat vector. |
| 3 | function PowerEval(const B: TDoubleArray; X: Double): Double; | Evaluates power function. |
Overload 1: procedure PowerEval(const B: TVec; const X: TVec; const YHat: TVec);
Evaluate power function model (vectorized version).
| # | Name | Type | Description |
|---|---|---|---|
| 1 | B | TVec | |
| 2 | X | TVec | |
| 3 | YHat | TVec |
Result: stored in self (calling object)
Overload 2: procedure PowerEval(const B: TDoubleArray; const X: TVec; const YHat: TVec);
Evaluates b[0]*X^b[1] for given values in X vector, parameters in B array, and returns the results in XHat vector.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | B | TDoubleArray | |
| 2 | X | TVec | |
| 3 | YHat | TVec |
Result: stored in self (calling object)
Remarks:
Size and Complex properties of XHat vector are adjusted automatically.
Note
Use this version if you want to evaluate power function for multiple values at the same time. This is a lot faster than calling single value version for each x value.
Examples
Uses MtxExpr, MtxVecTee, Series, RegModels;
procedure Example(Series1: TLineSeries);
var Y,X: Vector;
begin
X.Size(100);
X.Ramp(-5.0, 0.1); // x= -5.0, -4.9, ..., +4.9
// Y = b[0] + b[1]*X
PowerEval([1,3],X,Y);
DrawValues(X,Y,Series1,false);
end;
See Also: RegModels.PowerDeriv, RegModels.PowerFit
Overload 3: function PowerEval(const B: TDoubleArray; X: Double): Double;
Evaluates power function.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | B | TDoubleArray | |
| 2 | X | Double | scalar |
Returns: Double - b[0]*X^b[1] for given value X and parameters in B array.
Examples
Uses RegModels, Math387;
procedure Example;
var y: double;
begin
y := PowerEval([-5,3.5], 2.0);
// y = -5.0*(2.0)^(3.5) = -56.568542495
end;