On Sat, Feb 21, 2009 at 4:20 PM, Fabian Seoane <[email protected]> wrote:
>
>
> On Sat, Feb 21, 2009 at 8:36 PM, Ondrej Certik <[email protected]> wrote:
>>
>> Hi Fabian!
>>
>> On Sat, Feb 21, 2009 at 2:50 AM, Fabian Seoane <[email protected]>
>> wrote:
>> > Hi all. As part of my work in the assumptions branch[1], I'm faced to
>> > the
>> > problem of finding a new syntax for the expr.is_* property.
>> >
>> > It seems that last time we talked about it, we used the following syntax
>> > for
>> > querying an element (although we did not discuss it)
>> >
>> > IsPositive(x)
>> > IsElement(x)
>> > etc.
>> >
>> > This is ok, but I find it cumbersome to have so many methods (at least
>> > one
>> > for each assumption we support). Alternatively, my implementation
>> > proposes another solution based on the query method. You can see it's
>> > implementation here [2]. Examples would look like:
>> >
>> > query(x, 'positive')
>> > query(x, 'real')
>> >
>> > It works the following way:
>> >     Each query key ('positive', 'real') defines a QueryHandler that is
>> > responsible for handling the resolution of the current query. Then
>> > query_dict maps each assumption
>> > to it's handler. Of course we could define shortcuts:
>> >
>> > def IsPositive(x):
>> >     return query(x, 'positive')
>> >
>> > The nice thing here is extensibility: If any third-party module would
>> > like
>> > to add new query keys (query(x, 'my_key')), just append the appropriate
>> > handler to query_dict (all this is better understood looking at [2]).
>> >
>> > Of course, Is* syntax can also be made extensible by subclassing, so it
>> > all
>> > comes at the end to a matter of consistency.
>> >
>> > Any comments? Which syntax do you prefer ?
>>
>> Thanks for working on it. I think your approach is fine. We can always
>> define such methods, or properties if needed (like is_positive).
>> Important is, that the assumptions will be detached from the
>> expression, because then we can merge the cython core in.
>
> ok, great. i too find important that assumptions are detached from
> expressions, and from the work i've done
> so far i think it is even possible to detach assumptions from the core.

Yes, that'd be cool. When this is done, I will work on integrating the
Cython core in (optionally), thus making sympy not only rich, but also
fast.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to