Package-level declarations

Types

Link copied to clipboard
typealias Function1D<T> = (T) -> T
Link copied to clipboard
typealias FunctionND<T> = (Buffer<T>) -> T
Link copied to clipboard
fun interface Piecewise<in T, out R>

Represents piecewise-defined function.

Link copied to clipboard
class PiecewiseBuilder<T : Comparable<T>>(delimiter: T)

A Piecewise builder where all the pieces are ordered by the Comparable type instances.

Link copied to clipboard

Represents piecewise-defined function where all the sub-functions are polynomials.

Link copied to clipboard
data class Polynomial<out C>(val coefficients: List<C>)

Represents univariate polynomial that stores its coefficients in a List.

Link copied to clipboard

Arithmetic context for univariate polynomials with coefficients stored as a List constructed with the provided ring of constants.

Functions

Link copied to clipboard
fun <T : Comparable<T>, C : Ring<T>> PiecewisePolynomial<T>.asFunction(ring: C): (T) -> T?

Convert this polynomial to a function returning nullable value (null if argument is outside piecewise range).

fun <T : Comparable<T>, C : Ring<T>> PiecewisePolynomial<T>.asFunction(ring: C, defaultValue: T): (T) -> T

Convert this polynomial to a function using defaultValue for arguments outside the piecewise range.

Link copied to clipboard
fun <C, A : Ring<C>> Polynomial<C>.asFunctionOver(ring: A): (C) -> C

Represent this polynomial as a regular context-less function.

Link copied to clipboard

Represents this constant as a Polynomial.

Link copied to clipboard

Returns algebraic derivative of received polynomial.

Link copied to clipboard

Returns algebraic antiderivative of received polynomial.

Computes a definite integral of this polynomial in the specified range.

Link copied to clipboard
@PerformancePitfall(message = "findPiece method of resulting piecewise is slow")
fun <T : Comparable<T>> PiecewisePolynomial(pieces: Collection<Pair<ClosedRange<T>, Polynomial<T>>>): PiecewisePolynomial<T>

A generic piecewise without constraints on how pieces are placed

fun <T : Comparable<T>> PiecewisePolynomial(startingPoint: T, builder: PiecewiseBuilder<T>.() -> Unit): PiecewisePolynomial<T>

A builder for PiecewisePolynomial

Link copied to clipboard
fun <C> Polynomial(vararg coefficients: C, reverse: Boolean = false): Polynomial<C>
fun <C> Polynomial(coefficients: List<C>, reverse: Boolean = false): Polynomial<C>

Constructs a Polynomial instance with provided coefficients. The collection of coefficients will be reversed if reverse parameter is true.

Link copied to clipboard
inline fun <C, A : Ring<C>, ScaleOperations<C>, R> A.polynomialSpace(block: PolynomialSpace<C, A>.() -> R): R

Creates a PolynomialSpace's scope over a received ring.

Link copied to clipboard

Evaluates value of this Double polynomial on provided Double argument.

fun <T : Comparable<T>, C : Ring<T>> PiecewisePolynomial<T>.value(ring: C, arg: T): T?

Return a value of polynomial function with given ring a given arg or null if argument is outside piecewise definition.

fun <C> Polynomial<C>.value(ring: Ring<C>, arg: C): C

Evaluates value of this polynomial on provided argument.

Properties

Link copied to clipboard

Creates a PolynomialSpace over a received ring.