Open hsloot opened 1 year ago
Consider representing Bernstein functions as a vector space over a basis consisting of one to two parametric Bernstein functions. For example
setClass(
"VectorBernsteinFunction",
contains = "BernsteinFunction",
slots = c(
coefficients = "numeric",
basis = "list" ## list of basis Bernstein functions
)
setValidity(
"VectorBernsteinFunction",
function(object) {
if (!qtest(object@coefficients, "N+(0,)")) {
return(error_msg_domain("coefficients", "N+(0,)"))
}
if (!test_list(object@basis, types = "BasisBernsteinFunction", any.missing = FALSE, len = length(coefficients))) {
return(error_msg_domain("basis")
}
invisible(TRUE)
})
Summary
The current (public) representations of Bernstein functions are not unique; thus potentially leading to the issue that
identical(bf1, bf2)
is false even ifbf1
andbf2
represent the same Bernstein function. Additionally, the current system leads to very confusing printed representations for larger sums; see reprex below.Proposal
The public API should have a one-for-all Bernstein function representation that allows representing sums, scaling, and composite scaling. The representation should be unique, i.e., a Bernstein function must not have more than one representation (as far as this is possible).
Additional context
Created on 2023-02-04 with reprex v2.0.2