Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-05 Thread Sergey Kirpichev

On Wednesday, March 5, 2014 5:08:47 AM UTC+4, Ondřej Čertík wrote:

 Can you post your code where you need large integers in Python that 
 runs out of memory?


A good example is this one:
http://code.google.com/p/sympy/issues/detail?id=3736
:)

But I think it's a very different (and very difficult!) problem (mostly
related with rules of evaluation for sympy's objects. 

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/26bc3365-0553-4653-a432-6dc3a7c6f887%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-05 Thread Tim Lahey
That one appears to be an mpmath problem, rather than a Sympy problem 
(specifically). Even if Sympy had a BigInteger support, that wouldn't fix this 
problem as it fails in mpmath code (which doesn't use any Sympy classes).

I'd like to know of any examples of large integers that Sympy doesn't support.

Cheers,

Tim.

On 2014-03-05, at 8:30 AM, Sergey Kirpichev skirpic...@gmail.com wrote:

 
 On Wednesday, March 5, 2014 5:08:47 AM UTC+4, Ondřej Čertík wrote:
 Can you post your code where you need large integers in Python that 
 runs out of memory?
 
 A good example is this one:
 http://code.google.com/p/sympy/issues/detail?id=3736
 :)
 
 But I think it's a very different (and very difficult!) problem (mostly
 related with rules of evaluation for sympy's objects. 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/sympy/26bc3365-0553-4653-a432-6dc3a7c6f887%40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/2FCB035D-F50C-4308-AD9B-9B314F548A56%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-05 Thread Sergey B Kirpichev
On Wed, Mar 05, 2014 at 09:45:55AM -0500, Tim Lahey wrote:
 That one appears to be an mpmath problem, rather than a Sympy problem 
 (specifically). Even if Sympy had a BigInteger support, that wouldn't fix 
 this problem as it fails in mpmath code (which doesn't use any Sympy classes).
 I'd like to know of any examples of large integers that Sympy doesn't support.

Just change in the above example E and floats to some rounded values.

In [1]: 2**2**2**2**7
---
MemoryError   Traceback (most recent call
last)
ipython-input-1-22f2c4609245 in module()
 1 2**2**2**2**7

MemoryError:

(isympy was under ulimit -v 1048576)

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/20140305151255.GB23903%40darkstar.order.hcn-strela.ru.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-05 Thread Aaron Meurer
That issue is about dealing with numbers like googolplex, which are
too big to be represented by any computer (even a computer the size of
the universe). The solution is to keep things unevaluated. A
googolplex is representable, as 10**10**100. It just needs to be kept
from evaluating.

This is a problem in SymPy that *hasn't* been solved. There are
suggestions on the issue on how to do so.

Once you implements unevaluated big numbers, it might be fun to
implement Knuth up arrow notation on them.

Aaron Meurer

 On Mar 5, 2014, at 8:46 AM, Tim Lahey tim.la...@gmail.com wrote:

 That one appears to be an mpmath problem, rather than a Sympy problem 
 (specifically). Even if Sympy had a BigInteger support, that wouldn't fix 
 this problem as it fails in mpmath code (which doesn't use any Sympy classes).

 I'd like to know of any examples of large integers that Sympy doesn't support.

 Cheers,

 Tim.

 On 2014-03-05, at 8:30 AM, Sergey Kirpichev skirpic...@gmail.com wrote:


 On Wednesday, March 5, 2014 5:08:47 AM UTC+4, Ondřej Čertík wrote:
 Can you post your code where you need large integers in Python that
 runs out of memory?

 A good example is this one:
 http://code.google.com/p/sympy/issues/detail?id=3736
 :)

 But I think it's a very different (and very difficult!) problem (mostly
 related with rules of evaluation for sympy's objects.


 --
 You received this message because you are subscribed to the Google Groups 
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/sympy/26bc3365-0553-4653-a432-6dc3a7c6f887%40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 You received this message because you are subscribed to the Google Groups 
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/sympy/2FCB035D-F50C-4308-AD9B-9B314F548A56%40gmail.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/-5371055096513839258%40unknownmsgid.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-05 Thread Ondřej Čertík
On Wed, Mar 5, 2014 at 8:13 AM, Aaron Meurer asmeu...@gmail.com wrote:
 That issue is about dealing with numbers like googolplex, which are
 too big to be represented by any computer (even a computer the size of
 the universe). The solution is to keep things unevaluated. A
 googolplex is representable, as 10**10**100. It just needs to be kept
 from evaluating.

 This is a problem in SymPy that *hasn't* been solved. There are
 suggestions on the issue on how to do so.

Right, that's a good point.

Ondrej


 Once you implements unevaluated big numbers, it might be fun to
 implement Knuth up arrow notation on them.

 Aaron Meurer

 On Mar 5, 2014, at 8:46 AM, Tim Lahey tim.la...@gmail.com wrote:

 That one appears to be an mpmath problem, rather than a Sympy problem 
 (specifically). Even if Sympy had a BigInteger support, that wouldn't fix 
 this problem as it fails in mpmath code (which doesn't use any Sympy 
 classes).

 I'd like to know of any examples of large integers that Sympy doesn't 
 support.

 Cheers,

 Tim.

 On 2014-03-05, at 8:30 AM, Sergey Kirpichev skirpic...@gmail.com wrote:


 On Wednesday, March 5, 2014 5:08:47 AM UTC+4, Ondřej Čertík wrote:
 Can you post your code where you need large integers in Python that
 runs out of memory?

 A good example is this one:
 http://code.google.com/p/sympy/issues/detail?id=3736
 :)

 But I think it's a very different (and very difficult!) problem (mostly
 related with rules of evaluation for sympy's objects.


 --
 You received this message because you are subscribed to the Google Groups 
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/sympy/26bc3365-0553-4653-a432-6dc3a7c6f887%40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 You received this message because you are subscribed to the Google Groups 
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/sympy/2FCB035D-F50C-4308-AD9B-9B314F548A56%40gmail.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 You received this message because you are subscribed to the Google Groups 
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/sympy/-5371055096513839258%40unknownmsgid.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CADDwiVAWc5QirzPggMD2a5%3DUAx5cdL%3DBKSi2qn1fzSOXhFL6aw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Tim Lahey

