#10849: behaviour of gamma strangely sensitive
-------------------------+--------------------------------------------------
   Reporter:  dsm        |          Owner:  burcin    
       Type:  defect     |         Status:  new       
   Priority:  major      |      Milestone:  sage-4.7.1
  Component:  symbolics  |       Keywords:            
Work_issues:             |       Upstream:  N/A       
   Reviewer:             |         Author:            
     Merged:             |   Dependencies:            
-------------------------+--------------------------------------------------
Changes (by burcin):

  * milestone:  => sage-4.7.1


Comment:

 Mike is right and the patch at #10064 resolves this issue.

 The side effect is a result of GiNaC's reference counted pointers.
 Whenever two expressions compare equal, GiNaC frees the memory of one, and
 makes it a pointer to the other. In this example, it replaces `-x - 1/2`
 where the coefficient of `x` is in QQ(i), with `-x - 1/2` where the
 coefficient is just an `int`.

 {{{
 sage: t = -x -1/2
 sage: t
 -x - 1/2
 sage: t.operands()
 [-x, -1/2]
 sage: t.operands()[0]
 -x
 sage: t.operands()[0].operands()
 [x, -1]
 sage: t.operands()[0].operands()[1]
 -1
 sage: t.operands()[0].operands()[1].pyobject()
 -1
 sage: type(t.operands()[0].operands()[1].pyobject())
 <type 'int'>
 }}}

 Of course there is a chance that this observation changed the result. :)

 For `g`, this looks like a different bug:

 {{{
 sage: g
 gamma(-x - 1/2)
 sage: g.operands()[0]
 -x - 1/2
 sage: g.operands()[0].operands()
 [x, -1/2]
 sage: g.operands()[0].operands()[0]
 x
 sage: g.operands()[0].operands()[0].operands()
 []
 }}}

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