#12807: Taking the real part of a sum of exponentials with imaginary exponents
gives wrong result
-------------------------------------------------+-------------------------
       Reporter:  inaki                          |        Owner:  burcin
           Type:  defect                         |       Status:  new
       Priority:  major                          |    Milestone:  sage-6.7
      Component:  symbolics                      |   Resolution:
       Keywords:                                 |    Merged in:
        Authors:                                 |    Reviewers:
Report Upstream:  Fixed upstream, in a later     |  Work issues:
  stable release.                                |       Commit:
         Branch:                                 |     Stopgaps:
   Dependencies:  pynac-0.3.7                    |
-------------------------------------------------+-------------------------
Changes (by rws):

 * upstream:  N/A => Fixed upstream, in a later stable release.
 * dependencies:   => pynac-0.3.7
 * milestone:  sage-6.4 => sage-6.7


Comment:

 Actually and surprisingly what's happening is that the simplified values
 of the `exp` expressions (`1/2` and `-1/2`) and their coefficients are all
 multiplied together on final evaluation:
 {{{
 sage: (4*exp(i*pi/3)-4*exp(i*2*pi/3)).real_part()
 4
 sage: (6*exp(i*pi/3)-6*exp(i*2*pi/3)).real_part()
 9
 }}}
 This is evident in the GiNaC source, this
 line(https://github.com/pynac/pynac/blob/master/ginac/add.cpp#L432):
 {{{
     oc = oc.mul(ex_to<numeric>(j->rest)).mul(ex_to<numeric>(j->coeff));
 }}}
 is so rarely executed that e.g. only three doctests in `symbolic/` touch
 it but don't trigger the bug because the expressions are too short.

 The fix will be in Pynac-0.3.7.

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