#15321: Function changes behaviour, related to polynomial rings
-----------------------+-----------------------------
   Reporter:  gagern   |            Owner:
       Type:  defect   |           Status:  new
   Priority:  major    |        Milestone:  sage-5.13
  Component:  algebra  |         Keywords:
  Merged in:           |          Authors:
  Reviewers:           |  Report Upstream:  N/A
Work issues:           |           Branch:
     Commit:           |     Dependencies:
   Stopgaps:           |
-----------------------+-----------------------------
 I've just observed the following strange behaviour:

 {{{
 sage: PR1 = PolynomialRing(QQ, ["t" + str(i) for i in range(10)])
 sage: t = PR1.gens()
 sage: def L(r, j):
 ...       return (t[r] - t[r + j])/t[r + j]
 ...
 sage: PR2 = PolynomialRing(PR1.fraction_field(), ["p" + str(i) for i in
 range(5)])
 sage: p = PR2.gens()
 sage: def D(r):
 ...       return sum(L(r, j)*p[r-4+j] for j in range(3))
 ...
 sage: D(4)
 ((t4 - t5)/t5)*p1 + ((t4 - t6)/t6)*p2
 sage: myc = list(D(4))    # here the command works all right
 sage: D(4)                # reproducing the call still works fine here
 ((t4 - t5)/t5)*p1 + ((t4 - t6)/t6)*p2
 sage: [c for c, p in myc] # THIS LINE APPEARS TO BREAK THINGS!
 [(t4 - t5)/t5, (t4 - t6)/t6]
 sage: D(4)                # now the result is wrong, no error reported
 0
 sage: myc = list(D(4))    # and this throws, probably due to the zero
 result
 Traceback (most recent call last):
 ...
 TypeError: 'sage.rings.fraction_field_element.FractionFieldElement' object
 is not iterable
 }}}

 So it seems that repeated execution of the same function can yield
 different (and sometimes wrong!) results if some result was iterated over
 in a certain way. No clue why.

--
Ticket URL: <http://trac.sagemath.org/ticket/15321>
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/groups/opt_out.

Reply via email to