Spurious zeros returned by dirtyfindzeros when a non differentiable function is involved (from gforge #18289)
Imported issue: Initially reported by @chevilla in https://gforge.inria.fr/tracker/?group_id=1015&aid=18289
The following example illustrates that dirtyfindzeros returns points that are not at all zeros of the expression, when the expression involves functions such as floor. I do not know if it can really be called a bug since dirtyfindzeros is semantically allowed to return anything, especially if the function is not continous. However the behavior in undesirable.
My felling is that the problem would disappear if diff(floor) was not replaced by a constant, but by something that is aware of the discontinuity.
dirtyfindzeros(x^2-floor(x)^2-x*floor(x), [-1, 3]);
Warning: the floor operator is not differentiable.
Replacing it by a constant function when differentiating.
Warning: the floor operator is not differentiable.
Replacing it by a constant function when differentiating.
[|0, 1, 1.61803398874989484820458683436563811772030917980575, 2|]
evaluate(x^2-floor(x)^2-x*floor(x), 0);
0
evaluate(x^2-floor(x)^2-x*floor(x), 1);
-1
evaluate(x^2-floor(x)^2-x*floor(x), 2);
-4