Changes between Version 4 and Version 5 of symbolics/nonzero


Ignore:
Timestamp:
03/14/18 16:42:20 (15 months ago)
Author:
rws
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • symbolics/nonzero

    v4 v5  
    55On the other hand in many occasions users or Sage itself wants to know if an object is identical (without simplification) to the ring zero (`SR.zero()`) or any other object, which is the same as comparing the identity of `obj1-obj2` with `0`. There is a member of `Expression` namely `is_trivial_zero()` which does this and is very fast.
    66
    7 Up to March 2018 all `bool(obj1 rel obj2)` queries, with one of the objects a symbolic expression. were delegated to `Expression.__nonzero__` that tried every trick to get a final answer. This situation is not satisfactory because users writing `if ex==0:` do not expect it. Even more hidden, generic code that tries to be helpful uses it and slows down unnecessarily in consequence.
     7Up to March 2018 all `bool(obj1 rel obj2)` queries, with one of the objects a symbolic expression were delegated to `Expression.__nonzero__` that tried every trick to get a final answer. This situation is not satisfactory because users writing `if ex==0:` do not expect it. Even more hidden, generic code that tries to be helpful uses it and slows down unnecessarily in consequence.
    88
    99The ticket #19162 outlines an interface that solves the problem. The roadmap to it however is unclear, even if there were interested reviewers. This page tries to collect all available information.
    1010
    11 == Modules using Expression.__nonzero__ ==
     11== Modules using `Expression.__nonzero__` ==
    1212
    1313About 320 files under `src/sage` have doctests that, directly or indirectly, call `Expression.__nonzero__`. Notable unaffected major sections are finance, game_theory, homology, logic, matroids, monoids, probability, quadratic_forms, quivers, and sat. This is not surprising because usually it works, and performance is only a secondary consideration. Also the fact that equality has several different meanings with expressions is not widely appreciated.