Companion

object Companion

Functions

Link copied to clipboard
fun ofLinearFunctions(starts: List<Double>, intercepts: List<Double>, prependConstant: Boolean = false, appendConstant: Boolean = true): UnivariateFunction

Creates a concatenated function of a list of linear functions, whereby the slopes are adjusted so that the concatenated function is continuous. For example: f(x) = slope_1 * x + 0 for [0, 5) f(x) = slope_2 * x - 5 for [5, ∞) The starts would be listOf(0, 5) and the intercepts would be listOf(0, -5).

Link copied to clipboard
fun ofPolynomialFunctions(starts: NonEmptyList<Double>, coefficients: NonEmptyList<DoubleArray>, prependConstant: Boolean = false, prependConstantValue: Double = Double.NaN): UnivariateFunction

Creates a concatenated function with a list of polynomial function. For example: f(x) = 2 + 3x + 4x^2 + x^3 for [-2, 3) f(x) = 1 + 2x + 3x^2 + 4* x^3 for [3, ∞) The starts would be listOf(-2, 3) and the coefficients would be listOf(arrayOf(2, 3, 4, 1), arrayOf(1, 2, 3, 4)).