On May 30, 12:13 am, Tom Bachmann<[email protected]>  wrote:
How is this at all different from what Polys does? I'm not saying it's
bad, I'm just not seeing your point. Basically what you call ground
types are called domains in polys, and they are in polys/domains ...

I need usable types. For example, you mentioned that one usable type
is DMF, and it is in poly/polyclasses.
How many other such types exist and where ?


DMF is already higher level. The things you should probably be looking at are in polys/domains. There's a lot there, and it's a bit of a shame that there's not much documentation. I think construct_domain should somehow construct a domain that can hold your data. If you need to divide, or take square roots, etc, you presumably have to figure out what larger domain you need. There are probably functions for this, but I don't know about them. Ask Mateusz about anything specific.

As for ground types, they work roughly like this:

>>> from sympy.polys.domains import FF

This imports a constructor for finite fields. As I understand it, this will automatically use gmpy or python types depending on what is available.


Construct a domain for arithmetic mod 5:
>>> F5 = FF(5)

Do some arithmetic:
>>> F5(3) + F5(8)
1 mod 5
>>> F5(3)/F5(2)
4 mod 5

Funny things can happen if you do division where you should not:
>>> from sympy.polys.domains import ZZ
>>> ZZ(2)/ZZ(3)
0.666666666667

But this works:
>>> Q = ZZ.get_field()
>>> Q(2)/Q(3)
2/3

I suppose to see how to do this sort of stuff automatically, you have to read polytools.py.

--
You received this message because you are subscribed to the Google Groups 
"sympy" 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/sympy?hl=en.

Reply via email to