Given the vectors (breaks[1],...,breaks[n])
and the list of IBMPopSim
compatible
functions funs = (f[0],f[1],...,f[n])
(one value more!), piecewise_x(breaks, funs)
returns
the function
$$f(x) = f_0(x){1}_{x\le breaks[1]}+\sum_{k=1}^{n-1} f_k(x) {1}_{[breaks_{k}, breaks_{k+1})}(x) + f_n(x){1}_{x \ge breaks[n]}$$
piecewise_x(breaks, funs)
Piecewise function built with the given intervals and functions.
A C++ version of this function is available. See vignette('IBMPopSim_cpp')
for more details.