Hi Consider the following expression which contains multiplication by inexact 0
E^(-0.400000000000000 a -
4.45401233327988 b) (1.000000000000 E^(
0.400000000000000 a + 4.45401233327988 b) +
0.*10^-13 E^(0.400000000000000 a + 0.172989402425367 b)
k + (0.*10^-13 + 0.*10^-13 a) E^(0.172989402425367 b)
k + (0.*10^-13 + 0.*10^-13 a) E^(4.28102293085451 b)
k + (0.*10^-13 + 0.*10^-13 a) E^(4.50802466655976 b) k +
0.*10^-13 E^(0.400000000000000 a + 4.28102293085451 b) k +
0.*10^-13 E^(0.400000000000000 a + 4.50802466655976 b) k)
It was produced by
Chop[D[Jf[x, a, b], x] /. x -> b] /. {x_Real /; x == 0 -> 0}
It's hard to give a complete and simple definition of Jf, but I hope that may not be necessary. Suffice to say Chop did not do his job; it would be nice to have some pattern replacement fixup, like /. {x_Real /; x == 0 -> 0} (this did not work, of course, since 0.*10^-13 is not 0). I tried also without success
(D[Jf[x, a, b], x] /. x -> b) /. {0.*10^-13 -> 0}
Chop[]
, then?Chop[expr, 1.*^-12]
. $\endgroup$Chop
. Note also thatChop
will work on your final expression to return 1. Since you did not give us the expression forJf
, we cannot check the original computation. Also, your pattern replacement comparison{x_Real /; x == 0 -> 0}
relies onEqual
's internal tolerance for numerical expressions: you may need to adjust that to your needs, or at least be aware of that. You could also usePossibleZeroQ
. $\endgroup$