Hi,

Is there integers that Sympy can't represent? The Integer class is 
independent of python int. What would this module add to Sympy? 
Alternatively, should it be part of Numpy instead, if it's just 
numerics?


I'm just a bit unclear on what you want to do.

Cheers,

Tim.

On 4 Mar 2014, at 18:59, Ambar Mehrotra wrote:


Hi,

I am Ambar Mehrotra and undergraduate from BITS Pilani, India pursuing
Information Systems.
I like to play with numbers and have a descent experience with python.

I would like to suggest the addition of a 'BigInteger' module in the
sympy.core.numbers class.
Currently there is no convenient way of storing and working with very 
large
numbers in python. I came across this problem while solving a question 
of

Google Code Jam where python ran out of memory while doing a long
calculation.
I would like to take user input in form of a string and then use 
algorithms

to do some basic math operations using numpy to make things faster.

Please tell me if this idea is worth considering and guide me further 
if

you like it.

with regards,
Ambar Mehrotra.

--
You received this message because you are subscribed to the Google 
Groups sympy group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to sympy+unsubscr...@googlegroups.com.

To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/DD610FA1-1960-4E82-8F27-6A695DE6D480%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Ondřej Čertík
On Tue, Mar 4, 2014 at 4:59 PM, Ambar Mehrotra ambar.pri...@gmail.com wrote:
 Hi,

 I am Ambar Mehrotra and undergraduate from BITS Pilani, India pursuing
 Information Systems.
 I like to play with numbers and have a descent experience with python.

 I would like to suggest the addition of a 'BigInteger' module in the
 sympy.core.numbers class.
 Currently there is no convenient way of storing and working with very large
 numbers in python. I came across this problem while solving a question of
 Google Code Jam where python ran out of memory while doing a long
 calculation.
 I would like to take user input in form of a string and then use algorithms
 to do some basic math operations using numpy to make things faster.

 Please tell me if this idea is worth considering and guide me further if you
 like it.

