Even if we fix log(1.0) this sort of thing could happen in other places. There should be some canonical way to remove floating point numbers that are smaller than their given precision (i.e., almost equal to 0). evalf(chop=True) does this, but there should be some way to do it without calling evalf on the expression. But I'm not sure what it is if there is such a way.
Aaron Meurer On Fri, Jan 3, 2014 at 11:39 AM, Avichal Dayal <[email protected]> wrote: > Floating point numbers are causing wrong answers with limits. > See issue 2284: > http://code.google.com/p/sympy/issues/detail?can=2&q=2284&colspec=ID%20Type%20Status%20Priority%20Milestone%20Reporter%20Summary%20Stars&id=2284 > > I was trying to solve it but I'm not able to find a good solution. Take the > case of limit(log(1.0+x)/x, x, 0) > Here log(1.0) = 2.36364252615315e-125 and not 0. Because of this, series of > log(1.0+x) / x contains the term > 2.36364252615315e-125 / x which evaluates to infinity at x = 0. > Hence the answer provided by sympy is infinity and not 1. > > I tried to resolve this by nsimplify which will simplify > 2.36364252615315e-125 to 0 but that's too slow and > probably won't work. > > Is it really necessary to keep log(1.0) as 2.36364252615315e-125. Even In > python's math library, log(1.0) is 0. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
