Ticket #9706: trac_9706_chebyshev_U-1.patch

File trac_9706_chebyshev_U-1.patch, 1.5 KB (added by maldun, 8 years ago)

fixed bugs with chebyshev_U(-1,...)

  • sage/functions/orthogonal_polys.py

    # HG changeset patch
    # User Stefan Reiterer <domors@gmx.net>
    # Date 1386542385 -3600
    # Node ID 65b2ade30163c20c0b409c7852de975af56dc8fe
    # Parent  738e19cfa1802702b6f6e8c501efacd9022eb631
    trac 9706: fixed U_{-1} bug + docstring
    
    diff --git a/sage/functions/orthogonal_polys.py b/sage/functions/orthogonal_polys.py
    a b  
    677677            ValueError: No compatible type!
    678678
    679679        """
    680         if args[0] in ZZ:
     680        if args[0] in ZZ and args[0] >= 0:
    681681            return self._cheb_recur_(*args)[0]
    682682       
    683683        try:
     
    964964            ...
    965965            ValueError: No compatible type!
    966966        """
    967         if args[0] in ZZ:
     967        if args[0] in ZZ and args[0] >= 0:
    968968            return self._cheb_recur_(*args)[0]
    969969        try:
    970970            real_parent = kwds['parent']
     
    10221022            Traceback (most recent call last):
    10231023            ...
    10241024            ValueError: No special values for non integral indices!
     1025            sage: chebyshev_U(-1,Mod(5,8))
     1026            0
     1027            sage: parent(chebyshev_U(-1,Mod(5,8)))
     1028            Ring of integers modulo 8
    10251029        """
    10261030        if (not is_Expression(args[0])) and (not args[0] in ZZ):
    10271031            raise ValueError("No special values for non integral indices!")
    1028  
     1032
     1033        if args[0] == -1:
     1034          return args[-1]*0
     1035           
    10291036        if args[-1] == 1:
    10301037            return args[-1]*(args[0]+1)
    10311038