SymPy can also use GMP through gmpy through mpmath, so that should be
able to handle any large integers.

Can you post your code where you need large integers in Python that
runs out of memory?

Ondrej


 with regards,
 Ambar Mehrotra.

 --
 You received this message because you are subscribed to the Google Groups
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CADDwiVAA-XSEt5Ow0HmX%3DP6H0-pX0n_r4CKc6yOEjawqO3YW4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Ambar Mehrotra
@Tim

Even in python an integer is automatically converted to long type but it 
cannot go further. And as sympy has a numbers class for other data types as 
well this can also be included. Wanted to build something similar to this 
http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html.

On Wednesday, 5 March 2014 06:38:47 UTC+5:30, Ondřej Čertík wrote:

 On Tue, Mar 4, 2014 at 4:59 PM, Ambar Mehrotra 
 ambar@gmail.comjavascript: 
 wrote: 
  Hi, 
  
  I am Ambar Mehrotra and undergraduate from BITS Pilani, India pursuing 
  Information Systems. 
  I like to play with numbers and have a descent experience with python. 
  
  I would like to suggest the addition of a 'BigInteger' module in the 
  sympy.core.numbers class. 
  Currently there is no convenient way of storing and working with very 
 large 
  numbers in python. I came across this problem while solving a question 
 of 
  Google Code Jam where python ran out of memory while doing a long 
  calculation. 
  I would like to take user input in form of a string and then use 
 algorithms 
  to do some basic math operations using numpy to make things faster. 
  
  Please tell me if this idea is worth considering and guide me further if 
 you 
  like it. 

 SymPy can also use GMP through gmpy through mpmath, so that should be 
 able to handle any large integers. 

 Can you post your code where you need large integers in Python that 
 runs out of memory? 

 Ondrej 

  
  with regards, 
  Ambar Mehrotra. 
  
  -- 
  You received this message because you are subscribed to the Google 
 Groups 
  sympy group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to sympy+un...@googlegroups.com javascript:. 
  To post to this group, send email to sy...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/sympy. 
  To view this discussion on the web visit 
  
 https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.
  

  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/7312fed9-2752-4de0-a9c1-9ddbd8b08767%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Tim Lahey

Hi,

Sympy's Integer class is not the same as a python int. Is there 
something that the Integer class or gmpy through mpmath can't do?


Cheers,

Tim.

On 4 Mar 2014, at 20:37, Ambar Mehrotra wrote:


@Tim

Even in python an integer is automatically converted to long type but 
it
cannot go further. And as sympy has a numbers class for other data 
types as
well this can also be included. Wanted to build something similar to 
this

http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html.

On Wednesday, 5 March 2014 06:38:47 UTC+5:30, Ondřej Čertík wrote:


On Tue, Mar 4, 2014 at 4:59 PM, Ambar Mehrotra 
ambar@gmail.comjavascript:

wrote:

Hi,

I am Ambar Mehrotra and undergraduate from BITS Pilani, India 
pursuing

Information Systems.
I like to play with numbers and have a descent experience with 
python.


I would like to suggest the addition of a 'BigInteger' module in the
sympy.core.numbers class.
Currently there is no convenient way of storing and working with 
very

large
numbers in python. I came across this problem while solving a 
question

of

Google Code Jam where python ran out of memory while doing a long
calculation.
I would like to take user input in form of a string and then use

algorithms

to do some basic math operations using numpy to make things faster.

Please tell me if this idea is worth considering and guide me 
further if

you

like it.


SymPy can also use GMP through gmpy through mpmath, so that should be
able to handle any large integers.

Can you post your code where you need large integers in Python that
runs out of memory?

Ondrej



