#6523: [with patch, needs review] .is_zero() method raises error for symbolic
expression involving derivative
-----------------------+----------------------------------------------------
Reporter: gmhossain | Owner:
Type: defect | Status: new
Priority: major | Milestone:
Component: symbolics | Keywords:
Reviewer: | Author:
Merged: |
-----------------------+----------------------------------------------------
Description changed by gmhossain:
Old description:
> If a symbolic expression contains symbolic derivative then
> checking whether it is zero, raises error:
> {{{
> sage: x.diff(x,2).is_zero()
> True
>
> sage: f(x) = function('f',x)
> sage: f(x).diff(x).is_zero()
> ....
> NotImplementedError: derivative
> }}}
>
> This fails because new symbolics tries to convert it to maxima
> expression for checking the relation.
>
> It works fine for any other expression not involving symbolic
> derivative and without invoking maxima.
>
> It seems to me, pynac relational test needs to be fixed.
New description:
If a symbolic expression contains symbolic derivative then
checking whether it is zero, raises error:
{{{
sage: x.diff(x,2).is_zero()
True
sage: f(x) = function('f',x)
sage: f(x).diff(x).is_zero()
....
NotImplementedError: derivative
}}}
This fails because new symbolics tries to convert it to maxima
expression for checking the relation.
'''Update:'''
'''*''' A patch to fix the issue is attached. The patch
adds a new method ".has_fderivative()" for symbolic expressions
and in `__nonzero__` method adds a check whether it has fderivative.
'''Comments''' (for future works):
A simple timing comparison that illustrates why we should
avoid calling maxima to assert nonzero even for symbolic
functions
{{{
sage: f(x) = function('f',x)
sage: timeit('sin(f(x)).is_zero()')
5 loops, best of 3: 85.8 ms per loop
sage: timeit('sin(f(x).diff(x)).is_zero()')
625 loops, best of 3: 132 µs per loop
}}}
It seems pynac is 400 times faster than maxima in this case.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6523#comment:1>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---