Hi Kate,

I actually just put a patch up for #1289 last night which should make
it into 2.10.  Here is the behavior with the patch:

sage: madness(10.0, exp)
<type 'sage.rings.integer.Integer'> <type 'sage.rings.integer.Integer'>
'Life is sane.'
sage: madness(10, exp)
<type 'sage.rings.integer.Integer'> <type 'sage.rings.integer.Integer'>
'Life is sane.'
sage: madness(10.0, log)
<type 'sage.rings.integer.Integer'> <type 'sage.rings.integer.Integer'>
'Life is sane.'
sage: madness(10, log)
<type 'sage.rings.integer.Integer'> <type 'sage.rings.integer.Integer'>
'Life is sane.'

Ahh... sanity :)

--Mike

On Jan 17, 2008 9:40 AM, Kate <[EMAIL PROTECTED]> wrote:
>
> The following function demonstrates a hang problem in 2.9.3 (and
> 2.10.alpha4)
> and a question about return types.
>
> Kate
>
> ----------------------------------------------------------------------------------------------------------
>
> def madness(n, func):
>   r"""
>   Test floor(func(n)) for strange behaviour...
>
>   EXAMPLES:
>     sage: version()
>     'SAGE Version 2.9.3, Release Date: 2008-01-05'
>
>     # one hangs
>     sage: madness(10.0,exp)
>     <type 'sage.rings.integer.Integer'> <type
> 'sage.rings.integer.Integer'>
>     'Life is sane.'
>     sage:madness(10,exp)
>     <class 'sage.calculus.calculus.SymbolicComposition'> <type
> 'sage.rings.integer.Integer'>
>     ... hangs indefinitely ...
>
>     # One says Integer other says SymbolicComposition - is this
> expected?
>     sage: madness(10.0,log)
>     <type 'sage.rings.integer.Integer'> <type
> 'sage.rings.integer.Integer'>
>     'Life is sane.'
>     sage: madness(10,log)
>     <class 'sage.calculus.calculus.SymbolicComposition'> <type
> 'sage.rings.integer.Integer'>
>     'This is madness.'  # In sage-2.10.alpha4 returns 'Life is sane'
>   """
>
>   ff = floor(func(n))
>   Iff = Integer(ff)
>   assert ff == Iff
>   print type(ff), type(Iff)
>
>   f = 0
>   while f < ff:
>     f = f + 1
>
>   if f == ff:
>     return "Life is sane."
>   else:
>     return "This is madness."
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to