Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2011-05-21 16:03:27 -0500

kcrisman gravatar image

Getting range from things which aren't integers yet, but will be

Consider the following:

sage: f(n)=ceil(sqrt(2*n)-1/2)
sage: g = lambda n: ceil(sqrt(2*n)-1/2)

Then we get

sage: [0..g(3)]
[0, 1, 2]
sage: [0..f(3)]
   1068     else:
-> 1069         icount = int(math.ceil(float(count) - endpoint_tolerance))
TypeError: unable to simplify to float approximation

And I understand why this is. But it's still annoying. We should be able to avoid lambda functions if at all possible.

Similarly, trying workarounds involving numerical evaluation like

sage: f(n)=ceil(RR(sqrt(2*n)-1/2))

cause problems about numerically evaluating symbolic expressions - rightly, though it would be nice to have a way to hold that evaluation.

So my two questions are, in both of these cases, is there a reasonable way to fix Sage so that these things work?

An accepted answer will include a link to an existing or newly created Trac ticket that has a concrete idea.