This is now
  http://trac.sagemath.org/ticket/19850


On 2016-01-08 18:16, Daniel Krenn wrote:
> Dear all,
> 
> from the method-name and also from the one-line description
>     "Return True if this symbolic expression is a constant."
> of Expression.is_constant, I expected that this gives more or less the
> same result as checking whether symbolic expression has an empty
> .variables(). However, we have
>    sage: log(2).is_constant()
>    False
> and also
>    sage: SR(2).is_constant()
>    False
> only pi, e and that stuff is "constant".
> I find this very confusing. Am I alone with this feeling?
> 
> The above is also inconsistent to
>    sage: P.<p> = ZZ[]
>    sage: P(2).is_constant()
>    True
> 
> Best wishes,
> 
> Daniel
> 
> PS: To be fair, after the one-line description, it is explained what it
> really does:
>    This function is intended to provide an interface to query the
>    internal representation of the expression. In this sense, the word
>    "constant" does not reflect the mathematical properties of the
>    expression. Expressions which have no variables may return "False".
> But the phrase "the internal representation of the expression" sounds
> like the end user should not care about it... (i.e. this is_constant
> could be an underscore-method...).
> 
> PPS: At the moment (not having answers to this posting), my favourite
> implementation would be something like
>    def is_constant(self):
>        return not self.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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to