Well I tried auto_int_to_Integer=True, with no effect:

from sympy import init_session

init_session(auto_int_to_Integer=True)
IPython console for SymPy 0.7.4.1 (Python 2.7.7-64-bit) (ground types: gmpy)

These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)

Documentation can be found at http://www.sympy.org
WARNING: Hook shutdown_hook is deprecated. Use the atexit module instead.

type(1/3)
Out[3]: float

pprint(1/3)
0.333333333333



On Monday, 20 October 2014 19:18:40 UTC+2, Marek Kaluba wrote:
>
> Hi all,
>
> recently I started using sympy (and immediately fall for it), so this mail 
> may be simply my lack of understanding how sympy internally works.
> However I found a _strange_ (to me) issue with numerical evaluation:
>
> (ipython console)
> from sympy import *
> N(1/3)
> 0 //integer division, ok
> N(Rational(1)/Rational(3),20)
> 0.33333333333333333333 //numerical approximation of 1/3, ok
>
> init_session() //for nice latex printing and default variables -- I guess 
> this is what init_session() does??
> [...] //standard output
>
> pprint(N(1/3))
> 0.333333333333333 // why not 0?
>
> pprint(N(1/3,100))
>
> 0.3333333333333333148296162562473909929394721984863281250000000000000000000000
> 000000000000000000000000
> // what is happening here??
>
> I'd be grateful if anyone can explain this to me...
>
> Cheers,
> Mark
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/203eb3ef-b8dd-49f8-8a94-4d1b3418d23d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to