#10053: Equality testing instead of comparisons in differential forms code
-----------------------------------+----------------------------------------
   Reporter:  jvkersch             |       Owner:  burcin                     
       Type:  defect               |      Status:  needs_review               
   Priority:  major                |   Milestone:                             
  Component:  symbolics            |    Keywords:  forms, comparison, equality
     Author:  Joris Vankerschaver  |    Upstream:  N/A                        
   Reviewer:  Niles Johnson        |      Merged:                             
Work_issues:                       |  
-----------------------------------+----------------------------------------
Changes (by jvkersch):

  * status:  needs_info => needs_review


Comment:

 Replying to [comment:5 niles]:

 >
 > Note:
 >
 > {{{
 > sage: g.__dict__
 > {'_components': {(1, 2): 2*x, (0, 2): y}, '_degree': 2}
 > sage: f.__dict__
 > {'_components': {(1, 2): x}, '_degree': 2}
 > sage: type(g.__dict__['_components'][(0,2)])
 > <type 'sage.symbolic.expression.Expression'>
 > }}}

 Thanks for noting this -- I agree that this code would give the same kind
 of problems as before.  I've uploaded a new patch, where `__eq__`
 essentially iterates over the underlying dictionary, converts the values
 to strings and does the comparison on the strings.  Secondly, in the
 internal function `_cleanup()` there was some code `if fun == 0`, which
 I've replaced by `if fun.is_zero()`.  I think this addresses all cases of
 symbolic expressions appearing in equalities.  One downside however is
 that the current implementation is somewhat slower than the previous one.
 I have a few ideas of how to address this, but I feel this issue is better
 left to a different patch.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10053#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to