sympy ground types

85 views
Skip to first unread message

Julien Rioux

unread,
Oct 8, 2012, 10:30:44 AM10/8/12
to sy...@googlegroups.com
Hi,

What is the status of the different ground types supported by sympy? "./bin/test -h" mentions three possible ground types: gmpy, python, and sympy. These seems to have been added in March 2010 (http://code.google.com/p/sympy/issues/detail?id=1598#c101). In Dec 2010, there is mention that the sympy ground type is no longer supported (http://code.google.com/p/sympy/issues/detail?id=1949#c11). Indeed, if I run the test suite with sympy ground types, I get many errors (mostly from polys, but also a couple files outside polys have errors). The errors aren't terribly difficult to fix, maybe more so for a "proper" fix, but the doctests are doomed to fail since sympy's Rational likes to cast itself into Integer whenever possible, whereas the other types are quite happy to print as e.g. 0/1, 1/1, 2/1, etc. What's the plan for sympy ground types? If we don't want to support them, I suggest to remove them completely.

Cheers,
Julien

Aaron Meurer

unread,
Oct 8, 2012, 10:44:25 AM10/8/12
to sy...@googlegroups.com
I think they were kept around for experimental purposes, in case we ever want to see how SymPy's types compare. They were removed from support once python types became supported everywhere because SymPy's types were so slow.  

Do simple tasks, like factor(expand((x + y)**20)) still work?

Aaron Meurer
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/zBvVu8a9lewJ.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.

Julien Rioux

unread,
Oct 9, 2012, 10:08:31 AM10/9/12
to sy...@googlegroups.com
On Monday, 8 October 2012 16:44:28 UTC+2, Aaron Meurer wrote:
I think they were kept around for experimental purposes, in case we ever want to see how SymPy's types compare. They were removed from support once python types became supported everywhere because SymPy's types were so slow.  


So what's the plan for them? Do we care about fixing the failures of "bin/test -t sympy"?
 
Do simple tasks, like factor(expand((x + y)**20)) still work?


Yes, it works. Most things work, and the failures are mostly fixed by casting typed "int" into "ZZ(int)", though I'm not sure that's desirable.
 
Aaron Meurer


Cheers,
Julien

Aaron Meurer

unread,
Oct 9, 2012, 2:15:03 PM10/9/12
to sy...@googlegroups.com
On Oct 9, 2012, at 8:08 AM, Julien Rioux <julien...@gmail.com> wrote:

On Monday, 8 October 2012 16:44:28 UTC+2, Aaron Meurer wrote:
I think they were kept around for experimental purposes, in case we ever want to see how SymPy's types compare. They were removed from support once python types became supported everywhere because SymPy's types were so slow.  


So what's the plan for them? Do we care about fixing the failures of "bin/test -t sympy"?

If you want you can, but it's not important. Like I said, it's just there for benchmarking. 

 
Do simple tasks, like factor(expand((x + y)**20)) still work?


Yes, it works. Most things work, and the failures are mostly fixed by casting typed "int" into "ZZ(int)", though I'm not sure that's desirable.

I don't understand what you mean here. You always have to use ZZ(2) instead of 2 so that you make sure you use the 2 from your ground type. 

Aaron Meurer

 
Aaron Meurer


Cheers,
Julien

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/-Q3ZKzCV7jcJ.

Mateusz Paprocki

unread,
Oct 9, 2012, 2:42:42 PM10/9/12
to sy...@googlegroups.com
Hi,

On 8 October 2012 16:30, Julien Rioux <julien...@gmail.com> wrote:
Hi,

What is the status of the different ground types supported by sympy? "./bin/test -h" mentions three possible ground types: gmpy, python, and sympy. These seems to have been added in March 2010 (http://code.google.com/p/sympy/issues/detail?id=1598#c101). In Dec 2010, there is mention that the sympy ground type is no longer supported (http://code.google.com/p/sympy/issues/detail?id=1949#c11). Indeed, if I run the test suite with sympy ground types, I get many errors (mostly from polys, but also a couple files outside polys have errors). The errors aren't terribly difficult to fix, maybe more so for a "proper" fix, but the doctests are doomed to fail since sympy's Rational likes to cast itself into Integer whenever possible, whereas the other types are quite happy to print as e.g. 0/1, 1/1, 2/1, etc. What's the plan for sympy ground types? If we don't want to support them, I suggest to remove them completely.

The only ground types that we should be concerned of are gmpy and python. sympy ground types never worked and they simply can't work with the type system I implemented in domains, because types in the core (sympy ground types) aren't preserved by operations on those types (when this would be necessary). With a recent pull request related to unification of GCDs I removed some of sympy ground types, leaving the fundamental ones (ZZ, QQ). You can go ahead and remove the remaining garbage. 
 

Cheers,
Julien

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/zBvVu8a9lewJ.

To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.

Mateusz

Julien Rioux

unread,
Oct 9, 2012, 3:04:58 PM10/9/12
to sy...@googlegroups.com
On Tuesday, 9 October 2012 14:15:04 UTC-4, Aaron Meurer wrote:
I don't understand what you mean here. You always have to use ZZ(2) instead of 2 so that you make sure you use the 2 from your ground type. 

Well, some of the tests don't do this, e.g.

https://github.com/sympy/sympy/blob/master/sympy/polys/tests/test_factortools.py#L103

It looks like tests would past if we change everywhere:
-    assert dup_cyclotomic_p([1,1,1], ZZ) == True
+    assert dup_cyclotomic_p(ZZ.map([1,1,1]), ZZ) == True

--
Julien

Aaron Meurer

unread,
Oct 9, 2012, 7:26:08 PM10/9/12
to sy...@googlegroups.com
Yes, we should do this, even if we end up deleting the sympy ground
types, because it will not be the same with gmpy either (and hence
things like benchmarks with gmpy won't be accurate).

Aaron Meurer

>
> --
> Julien
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/4G5u5oaNRnUJ.

Julien Rioux

unread,
Oct 12, 2012, 9:44:53 PM10/12/12
to sy...@googlegroups.com
On Tue, Oct 9, 2012 at 7:26 PM, Aaron Meurer <asme...@gmail.com> wrote:
> On Tue, Oct 9, 2012 at 1:04 PM, Julien Rioux <julien...@gmail.com> wrote:
>> It looks like tests would past if we change everywhere:
>> - assert dup_cyclotomic_p([1,1,1], ZZ) == True
>> + assert dup_cyclotomic_p(ZZ.map([1,1,1]), ZZ) == True
>
> Yes, we should do this, even if we end up deleting the sympy ground
> types, because it will not be the same with gmpy either (and hence
> things like benchmarks with gmpy won't be accurate).
>
> Aaron Meurer

https://github.com/sympy/sympy/pull/1574

--
Julien
Reply all
Reply to author
Forward
0 new messages