with regards,
Ambar Mehrotra.

--
You received this message because you are subscribed to the Google

Groups

sympy group.
To unsubscribe from this group and stop receiving emails from it, 
send

an

email to sympy+un...@googlegroups.com javascript:.
To post to this group, send email to 
sy...@googlegroups.comjavascript:.



Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit


https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.


For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to the Google 
Groups sympy group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to sympy+unsubscr...@googlegroups.com.

To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/7312fed9-2752-4de0-a9c1-9ddbd8b08767%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/36D3C790-11CC-449D-BB38-29FED3287B6A%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Ambar Mehrotra
@certik,

I don't have the code with me now as this incident is more than an year old.
I want to implement it in various other functions for huge calculations 
which are native to sympy and do not require any external libraries to be 
installed. Since sympy has a numbers class this could make for a good 
addition to it.

On Wednesday, 5 March 2014 06:38:47 UTC+5:30, Ondřej Čertík wrote:

 On Tue, Mar 4, 2014 at 4:59 PM, Ambar Mehrotra 
 ambar@gmail.comjavascript: 
 wrote: 
  Hi, 
  
  I am Ambar Mehrotra and undergraduate from BITS Pilani, India pursuing 
  Information Systems. 
  I like to play with numbers and have a descent experience with python. 
  
  I would like to suggest the addition of a 'BigInteger' module in the 
  sympy.core.numbers class. 
  Currently there is no convenient way of storing and working with very 
 large 
  numbers in python. I came across this problem while solving a question 
 of 
  Google Code Jam where python ran out of memory while doing a long 
  calculation. 
  I would like to take user input in form of a string and then use 
 algorithms 
  to do some basic math operations using numpy to make things faster. 
  
  Please tell me if this idea is worth considering and guide me further if 
 you 
  like it. 

 SymPy can also use GMP through gmpy through mpmath, so that should be 
 able to handle any large integers. 

 Can you post your code where you need large integers in Python that 
 runs out of memory? 

 Ondrej 

  
  with regards, 
  Ambar Mehrotra. 
  
  -- 
  You received this message because you are subscribed to the Google 
 Groups 
  sympy group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to sympy+un...@googlegroups.com javascript:. 
  To post to this group, send email to sy...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/sympy. 
  To view this discussion on the web visit 
  
 https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.
  

  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/a4532a04-24c8-4047-966e-ea250f880448%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Ambar Mehrotra
@Tim,
This link http://docs.sympy.org/latest/tutorial/manipulation.html says that 
SymPy's Integer class is similar to python's built-in int type. It just 
plays well with other sympy classes.
Gmpy is currently not supported on google app engine so I presume it will 
have issues working with sympy live. Plus the point is creating something 
that is native to sympy rather than using other libraries, both because 
sympy already has a class for various data types and people use sympy a lot 
for calculations.

On Wednesday, 5 March 2014 06:36:51 UTC+5:30, Tim Lahey wrote:

 Hi, 

 Is there integers that Sympy can't represent? The Integer class is 
 independent of python int. What would this module add to Sympy? 
 Alternatively, should it be part of Numpy instead, if it's just 
 numerics? 

 I'm just a bit unclear on what you want to do. 

 Cheers, 

 Tim. 

 On 4 Mar 2014, at 18:59, Ambar Mehrotra wrote: 

  Hi, 
  
  I am Ambar Mehrotra and undergraduate from BITS Pilani, India pursuing 
  Information Systems. 
  I like to play with numbers and have a descent experience with python. 
  
  I would like to suggest the addition of a 'BigInteger' module in the 
  sympy.core.numbers class. 
  Currently there is no convenient way of storing and working with very 
  large 
  numbers in python. I came across this problem while solving a question 
  of 
  Google Code Jam where python ran out of memory while doing a long 
  calculation. 
  I would like to take user input in form of a string and then use 
  algorithms 
  to do some basic math operations using numpy to make things faster. 
  
  Please tell me if this idea is worth considering and guide me further 
  if 
  you like it. 
  
  with regards, 
  Ambar Mehrotra. 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups sympy group. 
  To unsubscribe from this group and stop receiving emails from it, send 
  an email to sympy+un...@googlegroups.com javascript:. 
  To post to this group, send email to sy...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/sympy. 
  To view this discussion on the web visit 
  
 https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.
  

  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/cc383ace-4523-40be-9213-e00b347e2239%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Aaron Meurer
