Dew Stats Master .NET
ExpEval Routines
Summary
Evaluates exponential function.

Unit
RegModels

Declaration
Procedure ExpEval(const B: array of TSample; X, YHat: TVec);

Description
Evaluates b[0]*Exp(b[1]*X) for given values in X vector, parameters in B array, and returns the results in XHat vector. Size and Complex properties of XHat vector are adjusted automatically.

Use this version if you want to evaluate exponential function for multiple values at the same time. This is a lot faster than calling single value version for each x value.

Categories
Linearizable regression models
 See Also 
ExpDeriv 
ExpFit 

Example 1

Evaluate exponential function for multiple values at the same time.

Uses MathExpr, MtxVecTee, Series, RegModels; procedure Example(Series1: TLineSeries); var Y,X: Vector; begin X.Size(100); X.Ramp(-5.0, 0.05); // x= -5.0, -4.95, ... -0.05 // Y = b[0] + b[1]*X ExpEval([1,3],X,Y); DrawValues(X,Y,Series1,false); end;
#include "Math387.hpp" #include "RegModels.hpp" void __fastcall Example(TLineSeries* Series1); { Vector X,Y; X->Size(100,false); X->Ramp(-5.0, 0.05); // x= -5.0, -4.95, ... -0.05 ExpEval(OPENARRAY(TSample,(3.0, -0.5)),X,Y); DrawValues(X,Y,Series1,false); }
using Dew.Math; using Dew.Stats.Units; namespace Dew.Examples { private void Example(Steema.TeeChart.Styles.Line line1) { Vector X = new Vector(100); Vector Y = new Vector(0); X.Ramp(-5.0, 0.05); // x= -5.0, -4.95, ... -0.05 // Y = b[0] + b[1]*X RegModels.ExpEval(new double[] {1,3},X,Y); MtxVecTee.DrawValues(X,Y,line1,false); } }



Declaration
Function ExpEval(const B: array of TSample; X: TSample): TSample;
Result
b[0]*Exp(b[1]*X) for given value X and parameters in B array.

Example 1

Evaluate exponential function for single x.

Uses Math387, RegModels; var y: TSample; begin y := ExpEval([3,-0.5], 1.5); // Res = 3*Exp(-0.5*1.5) = 1.4170996582 end;
#include "Math387.hpp" #include "RegModels.hpp" void __fastcall Example(); { double y = ExpEval(OPENARRAY(TSample,(3.0, -0.5)),1.5); // y = 3*Exp(-0.5*1.5) = 1.4170996582 }
using Dew.Math; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { double y = RegModels.ExpEval(new double[] {3.0, -0.5}, 1.5); // y = 3*Exp(-0.5*1.5) = 1.4170996582 } }



Declaration
Procedure ExpEval(B, X, YHat: TVec);

Description
The B parameter can be a vector.

Copyright 2008 Dew Research
http://www.dewresearch.com