On Mar 21, 10:00 pm, Gonzalo Tornaria <torna...@math.utexas.edu>
wrote:
> In sage 4.8:
>
> sage: NaN - NaN
> sage: 0
> sage: NaN + NaN
> 2*NaN
> sage: NaN * NaN
> NaN^2

Naturally!  Since NaN is a symbolic expression, apparently:

sage: type(NaN)
<type 'sage.symbolic.expression.Expression'>

See  sage/symbolic/constants.py, e.g.
http://hg.sagemath.org/sage-main/file/c239be1054e0/sage/symbolic/constants.py#l665
Based on the code in that file, I think that means this is the Pynac
NaN.

You can't do this in vanilla IPython.

In [1]: NaN
NameError: name 'NaN' is not defined
In [7]: float('nan')
Out[7]: nan

Also, it looks like we have two different NaN/nan's hanging around.

sage: float('nan')
nan
sage: float('NaN')
nan
sage: SR(float('nan'))
nan
sage: bool(SR(float('nan')) == NaN)
False

Naturally, none of this solves your problem, but maybe it puts it in
context... why not have polynomials in NaN, after all? :)
- kcrisman

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to