On Thu, 28 Aug 2008 13:36:53 -0700 (PDT)
kcrisman <[EMAIL PROTECTED]> wrote:

> 
> The reciprocal of tangent is not a constant function, but Sage says
> otherwise.  This is now http://trac.sagemath.org/sage_trac/ticket/3980
> .
> 
> (Incidentally, using z(x)=tan(x) also doesn't work, as it yields a
> NotImplementedError (whose message could be better) for 1/z;
> presumably the bug below would occur even if it were implemented,
> though.)
> 
> - kcrisman
> 
> sage: z=tan
> sage: z
> tan
> sage: 1/z
> 1/tan
> sage: find_root(1/z,1,2)
> ---------------------------------------------------------------------------
> RuntimeError                              Traceback (most recent call
> last)
<snip>
> RuntimeError: no zero in the interval, since constant expression is
> not 0.

This is actually a problem with how the symbolic functions/expressions
are handled. The find_root function cannot recognize that 1/z is a
function. This works:

sage: z = 1/tan
sage: f = lambda x: z(x)
sage: find_root(f,1, 2)
1.5707963267948968

and this:

sage: find_root(z(x),1, 2)
1.5707963267948968


I am working on making arithmetic with function objects more intuitive,
and free of these kinds of problems as a part of the effort to use
ginac as a basis for symbolics. This might result in some changes to
the user interface for such things, but hopefully there will be less
problems of this kind.

Cheers,

Burcin

--~--~---------~--~----~------------~-------~--~----~
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