Well NumPy is an external library.

SymPy numbers exist so that they play well with the rest of the SymPy
objects, and also so that division results in rational numbers, which
are not natively supported in Python.

I'm not convinced that Python's native int/long is inefficient, and
I'm *really* not convinced that you could do better in pure Python
(even with NumPy). And there's no way you can do as good as GMP,
because that's the gold standard.

But please prove me wrong. I haven't stressed Python's big integers to
the point of memory error before.

Aaron Meurer


On Tue, Mar 4, 2014 at 7:53 PM, Ambar Mehrotra ambar.pri...@gmail.com wrote:
 @certik,

 I don't have the code with me now as this incident is more than an year old.
 I want to implement it in various other functions for huge calculations
 which are native to sympy and do not require any external libraries to be
 installed. Since sympy has a numbers class this could make for a good
 addition to it.


 On Wednesday, 5 March 2014 06:38:47 UTC+5:30, Ondřej Čertík wrote:

 On Tue, Mar 4, 2014 at 4:59 PM, Ambar Mehrotra ambar@gmail.com
 wrote:
  Hi,
 
  I am Ambar Mehrotra and undergraduate from BITS Pilani, India pursuing
  Information Systems.
  I like to play with numbers and have a descent experience with python.
 
  I would like to suggest the addition of a 'BigInteger' module in the
  sympy.core.numbers class.
  Currently there is no convenient way of storing and working with very
  large
  numbers in python. I came across this problem while solving a question
  of
  Google Code Jam where python ran out of memory while doing a long
  calculation.
  I would like to take user input in form of a string and then use
  algorithms
  to do some basic math operations using numpy to make things faster.
 
  Please tell me if this idea is worth considering and guide me further if
  you
  like it.

 SymPy can also use GMP through gmpy through mpmath, so that should be
 able to handle any large integers.

 Can you post your code where you need large integers in Python that
 runs out of memory?

 Ondrej

 
  with regards,
  Ambar Mehrotra.
 
  --
  You received this message because you are subscribed to the Google
  Groups
  sympy group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to sympy+un...@googlegroups.com.
  To post to this group, send email to sy...@googlegroups.com.
  Visit this group at http://groups.google.com/group/sympy.
  To view this discussion on the web visit
 
  https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 You received this message because you are subscribed to the Google Groups
 sympy group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sympy+unsubscr...@googlegroups.com.
 To post to this group, send email to sympy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sympy.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/sympy/a4532a04-24c8-4047-966e-ea250f880448%40googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BGBZtkq7x%2Bzqd2%2BJeCb0Ny4W_xwTgD9RYOGfPmDX6p5w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Tim Lahey

Hi,

I just tried the following in Sympy Live,


a = Integer(10e300)
a*a

1000105009520510408843254158786618710055633864690265631839011071418455537580482111259090046290613807821571488690140306370268878101524273777500358850838160825508142631371503543452789490974534195024707673633928999328085912958813715689402882445036060400419021562076363830273198436141062593970981076768615643036044297117131064842264303380707112317287679887092073518969577415226169300743617466725838681703953780178047441856281023622246186808454593221547298621359043682101570083702480343443680493585115727808066223112657792291096692290065050262017374722703449186126799737068530992997728256

It looks like it supports large integers.

Cheers,

Tim.

On 4 Mar 2014, at 21:06, Ambar Mehrotra wrote:


@Tim,
This link http://docs.sympy.org/latest/tutorial/manipulation.html says 
that
SymPy's Integer class is similar to python's built-in int type. It 
just

