#16365: ChainComplex.betti uses wrong base_ring
----------------------------------+----------------------------
   Reporter:  dunfield            |            Owner:
       Type:  defect              |           Status:  new
   Priority:  major               |        Milestone:  sage-6.3
  Component:  algebraic topology  |         Keywords:
  Merged in:                      |          Authors:
  Reviewers:                      |  Report Upstream:  N/A
Work issues:                      |           Branch:
     Commit:                      |     Dependencies:
   Stopgaps:                      |
----------------------------------+----------------------------
 The docstring for `ChainComplex.betti` says
 {{{
   - ``base_ring`` -- a commutative ring (optional, default is the
           base ring for the chain complex); compute homology with
           these coefficients -- must be either the integers or a
           field
 }}}
 however, in fact if `base_ring` is `None` then under the hood it defaults
 to QQ.  Thus the `betti` method will choke on examples where
 `ChainComplex.homology` work fine:
 {{{
 sage: K = QuadraticField(-1, 'i')
 sage: C = ChainComplex({0:matrix(K, [K.gen(),0])})
 sage: C.homology()
 {0: Vector space of dimension 1 over Number Field in i with defining
 polynomial x^2 + 1,
  1: Vector space of dimension 0 over Number Field in i with defining
 polynomial x^2 + 1}
 sage: C.betti()
 [...huge traceback...]
 TypeError: Unable to coerce i to a rational
 }}}
 and moreover gives **incorrect** answers when it silently coerces the
 chain complex into QQ:
 {{{
 sage: C = ChainComplex({0:matrix(GF(5), [[3, 1],[1, 2]])})
 sage: C.homology()
 {0: Vector space of dimension 1 over Finite Field of size 5,
  1: Vector space of dimension 1 over Finite Field of size 5}
 sage: C.betti()
 {0: 0, 1: 0}
 }}}
 I think the fix is just to change line 1344 of
 `homology/chain_complex.py`.  I will test this and upload a patch.

--
Ticket URL: <http://trac.sagemath.org/ticket/16365>
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 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/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to