On 9/26/07, David Joyner <[EMAIL PROTECTED]> wrote: > I'm not sure if this is a bug or not but just in case, > here is the way diff is behaving for me. > > - David Joyner > > sage: version() > 'SAGE Version 2.8.5, Release Date: 2007-09-21' > sage: R1.<a> = PolynomialRing(QQ) > sage: R2.<x> = PowerSeriesRing(R1) > sage: y = a*x > sage: y.derivative() > a > sage: diff(y,x) > --------------------------------------------------------------------------- > <type 'exceptions.TypeError'> Traceback (most recent call last) > > /mnt/hd200/sagefiles/sage-2.8.3.rc3/<ipython console> in <module>()
One should slightly rewrite the derivative function for polynomials (and power series) to take an optional argument (the variable). If the innput variable is the same as the parent gen, then differentiate as before; otherwise attempt to call derivative on the coefficients -- if that works, good; if not, return 0. -- William > > /home/wdj/sagefiles/sage-2.8.3.rc3/local/lib/python2.5/site-packages/sage/calculus/functional.py > in derivative(f, *args, **kwds) > 45 """ > 46 try: > ---> 47 return f.derivative(*args, **kwds) > 48 except AttributeError: > 49 pass > > <type 'exceptions.TypeError'>: derivative() takes no arguments (1 given) > > > > -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---