On Thu, Nov 19, 2009 at 6:08 PM, Alex Raichev <tortoise.s...@gmail.com> wrote:
> Hi all:
>
> Related to http://trac.sagemath.org/sage_trac/ticket/6243, it appears
> that using derivatives of callable symbolic functions as dictionary
> keys is broken in Sage 4.2.1.  See below.  It works for functions of
> one and two variables but not three.
>
> Alex

A temporary workaround is to use str():

X= var('x,y,z')
f= function('f',*X); f
d= {}
for l in [1..2]:
     for s in UnorderedTuples(X,l):
         print diff(f,s)
         d[str(diff(f,s))]= 69

William

>
> ----------------------------------------------------------------------
> | Sage Version 4.2.1, Release Date: 2009-11-14                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: X= var('x,y,z')
> sage: f= function('f',*X); f
> f(x, y, z)
> sage: d= {}
> sage: for l in [1..2]:
> ....:     for s in UnorderedTuples(X,l):
> ....:         print diff(f,s)
> ....:         d[diff(f,s)]= 69
> ....:
> D[0](f)(x, y, z)
> D[1](f)(x, y, z)
> D[2](f)(x, y, z)
> D[0, 0](f)(x, y, z)
> ---------------------------------------------------------------------------
> NotImplementedError                       Traceback (most recent call
> last)
>
> /Users/arai021/<ipython console> in <module>()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression.so in sage.symbolic.expression.Expression.__nonzero__ (sage/
> symbolic/expression.cpp:7801)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression.so in sage.symbolic.expression.Expression.test_relation
> (sage/symbolic/expression.cpp:9177)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/rings/
> complex_interval_field.py in __call__(self, x, im)
>    286
>    287             try:
> --> 288                 return x._complex_mpfi_( self )
>    289             except AttributeError:
>    290                 pass
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression.so in sage.symbolic.expression.Expression._complex_mpfi_
> (sage/symbolic/expression.cpp:5364)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.py in __call__(self, ex)
>    212                 div = self.get_fake_div(ex)
>    213                 return self.arithmetic(div, div.operator())
> --> 214             return self.arithmetic(ex, operator)
>    215         elif operator in relation_operators:
>    216             return self.relation(ex, operator)
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.py in arithmetic(self, ex, operator)
>   1437             return base ** expt
>   1438         else:
> -> 1439             return reduce(operator, map(self, operands))
>   1440
>   1441     def composition(self, ex, operator):
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.py in __call__(self, ex)
>    212                 div = self.get_fake_div(ex)
>    213                 return self.arithmetic(div, div.operator())
> --> 214             return self.arithmetic(ex, operator)
>    215         elif operator in relation_operators:
>    216             return self.relation(ex, operator)
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.py in arithmetic(self, ex, operator)
>   1437             return base ** expt
>   1438         else:
> -> 1439             return reduce(operator, map(self, operands))
>   1440
>   1441     def composition(self, ex, operator):
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.py in __call__(self, ex)
>    216             return self.relation(ex, operator)
>    217         elif isinstance(operator, FDerivativeOperator):
> --> 218             return self.derivative(ex, operator)
>    219         else:
>    220             return self.composition(ex, operator)
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.py in derivative(self, ex, operator)
>    344             NotImplementedError: derivative
>    345         """
> --> 346         raise NotImplementedError, "derivative"
>    347
>    348     def arithmetic(self, ex, operator):
>
> NotImplementedError: derivative
> sage:
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support-unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

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

Reply via email to