Re: [sympy] Re: Finding domains of numbers

2014-06-27 Thread Aaron Meurer
If you create a constant Poly, it picks the domain. You should look at the source to see how it picks that. Aaron Meurer On Sat, Jun 21, 2014 at 10:48 AM, Christophe Bal projet...@gmail.com wrote: Hello. I do not know if it is the case but I think that sympy should have a domain method for

Re: [sympy] Re: Finding domains of numbers

2014-06-27 Thread Chris Smith
But you can't create a constant Poly without giving the domain. Try something like the following (and, again, trace the code to see if there is a more direct way of learning the domain): Poly(1.2+var('x')) Poly(1.0*x + 1.2, x, domain='RR') Poly(1+var('x')) Poly(x + 1, x, domain='ZZ')

Re: [sympy] Re: Finding domains of numbers

2014-06-27 Thread Aaron Meurer
You can't create it without giving a variable, but you can easily do Poly(1, x).get_domain(). There's probably a more direct way, though. Aaron Meurer On Fri, Jun 27, 2014 at 2:15 PM, Chris Smith smi...@gmail.com wrote: But you can't create a constant Poly without giving the domain. Try

[sympy] Re: Finding domains of numbers

2014-06-21 Thread F. B.
On Saturday, June 21, 2014 5:37:52 AM UTC, Saurabh Jha wrote: I think this should not be very difficult to implement using inbuilt 're' module of python. I can submit a PR regarding this thing Why the 're' module? -- You received this message because you are subscribed to the Google

[sympy] Re: Finding domains of numbers

2014-06-21 Thread Saurabh Jha
I think we can make regular expressions that will match Integers, floating points etc. Something along the lines of this for int - re.compile('^\d+$') for float - re.compile('^\d+\.\d+$') What do you think about it? Saurabh On Saturday, June 21, 2014 11:07:52 AM UTC+5:30, Saurabh Jha wrote:

Re: [sympy] Re: Finding domains of numbers

2014-06-21 Thread Joachim Durchholz
Am 21.06.2014 11:19, schrieb Saurabh Jha: I think we can make regular expressions that will match Integers, floating points etc. Something along the lines of this for int - re.compile('^\d+$') for float - re.compile('^\d+\.\d+$') What do you think about it? First, it' unnecessarily slow.

Re: [sympy] Re: Finding domains of numbers

2014-06-21 Thread Saurabh Jha
I think that makes sense. I think this functionality is already implemented in Polys module in some form. I am not able to pin point it. First, it' unnecessarily slow. Just check whether f == round(f) for floats. Second, the question whether a float is integral or not borders on

Re: [sympy] Re: Finding domains of numbers

2014-06-21 Thread Christophe Bal
Hello. I do not know if it is the case but I think that sympy should have a domain method for expressions. This will avoid error like for example float calculations raising to 1 for example that wi-ould not be a natural but a float. C. 2014-06-21 17:08 GMT+02:00 Saurabh Jha