sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.3k stars 449 forks source link

make symbolic series subclass of Expression #17659

Closed rwst closed 8 years ago

rwst commented 9 years ago

Making Expression.series create SymbolicSeries (a subclass of Expression) and moving the series code into a separate file series.pyx

In refactoring language this is "replace conditional with polymorphism".

16203, #17400, and #17402 depend on this.

Depends on #19948

Component: symbolics

Author: Ralf Stephan

Branch/Commit: 1832f4a

Reviewer: Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/17659

rwst commented 8 years ago
comment:38

That happens in 6 out of 10 attempts here. Bummer.

rwst commented 8 years ago
comment:39

For the record, only when doctesting and in different processes does it fail often enough to be noticed (regardless of if testing in parallel or not). When not leaving the Sage process the results seem always the same. One possbility would be therefore an uninitialized variable in Pynac affecting the result depending on what's in the memory at Sage start.

vbraun commented 8 years ago
comment:40

Might also depend on Python memory locations (are the underlying ginac objects cached or not?). If its an uninitialized pynac variable then valgrind should find it.

rwst commented 8 years ago
comment:41

I would have found it if it were in the upcoming pynac-0.5.2 because I used valgrind extensively there. So it might just disappear with #19312.

rwst commented 8 years ago
comment:42

Okay, for some reason printing order here is according to hash value, and hash values of symbols are not preserved over different processes. Putting sage: hash(x) in an arbitrary doctest and testing multiple times shows this clearly, also in Sage-6.6. It's just that such series manipulations produced an error until recently, so the differences over time couldn't be observed.

rwst commented 8 years ago
comment:43

See https://github.com/pynac/pynac/issues/22

This is now fixed in pynac and depends on the upgrade to pynac-0.6.1.

rwst commented 8 years ago

Dependencies: #19448

rwst commented 8 years ago

Changed dependencies from #19448 to #19948

vbraun commented 8 years ago
comment:46
sage -t --long src/sage/symbolic/series.pyx
**********************************************************************
File "src/sage/symbolic/series.pyx", line 71, in sage.symbolic.series
Failed example:
    x*ex1
Expected:
    (1*x + (-1/6)*x^3 + Order(x^4))*x
Got:
    x*(1*x + (-1/6)*x^3 + Order(x^4))
**********************************************************************
1 item had failures:
   1 of  23 in sage.symbolic.series
    [42 tests, 1 failure, 0.04 s]
rwst commented 8 years ago
comment:47

Beware the dependency!

vbraun commented 8 years ago
comment:49

Patchbot also shows failure

rwst commented 8 years ago

Changed branch from u/rws/17659-1 to u/rws/17659-2

rwst commented 8 years ago
comment:51

Yes, a remainder from the time before #19948.


New commits:

c3be6a1Merge branch 'u/rws/17659-1' of trac.sagemath.org:sage into tmp04
1832f4a17659: fix doctest
rwst commented 8 years ago

Changed commit from d5cc424 to 1832f4a

tscrim commented 8 years ago
comment:53

Ralf, did you intend for this to wait to 7.2 or did you mean 7.1?

vbraun commented 8 years ago

Changed branch from u/rws/17659-2 to 1832f4a