Re: [sage-devel] how should the expression relation test be named?
> > ex.can_hold() I think ex.satisfiable() is more succinct here and it allows things like ex.satisfiable(for_all((n,ZZ),(x,CC))) -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
On Sun, Sep 27, 2015 at 3:53 AM, Samuel Lelievre wrote: > > > 2015-09-26 09:53:38 UTC+2, Ralf Stephan: >>> >>> The question is if we should call it is(). >> >> >> Impossible because it is a Python keyword. >> So, lacking a better proposal I'll stick to holds() > > > What about the following, where ex is a symbolic > equality or inequality: > > ex.can_hold() > whether there are values of the variables for which ex holds > > ex.always_holds() > whether ex holds for all values of the variables Possibly tongue-in-cheek: ex.obviously_holds() ex.trivially_holds() ex.clearly_holds() ex.holds_trivially() but that is the sort of (possibly annoying) terminology mathematicians typically use to distinguish between "easy to prove is 0 if possible" and "prove is 0 or die trying!" William > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- William (http://wstein.org) -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
2015-09-26 09:53:38 UTC+2, Ralf Stephan: > > The question is if we should call it is(). >> > > Impossible because it is a Python keyword. > So, lacking a better proposal I'll stick to holds() > What about the following, where ex is a symbolic equality or inequality: ex.can_hold() whether there are values of the variables for which ex holds ex.always_holds() whether ex holds for all values of the variables -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
> > The question is if we should call it is(). > Impossible because it is a Python keyword. So, lacking a better proposal I'll stick to holds() -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
On Friday, September 25, 2015 at 8:42:12 AM UTC+2, Bill Page wrote: > > In Maple 'is' is part of the assume mechanism > > http://www.maplesoft.com/support/help/maple/view.aspx?path=assume > Thanks. That's it indeed. and returns True, False or FAIL (if it cannot determine whether the > property is always satisfied). Maple also has 'evalb' and 'testeq' > with somewhat different semantics. > > Are you proposing a similar "tristate" logic in Sage? > Not yet. Is there somewhere that I can find "Truth(tm)"? > I must apologize. This was a joke, of course ("trademark"). -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
In Maple 'is' is part of the assume mechanism http://www.maplesoft.com/support/help/maple/view.aspx?path=assume and returns True, False or FAIL (if it cannot determine whether the property is always satisfied). Maple also has 'evalb' and 'testeq' with somewhat different semantics. Are you proposing a similar "tristate" logic in Sage? Is there somewhere that I can find "Truth(tm)"? On 25 September 2015 at 02:09, Ralf Stephan wrote: > On Thursday, September 24, 2015 at 8:22:53 PM UTC+2, Bill Page wrote: >> >> What answer should be expected when it is not possible to show that an >> expression is zero? Would you expect that >> >>ex.is_zero() = not(ex.is_nonzero()) ? > > > Yes, for constant expressions (i.e. not containing symbols) at the moment. > With new code, yes for all expressions. > >> >> I suppose that I should expect True or False from >> >> bool(ex=0) >> >> and False in the case that it cannot be shown to be true. > > (assuming you meant bool(ex==0)) > If you expect that then don't be surprised when innocent code > behaves wrongly and uses unnecessary time, because the > function that gets called will also get called with e.g. if (ex):... > > Having an explicit function for showing Truth(tm) will prevent > this. > >> >> But I am not >> so sure about is_... Do you expect only two possible outcomes and an >> runtime error in the case of a failure to decide one or the other? > > > Having an explicit function for showing Truth(tm) will allow it > to have three results: Yes/No/NotImplemented > (Exceptions for things like complex x > 0). > > Ticket #17700 proposes tristate logic, SymPy has it too. > > The question is if we should call it is(). > I just found that Maple too uses that name, so please voice any > final objections. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
On Thursday, September 24, 2015 at 8:22:53 PM UTC+2, Bill Page wrote: > > What answer should be expected when it is not possible to show that an > expression is zero? Would you expect that > >ex.is_zero() = not(ex.is_nonzero()) ? > Yes, for constant expressions (i.e. not containing symbols) at the moment. With new code, yes for all expressions. > I suppose that I should expect True or False from > > bool(ex=0) > > and False in the case that it cannot be shown to be true. (assuming you meant bool(ex==0)) If you expect that then don't be surprised when innocent code behaves wrongly and uses unnecessary time, because the function that gets called will also get called with e.g. if (ex):... Having an explicit function for showing Truth(tm) will prevent this. > But I am not > so sure about is_... Do you expect only two possible outcomes and an > runtime error in the case of a failure to decide one or the other? > Having an explicit function for showing Truth(tm) will allow it to have three results: Yes/No/NotImplemented (Exceptions for things like complex x > 0). Ticket #17700 proposes tristate logic, SymPy has it too. The question is if we should call it is(). I just found that Maple too uses that name, so please voice any final objections. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
What answer should be expected when it is not possible to show that an expression is zero? Would you expect that ex.is_zero() = not(ex.is_nonzero()) ? I suppose that I should expect True or False from bool(ex=0) and False in the case that it cannot be shown to be true. But I am not so sure about is_... Do you expect only two possible outcomes and an runtime error in the case of a failure to decide one or the other? On 24 September 2015 at 02:47, Ralf Stephan wrote: >> ex.is_zero(simplify=False) >> ex.is_zero(simplify=True) > > > This fits if ex is an equality. But what about: if x>0 ? > Two functions are necessary for inequalities because (x>0).__nonzero__ > is called by (x>0)._cmp_ in case of eg. uniq(list of exes) and > here print or alphabetical order is called for, not proof. > > So there is still a need for hold/truth() etc it seems. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
On Thursday, September 24, 2015 at 3:02:05 PM UTC+2, vdelecroix wrote: > > def is_zero(self): > return not self > This is the same as return not bool(self) which calls self.__nonzero__(). this works > > sage: matrix([x==3]) > [x == 3] > > Should it? > That seems no longer relevant (I just checked, nonzero is not called). But this is even worse: sage: (x==3).is_zero() True So this ticket could easily disallow it. > I do not like hold since it is already used as a keyword everywhere in symbolics Maxima has "is(relation)". How about this? -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
On 24/09/15 03:47, Ralf Stephan wrote: ex.is_zero(simplify=False) ex.is_zero(simplify=True) This fits if ex is an equality. But what about: if x>0 ? Two functions are necessary for inequalities because (x>0).__nonzero__ is called by (x>0)._cmp_ in case of eg. uniq(list of exes) and here print or alphabetical order is called for, not proof. So there is still a need for hold/truth() etc it seems. I like the is_zero which is consistent with the rest of Sage (ie sage.structure.element.Element). But note that the default implementation there is def is_zero(self): return not self def __nonzero__(self): return self != self._parent.zero() I think that if a relation is fed into such a test it should have break earlier if it was not expected. Note that in a context related to your initial problem, this works sage: matrix([x==3]) [x == 3] Should it? I do not like hold since it is already used as a keyword everywhere in symbolics sage: cos(pi, hold=True) cos(pi) Vincent -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
> > ex.is_zero(simplify=False) > ex.is_zero(simplify=True) This fits if ex is an equality. But what about: if x>0 ? Two functions are necessary for inequalities because (x>0).__nonzero__ is called by (x>0)._cmp_ in case of eg. uniq(list of exes) and here print or alphabetical order is called for, not proof. So there is still a need for hold/truth() etc it seems. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
On Wednesday, September 23, 2015 at 11:14:32 PM UTC+2, William wrote: > ex.is_zero(simplify=False) > ex.is_zero(simplify=True) Most consistent. Why didn't I think of this. On Wednesday, September 23, 2015 at 10:08:52 PM UTC+2, Michael Orlitzky wrote: > > Doesn't `bool(x == y)` already try to simplify `x - y` to zero? > At the moment yes. But it is also invoked when people want to compare objects and write if (ex!=0). See example confusion at http://trac.sagemath.org/ticket/18979 -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
On Wed, Sep 23, 2015 at 9:31 AM, Ralf Stephan wrote: > Symbolic expressions are tested for zero with bool(ex) at the moment, > regardless if one wants to know if ex is identical with the zero object > or if one wants a simplification of ex (which is slow). > > Because a finer-grained interface is needed that does not surprise the > user I would like to have your opinion how the function should be > named that attempts a simplification/proof. > > [ ] - ex.holds() and holds(ex) > [ ] - ex.truth() and truth(ex) > [ ] - your idea: ... > > Thanks in advance for your opinion! So you want to name a function that tests whether or not ex is "identical with the zero object". What about ex.is_zero_object() or ex.is_identical_to_zero() or ex.is_zero(simplify=False) ex.is_zero(simplify=True) -- William > > You can see the bigger picture with code at: > http://trac.sagemath.org/ticket/19040 > > Regards, > > > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- William (http://wstein.org) -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] how should the expression relation test be named?
On 09/23/2015 12:31 PM, Ralf Stephan wrote: > Symbolic expressions are tested for zero with bool(ex) at the moment, > regardless if one wants to know if ex is identical with the zero object > or if one wants a simplification of ex (which is slow). > > Because a finer-grained interface is needed that does not surprise the > user I would like to have your opinion how the function should be > named that attempts a simplification/proof. > Doesn't `bool(x == y)` already try to simplify `x - y` to zero? -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.