CPolynomial:MaxOrder CPolynomial:Set

CPolynomial:Remove


The Remove method removes the coefficient at index n.

Syntax

value = CPolynomial:Remove( n )

    n is the coefficient order to remove.

    On success, the numeric value of the removed coefficient is returned.

    On failure, 0 is returned.

Example

The following script fragment removes the value at index 3:

 

P = CPolynomial:new()

-- create a CPolynomial object

P:Set(0, 0.144)

-- set coef[0]

P:Set(3, -0.0045)

-- set coef[3]

Printf("N = %d", P:Count())

-- result: N = 2

v = P:Remove(3)

-- remove coef[3]

Printf("N= %d, x=%lg", P:Count(), v)

-- result: N = 1, x=-0.0045

Related Topics

CPolynomial, Count