Bug ?

25 views
Skip to first unread message

Christophe Bal

unread,
May 4, 2014, 9:24:30 AM5/4/14
to sympy-list
Hello.

The folowing code gives a wrong output in IPython. Indeed the fraction 1/4 disapears...

Christophe BAL


---------------------
from sympy import *

init_printing()

x = var("x")

f = x**3 + cos(x+1/4)

print f

Christophe Bal

unread,
May 4, 2014, 9:29:34 AM5/4/14
to sympy-list
If I use S(1)/4 or 1./4, all works as expected.

I have understood that is normal because 1/4 is an euclidean division. Sorry, I always use Python 3 where 1/4 is a float division.

Chris Smith

unread,
May 9, 2014, 12:17:38 PM5/9/14
to sy...@googlegroups.com
You can also do `from __future__ import division` to get 1/2 to not reduce to 0.
Reply all
Reply to author
Forward
0 new messages