dotnetCHARTING Send comments on this topic.
AddNonLinearCosineSum Method
See Also 
dotnetCHARTING Namespace > ForecastEngine.Options Class : AddNonLinearCosineSum Method


cosCoeff
An array where the k-th term is the coefficient of the (k+1)-th term of the sum of Cosine terms (i.e. a_k).
coefficient
An array where the k-th term is the coefficient of the Cosine term of the (k+1)-th term of the sum of the Cosine terms (i.e. b_k).
constant
An array where the k-th term is the constant shift in the x-axis of the Cosine term of the (k+1)-th term of the sum of Cosine terms (i.e. c_k).
exponent
An array where the k-th term is the exponent of the Cosine term within the (k+1)-th term of the sum of the Cosine terms (i.e. n_k).
Adds a sum a Cosine functions as an element of the function basis.

Syntax

Visual Basic (Declaration)  
Public Shared Sub AddNonLinearCosineSum( _
   ByVal cosCoeff() As Double, _
   ByVal coefficient() As Double, _
   ByVal constant() As Double, _
   ByVal exponent() As Double _
) 
Visual Basic (Usage) Copy Code
Dim cosCoeff() As Double
Dim coefficient() As Double
Dim constant() As Double
Dim exponent() As Double
 
ForecastEngine.Options.AddNonLinearCosineSum(cosCoeff, coefficient, constant, exponent)
C#  
public static void AddNonLinearCosineSum( 
   double[] cosCoeff,
   double[] coefficient,
   double[] constant,
   double[] exponent
)

Parameters

cosCoeff
An array where the k-th term is the coefficient of the (k+1)-th term of the sum of Cosine terms (i.e. a_k).
coefficient
An array where the k-th term is the coefficient of the Cosine term of the (k+1)-th term of the sum of the Cosine terms (i.e. b_k).
constant
An array where the k-th term is the constant shift in the x-axis of the Cosine term of the (k+1)-th term of the sum of Cosine terms (i.e. c_k).
exponent
An array where the k-th term is the exponent of the Cosine term within the (k+1)-th term of the sum of the Cosine terms (i.e. n_k).

Remarks

Please note that the k-th term of the sum which makes up the basis function will take to form:

k-th Term = r_k * a_(4k) * (Cosn_k + a_(4k+1) (b_k * a_(4k+2) * x + c_k + a_(4k+3))), (*)

where the Cosine function is in terms of radians, and r_k, n_k, b_k, c_k are real numbers which are given by the parameters and a_(4k), a_(4k+1), a_(4k+2), a_(4k+3), a_(4k+4), are the variables which are to be fitted. In order to construct the sum you just sum over k starting at 0. That is, the term from which the basis elements will be constructed is:

f(x, a_0, ..., a_4, ...., a_(4n+3)) = (sum of k of n-terms given by (*) above),

where a_0,....., a_(4n+3) are the variables of the function which are to be fitted, and x is the variable which will not be fitted.

Example

In order to clarify the above explanation we provide an explicit example. In particular, in order to represent the following sum of cosine terms:

f(x, a_0, a_1, ..., a_7) = a_0 * Cos2 * a_1 (b_0 * a_2 * x + a_3) + a_4 * Cos(1 * a_5) (b_1 * a_6 * x + 2 + a_7),

you are required to pass the following parameters:

Notes on the Radian measure

Radians are a means by which to describe the angle and are related to the more commonly used degrees as follows:

360 degrees = 2 * Pi * radians

therefore, 1 radian = 180 / Pi degrees = 57.295... degrees.

See Also