ofLinearFunctions

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).

Parameters

starts

absolute start value of the function member

intercepts

local intercept of the linear function

prependConstant

if true, the first linear function is preceded by a constant function

appendConstant

if true, the last linear function is appended by a constant function