Am 15.05.2015 um 03:42 schrieb Duane Nykamp:
I don't think this is the desired behavior.
In [3]: a=Symbol('a')
In [4]: bool(And(2>a, a>2))
Out[4]: True
The `And` does not simplify, and the bool() conversion turns it into a
Pythonic `True`.
The former happens because assumptions don't know
In the end, I would think that an expression like
In [10]: bool(And(a>2, a<3))
Out[10]: True
should raise a TypeError, like
In [11]: bool(a>2)
[snip]
TypeError: cannot determine truth value of
a > 2
I assume so as, as there is no way to know if a is between 2 and 3.
Shouldn't it have the sam
I agree that `bool(And(a>2, a<3))` and `bool(a>2)` should show analogous
behaviour.
At least that's what I'd assume from my current understanding of
assumptions and evaluation in SymPy. I'd like to defer to the real
experts on these components (I think that's @asmeurer and @certik).
--
You rec
Yes, it turned out to mess it up for my use case. It would just confuse
folks using my application if And(a>2, a<3) ended up always being true when
a is symbolic.
My solution was to make a derived class off And and add the methods
def __nonzero__(self):
raise TypeError("cannot dete
I agree. If bool(x > 2) raises TypeError then so should bool(And(a >
2, a < 2)).
Aaron Meurer
On Fri, May 15, 2015 at 5:01 PM, Duane Nykamp wrote:
> Yes, it turned out to mess it up for my use case. It would just confuse
> folks using my application if And(a>2, a<3) ended up always being true w
Hello,
I'm a physics student from Göttingen and currently working on scientific
simulation software in c++. I am currently using sympy in my python
wrappers as it allows a convenient way for users to define and view
simulation functions (they get compiled on-the-fly and are passed as
function
Hi Lars,
On Fri, May 15, 2015 at 4:56 AM, The Lartians wrote:
> Hello,
>
> I'm a physics student from Göttingen and currently working on scientific
> simulation software in c++. I am currently using sympy in my python wrappers
> as it allows a convenient way for users to define and view simulatio
On Fri, May 15, 2015 at 6:09 PM, Ondřej Čertík wrote:
> Hi Lars,
>
> On Fri, May 15, 2015 at 4:56 AM, The Lartians wrote:
>> Hello,
>>
>> I'm a physics student from Göttingen and currently working on scientific
>> simulation software in c++. I am currently using sympy in my python wrappers
>> as
All right, it took me longer than I had anticipated, but I have this
project assembled in a more complete form now. To recap, the idea is to
simplify allow for accurate evaluation of integrals of discontinuous
functions, for which the form of the discontinuity is known beforehand.
There is a pa
@asmeurer
For this piece of code
>>> x = Symbol('x', real=True)
>>> bool( x > S(2) )
TypeError: can not determine the truth value of Relational
I think, even if this returns an error then it should "not" be TypeError.
Since a real number comparison is there in this. What are your views on
this
10 matches
Mail list logo