Groups
Groups
Sign in
Groups
Groups
sympy
Conversations
About
Send feedback
Help
Bug ?
25 views
Skip to first unread message
Christophe Bal
unread,
May 4, 2014, 9:24:30 AM
5/4/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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 AM
5/4/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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 PM
5/9/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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