Package space.kscience.kmath.functions

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
interface PiecewisePolynomial<T : Comparable<T>> : Piecewise<T, Polynomial<T>>

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

Link copied to clipboard
class Polynomial<out T>(coefficients: List<T>)

Polynomial coefficients model without fixation on specific context they are applied to.

Link copied to clipboard
class PolynomialSpace<T, C : Ring<T>, ScaleOperations<T>>(ring: C) : Group<Polynomial<T>> , ScaleOperations<Polynomial<T>>

Space of polynomials.

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, C : Ring<T>> Polynomial<T>.asFunction(ring: C): (T) -> T

Represent the polynomial as a regular context-less function.

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 <T, A : Ring<T>, NumericAlgebra<T>> Polynomial<T>.differentiate(algebra: A): Polynomial<T>

Create a polynomial witch represents differentiated version of this polynomial

Link copied to clipboard
fun <T, A : Field<T>, NumericAlgebra<T>> Polynomial<T>.integrate(algebra: A): Polynomial<T>

Create a polynomial witch represents indefinite integral version of this polynomial

fun <T : Comparable<T>> Polynomial<T>.integrate(algebra: Field<T>, range: ClosedRange<T>): T

Compute a definite integral of a given polynomial in a 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
inline fun <T, C : Ring<T>, ScaleOperations<T>, R> C.polynomial(block: PolynomialSpace<T, C>.() -> R): R
Link copied to clipboard
fun Polynomial<Double>.value(arg: Double): Double

Evaluates the value of the given double polynomial for given 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 <T, C : Ring<T>> Polynomial<T>.value(ring: C, arg: T): T

Evaluates the value of the given polynomial for given argument. https://en.wikipedia.org/wiki/Horner%27s_method