Open stla opened 2 years ago
Hello, sorry it's taken me so long to get back to you. This function is proving somewhat more difficult than I thought. The coefficients of target
and current
are not consistent()
so I can't just subtract one from the other because of disordR
discipline. Writing a,b
for the arguments, I can't just do all.equal(coeffs(a),coeffs(b))
for the same reason. And all.equal(elements(coeffs(a)),elements(coeffs(b)))
is certainly wrong too.
What we want is for the coefficients of a-b
to be "small" compared with the corresponding coefficients of a
and the coefficients of b
. But I can't quite see whether this can be accomplisehd by a call to all.equal.numeric()
or whether a new function is needed. There must be an easy way to do this, but I just can't see it.
Best wishes
Robin
Hi,
I saw you published disordR but I don't know yet what this package does. So for the moment I don't understand your reply. But then why this worked for me? (I don't exactly remember what I did).
I am not at all sure that an implementation of all.equal.mvp()
that directly uses base all.equal()
is possible. Consider
`all.equal.mvp` <- function(target,current,...){
target <- coeffs(target)
current <- coeffs(current)
stopifnot(consistent(target,current))
all.equal.numeric(target,current,...)
}
which seems plausible but the consistency check is way too restrictive.
Hello,
I have two
mvp
polynomials,gmvpol
andmvpol
. If I rungmvpol == mvpol
, I getFALSE
. But that's only because there are very small differences between the coefficients. If I runall.equal(gmvpol[["coeffs"]], mvpol[["coeffs"]])
, then I getTRUE
. So I think it would be nice to have a function to test approximate equality, with a tolerance argument, as inall.equal
.