#18787: Bug with products of symbolic variables with modular integers
-------------------------------------------------+-------------------------
Reporter: tmonteil | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.8
Component: symbolics | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: Reported upstream. Developers | Work issues:
acknowledge bug. | Commit:
Branch: | Stopgaps:
Dependencies: pynac-0.3.9.2 |
-------------------------------------------------+-------------------------
Changes (by rws):
* dependencies: => pynac-0.3.9.2
* upstream: N/A => Reported upstream. Developers acknowledge bug.
Comment:
The following patch works for these two examples, just to point at the
direction further completion is needed:
{{{
diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp
index 2abb7b7..acef09b 100644
--- a/ginac/expairseq.cpp
+++ b/ginac/expairseq.cpp
@@ -1207,16 +1207,17 @@ void expairseq::combine_same_terms_sorted_seq()
// must_copy will be set to true the first time some combination
is
// possible from then on the sequence has changed and must be
compacted
bool must_copy = false;
+ numeric itin1_c = ex_to<numeric>(itin1->coeff);
while (itin2!=last) {
if (itin1->rest.compare(itin2->rest)==0 &&
unlikely(!is_a<infinity>(itin1->rest))) {
- itin1->coeff = ex_to<numeric>(itin1->coeff).
+ itin1->coeff = itin1_c.
add_dyn(ex_to<numeric>(itin2->coeff));
if (expair_needs_further_processing(itin1))
needs_further_processing = true;
must_copy = true;
} else {
- if (!ex_to<numeric>(itin1->coeff).is_zero()) {
+ if (not itin1_c.is_zero() or
itin1_c.is_parent_pos_char()) {
if (must_copy)
*itout = *itin1;
++itout;
@@ -1225,7 +1226,7 @@ void expairseq::combine_same_terms_sorted_seq()
}
++itin2;
}
- if (!ex_to<numeric>(itin1->coeff).is_zero()) {
+ if (not itin1_c.is_zero() or itin1_c.is_parent_pos_char()) {
if (must_copy)
*itout = *itin1;
++itout;
}}}
The relevant ticket would be https://github.com/pynac/pynac/issues/77.
--
Ticket URL: <http://trac.sagemath.org/ticket/18787#comment:14>
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.