#7916: change conjugate(X) to try X.conjugate()  [[this is easy!!]]
------------------------+---------------------------------------------------
   Reporter:  was       |       Owner:  burcin    
       Type:  defect    |      Status:  new       
   Priority:  minor     |   Milestone:  sage-4.3.1
  Component:  calculus  |    Keywords:            
Work_issues:            |      Author:            
   Upstream:  N/A       |    Reviewer:            
     Merged:            |  
------------------------+---------------------------------------------------
 {{{
 On Tue, Jan 12, 2010 at 8:36 PM, jtyard <> wrote:
 > Hi,
 >
 > I don't know if this counts as a bug, so sorry if I'm posting this to
 > the wrong list.  Say I define a cyclotomic field in Sage as follows:
 >
 > sage: Q3 = CyclotomicField(3)
 > sage: z3 = Q3.0
 >
 > Then Sage can compute the complex conjugate independent of an
 > embedding into the complexes:
 >
 > sage: z3.conjugate()
 > -zeta3 - 1
 >
 > But I get a different answer by typing:
 >
 > sage: conjugate(z3)
 > conjugate(e^(2/3*I*pi))
 >
 > Wouldn't it make sense for these to do the same thing?  Another
 > difference comes up as follows:
 >
 > sage: Q2.<s> = QuadraticField(-2)
 > sage: s.conjugate()
 > -s
 > sage: conjugate(s)
 > -I*sqrt(2)
 >
 > Yet, the problem doesn't exist with this slightly different
 > definition:
 >
 > sage: QQ2.<ss> = QQ[sqrt(-2)]
 > sage: ss.conjugate()
 > -a
 > sage: conjugate(ss)
 > -a

 Yes, I agree that this is a bug.
 What is happening is that the *symbolic* conjugate function is coercing
 its input X to the symbolic ring SR before applying itself.  It would be
 much better to test if X has a .conjugate method, and if so return that;
 if not, then return SR(X).conjugate().

 Here's the beginning of the course code for conjugate(X):

 sage: conjugate.__call__??
         # we want to convert the result to the original parent if the
 input
         # is not exact, so we store the parent here
         org_parent = parent(args[0])
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7916>
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