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

  * status:  needs_review => needs_info
  * reviewer:  => Niles Johnson


Old description:

> This patch replaces the comparison member function in `CoordinatePatch`
> and `DifferentialForms` by equality checking (`__eq__` instead
> `__cmp__`), as there is generally no canonical way of making sense of the
> comparison between instances of those classes.
>
> This is related to #10041.

New description:

 This patch replaces the comparison member function in `CoordinatePatch`
 and `DifferentialForms` by equality checking (`__eq__` instead `__cmp__`),
 as there is generally no canonical way of making sense of the comparison
 between instances of those classes.

 This is related to #10041.

 == Apply ==

  * patch from #10041
  * [attachment:trac_10053_equality_testing_forms.patch]

--

Comment:

 With this patch and the one at #10041, sage passes all (`-long`) doctests
 (linux, Red Hat Enterprise).

 At #10041, jason
 [http://trac.sagemath.org/sage_trac/ticket/10041#comment:3 commented] that
 comparison of tuples of symbolic variables is not well-defined, and
 suggested using strings instead.  That has been done in
 `coordinate_patch.py` and `differential_forms.py`, but not in
 `differential_form_element.py` -- there, comparison uses `__dict__`.  So
 is the following expected to work on all systems?

 {{{
 sage: F = DifferentialForms(); F
 Algebra of differential forms in the variables x, y, z
 sage: var('x,y,z')
 (x, y, z)
 sage: f = DifferentialForm(F, 2)
 sage: f[1,2] = x; f
 x*dy/\dz
 sage: g = DifferentialForm(F, 2)
 sage: g[0, 2] = y
 sage: g[1, 2] = 2*x; g
 2*x*dy/\dz + y*dx/\dz

 sage: f == g
 False
 sage: g == g
 True
 }}}

 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'>
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10053#comment:5>
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