plays well with other sympy classes.
Gmpy is currently not supported on google app engine so I presume it 
will
have issues working with sympy live. Plus the point is creating 
something
that is native to sympy rather than using other libraries, both 
because
sympy already has a class for various data types and people use sympy 
a lot

for calculations.

On Wednesday, 5 March 2014 06:36:51 UTC+5:30, Tim Lahey wrote:


Hi,

Is there integers that Sympy can't represent? The Integer class is
independent of python int. What would this module add to Sympy?
Alternatively, should it be part of Numpy instead, if it's just
numerics?

I'm just a bit unclear on what you want to do.

Cheers,

Tim.

On 4 Mar 2014, at 18:59, Ambar Mehrotra wrote:


Hi,

I am Ambar Mehrotra and undergraduate from BITS Pilani, India 
pursuing

Information Systems.
I like to play with numbers and have a descent experience with 
python.


I would like to suggest the addition of a 'BigInteger' module in the
sympy.core.numbers class.
Currently there is no convenient way of storing and working with 
very

large
numbers in python. I came across this problem while solving a 
question

of
Google Code Jam where python ran out of memory while doing a long
calculation.
I would like to take user input in form of a string and then use
algorithms
to do some basic math operations using numpy to make things faster.

Please tell me if this idea is worth considering and guide me 
further

if
you like it.

with regards,
Ambar Mehrotra.

--
You received this message because you are subscribed to the Google
Groups sympy group.
To unsubscribe from this group and stop receiving emails from it, 
send

an email to sympy+un...@googlegroups.com javascript:.
To post to this group, send email to 
sy...@googlegroups.comjavascript:.



Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit


https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.


For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to the Google 
Groups sympy group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to sympy+unsubscr...@googlegroups.com.

To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/cc383ace-4523-40be-9213-e00b347e2239%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/86999404-7909-434B-8D34-C047D480F50C%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Ambar Mehrotra
@Tim,

Well seems like the idea was a bugger :p

On Wednesday, 5 March 2014 06:36:51 UTC+5:30, Tim Lahey wrote:

 Hi, 

 Is there integers that Sympy can't represent? The Integer class is 
 independent of python int. What would this module add to Sympy? 
 Alternatively, should it be part of Numpy instead, if it's just 
 numerics? 

 I'm just a bit unclear on what you want to do. 

 Cheers, 

 Tim. 

 On 4 Mar 2014, at 18:59, Ambar Mehrotra wrote: 

  Hi, 
  
  I am Ambar Mehrotra and undergraduate from BITS Pilani, India pursuing 
  Information Systems. 
  I like to play with numbers and have a descent experience with python. 
  
  I would like to suggest the addition of a 'BigInteger' module in the 
  sympy.core.numbers class. 
  Currently there is no convenient way of storing and working with very 
  large 
  numbers in python. I came across this problem while solving a question 
  of 
  Google Code Jam where python ran out of memory while doing a long 
  calculation. 
  I would like to take user input in form of a string and then use 
  algorithms 
  to do some basic math operations using numpy to make things faster. 
  
  Please tell me if this idea is worth considering and guide me further 
  if 
  you like it. 
  
  with regards, 
  Ambar Mehrotra. 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups sympy group. 
  To unsubscribe from this group and stop receiving emails from it, send 
  an email to sympy+un...@googlegroups.com javascript:. 
  To post to this group, send email to sy...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/sympy. 
  To view this discussion on the web visit 
  
 https://groups.google.com/d/msgid/sympy/7ec24c8c-02d0-4e02-afb4-ca35a75207f5%40googlegroups.com.
  

  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
You received this message because you are subscribed to the Google Groups 
sympy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/fe36adbd-f999-4e78-a74e-07f21838354f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sympy] Addition of 'BigInteger' to Numbers

2014-03-04 Thread Ondřej Čertík
On Tue, Mar 4, 2014 at 6:37 PM, Ambar Mehrotra ambar.pri...@gmail.com wrote:
 @Tim

 Even in python an integer is automatically converted to long type but it
 cannot go further. And as sympy has a numbers class for other data types as

