data class PolynomialFunction: UnivariateFunction

Polynomial function of form f(x) = c0 + c1*x + c2*x^2 + ... + c\[N]*x^N.

Fields

Name Description
val degree: /** degree of the polynomial function */

degree of the polynomial function

val coefficients: DoubleArray

coefficients for f(x), whereby coefficients0 corresponds to c0

val domain: Range<Double>

domain for which the polynomial function is defined

Constructors

<init>

constructor(coefficients: List<Double>)

Parameters

Name Description
coefficients: List<Double>

<init>

constructor(coefficients: DoubleArray, domain: Range<Double>)

Polynomial function of form f(x) = c0 + c1*x + c2*x^2 + ... + c\[N]*x^N.

Parameters

Name Description
coefficients: DoubleArray

coefficients for f(x), whereby coefficients0 corresponds to c0

domain: Range<Double>

domain for which the polynomial function is defined

Methods

valueOrNull

fun valueOrNull(x: Double): Double?

Returns the calculated value of f(x), if x is within the function's domain. Otherwise null is returned.

Parameters

Name Description
x: Double

ReturnValue

Name Description
Double?

equals

fun equals(other: Any?): Boolean

Parameters

Name Description
other: Any?

ReturnValue

Name Description
Boolean

hashCode

fun hashCode(): Int

ReturnValue

Name Description
Int

toString

fun toString(): String

ReturnValue

Name Description
String

CompanionObject

PolynomialFunction

data class PolynomialFunction: UnivariateFunction

Polynomial function of form f(x) = c0 + c1*x + c2*x^2 + ... + c\[N]*x^N.

Methods

of

fun of(coefficients: DoubleArray, length: Double, upperBoundType: BoundType): PolynomialFunction

Build a polynomial function with providing its length, which is used to construct the domain [0, length

Parameters

Name Description
coefficients: DoubleArray

the polynomial's coefficients

length: Double

the length of the domain 0,length

upperBoundType: BoundType

open or closed upper bound type

ReturnValue

Name Description
PolynomialFunction