CPolynomial:Empty CPolynomial:Get

CPolynomial:Exists


The Exists method returns true if a coefficient has been initialized at a given index.

Syntax

bSuccess = CPolynomial:Exists( index )

Remarks

If you use Init then the first n coefficient values are set and this function will return true if tested with index in range. Otherwise, the coefficient values are not initialized if you do not Set them or if you Remove them.

Example

The following script fragment tests whether the coefficient at index [3] has been initialized:

 

P = CPolynomial:new()

-- create a CPolynomial

P:Set( 4, 0.112)

-- set coef[4]

P:Set( 1, 5.5)

-- set coef[1]

if ( P:Exists(3) ) then

-- has coef[3] been set?

  s = "yes" else s = "no"

 

end

 

Printf("coef[3] exists= %s", s)

-- result: coef[3] exists= no

Related Topics

CPolynomial, Count