TypeError: cannot determine truth value of

340 views
Skip to first unread message

Paul Royik

unread,
Jul 9, 2015, 1:40:18 AM7/9/15
to sy...@googlegroups.com
I'm using sympy on my site together with django and mod_wsgi.
From time to time (i.e. this error is not reproducible) I've got the following error:
TypeError: cannot determine truth value of
3*pi/8 >= 7*pi/8

In other words, error is raised when I try to compare numerical values.
Can someone explain why is that and how can I avoid it?

Thank you.

Aaron Meurer

unread,
Jul 9, 2015, 3:26:53 PM7/9/15
to sy...@googlegroups.com
Is there a traceback with the error? Is it coming from SymPy code or
your own code?

Aaron Meurer
> --
> 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/8997bc44-a5d5-42d8-b818-32bc5c0153b8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Paul Royik

unread,
Jul 9, 2015, 6:12:06 PM7/9/15
to sy...@googlegroups.com
Traceback is quite short:

File "/home/mysite/lib/python2.7/sympy/core/relational.py", line 103, in __nonzero__
    raise TypeError("cannot determine truth value of\n%s" % self)


TypeError: cannot determine truth value of
pi/5 < 0

Paul Royik

unread,
Jul 9, 2015, 6:23:10 PM7/9/15
to sy...@googlegroups.com
And another one:

 File "/home/mysite/lib/python2.7/sympy/core/relational.py", line 103, in __nonzero__
    raise TypeError("cannot determine truth value of\n%s" % self)

TypeError: cannot determine truth value of
3*pi/8 >= 7*pi/8

Aaron Meurer

unread,
Jul 9, 2015, 6:49:56 PM7/9/15
to sy...@googlegroups.com
This looks like a bug. Numerical values should be evaluated in inequalities.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/f1d7e20f-1c53-411d-a9eb-1e56a5246cc2%40googlegroups.com.

Paul Royik

unread,
Jul 11, 2015, 3:02:46 AM7/11/15
to sy...@googlegroups.com
But this can't be reproduced.
It is a bug from time to time.
How can this be possible?

Joachim Durchholz

unread,
Jul 11, 2015, 3:32:26 AM7/11/15
to sy...@googlegroups.com
Am 11.07.2015 um 09:02 schrieb Paul Royik:
> But this can't be reproduced.
> It is a bug from time to time.
> How can this be possible?

Some non-deterministic code path, it seems.

Calls for a debugging session to find out what's happening.
Reply all
Reply to author
Forward
0 new messages