On Aug 5, 2009, at 1:11 PM, Fabian Pedregosa Izquierdo wrote:
> > Vinzent Steinberg wrote: >> 2009/8/4 Ondrej Certik <ond...@certik.cz>: >>> Yes, please do so. Let's merge now. If you could get things running >>> (=done:) till this Friday, it'd be awesome. Luke and Aaron will >>> come, >>> so we can hack on this together. >> >> Yeah, let's get it merged. In the long run I would like such syntax: >> >> Assume(x > 0) >> Assume(x in RR) == Assume(x, rational=True) > > That would be nice. For the first one, I think that could be done, > only > that we would need to solve inequalities for the non-trivial examples. > for the "x in RR", I don't think there's the possibility to override > "in" in python Isn't it just __contains__ (http://docs.python.org/reference/datamodel.html?highlight=__contains__#object.__contains__ )? We would have to have special QQ or RR objects that would return something other than True or False for "x in QQ" (so it can be useful to Assume), which would technically be a kind of hack, being against Python standards, so the QQ and RR objects would have to be used exclusively for that purpose. But I think that the syntax would be technically possible in this way, unless Python absolutely fails without a boolean return value. Maybe you could even then have it temporarily set some kind of global variable somewhere that Assume could pick up. I definitely agree with having Assume(x > 0). Would Assume(x == 0) or Assume(x = 0) work too? We should at least allow Assume(Eq(x, 0)). Also, would Python let us do Assume(0>x>1), or would we have to do Assume(x<0)&&Assume(x>1)? Maybe if we ever get a decent Interval class, we could use that too. Aaron Meurer > >> >> Do you think the "in" syntax could replace the keyword argument >> syntax? The latter one does not make much sense for relational >> assumptions, e.g.: >> >> Assume(x > y, positive=True) >> >> But we can implement this before the interface gets stable (i.e. >> before a release). > > Yes. I'm about to send some reworked patches of this with some of the > ideas we discussed in Leipzip. > >> >> Vinzent >> >>> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---