You might be misunderstanding how Python integers work. Your
BigInteger class is just Python int. E.g., in pure Python:

 2**100
1267650600228229401496703205376L
 2**1000
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376L
 2**1
1995063116880758384883742162683585083823496831886192454852008949852943883022194663191996168403619459789933112942320912427155649134941378111759378593209632395785573004679379452676524655126605989552055008691819331154250860846061810468550907486608962488809048989483800925394163325785062156830947390255691238806522509664387444104675987162698545322286853816169431577562964076283688076073222853509164147618395638145896946389941084096053626782106462142794036525565649530603142680234969400335934316651459297773279665775606172582031407994198179607378245683762280037302885487251900834464581454650557929601414833921615734588139257095379769119277800826957735671230620187578363255027283237892707103738028663930314281332414016241956716905740614196543423246388012488561473052074319922596117962501309928602417083408076059323201612684922884962558413128440615367389514871142563151110897455142033138202029316409575964647560104058458415660720449628670165150619206310041864222759086709005746064178569519114560550682512504060075198422618980592371180578807290639524254833922198270740447316237676084661303377870603980341319713349365462270056316993745550824178097281098329131440357187752476850985727693792643322159939987688666080836883783802764328277517227365757274478411229438973381086160742325329197481312019760417828196569747589816453125843413595986278413012818540628347664908869052104758088261582396198577012240704433058307586903931960460340497315658320867210591330090375282341553974539439771525745529051021231094732161075347482574077527398634829849834075693795564663862187456949927901657210370136443313581721431179139822298384584733444027096418285100507292774836455057863450110085298781238947392869954083434615880704395911898581514577917714361969872813145948378320208147498217185801138907122825090582681743622057747592141765371568772561490458290499246102863008153558330813010198767585623434353895540917562340084488752616264356864883351946372037729324009445624692325435040067802727383775537640672689863624103749141096671855705075909810024678988017827192595338128242195402830275940844895501467666838969799688624163631337639390337345580140763674187771105538422573949911018646821969658165148513049422236994771476306915546821768287620036277725772378136533161119681128079266948188720129864366076855163986053460229787155751794738524636944692308789426594821700805112032236549628816903573912136833839359175641873385051097027161391543959099159815465441733631165693603112224993796226781732358023111862644575299135758175008199839236284615249881088960232244362173771618086357015468484058622329792853875623486556440536962622018963571028812361567512543338303270029097668650568557157505516727518899194129711337690149916181315171544007728650573189557450920330185304847113818315407324053319038462084036421763703911550639789000742853672196280903477974533320468368795868580237952218629120080742819551317948157624448298518461509704888027274721574688131594750409732115080498190455803416826949787141316063210686391511681774304792596709376L

etc.

Yes, Python ints are not as optimized as GMP for large integers, but
it shouldn't run out of memory or have other issues. It is just
slower, though usually fast enough for most applications.

If this speed really matters to you, then use gmpy with sympy and you
are all set.

Ondrej

 well this can also be included. Wanted to build something similar to this
 http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html.

 On Wednesday, 5 March 2014 06:38:47 UTC+5:30, Ondřej Čertík wrote:

 On Tue, Mar 4, 2014 at 4:59 PM, Ambar Mehrotra ambar@gmail.com
 wrote:
  Hi,
 
  I am Ambar Mehrotra and undergraduate from BITS Pilani, India pursuing
  Information Systems.
  I like to play with numbers and have a descent experience with python.
 
  I would like to suggest the addition of a 'BigInteger' module in the
  sympy.core.numbers class.
  Currently there is no convenient way of storing and working with very
  large
  numbers in python. I came across this problem while solving a question
  of
  Google Code Jam where python ran out of memory while doing a long
  calculation.
  I would like to take user input in form of a string and then use
  algorithms
  to do some basic math operations using numpy to make things faster.
 
  Please