#13720: Scale legendre_P to [a,b]
------------------------------------+---------------------------------------
       Reporter:  mjo               |         Owner:  burcin    
           Type:  enhancement       |        Status:  needs_work
       Priority:  major             |     Milestone:  sage-5.6  
      Component:  symbolics         |    Resolution:            
       Keywords:                    |   Work issues:            
Report Upstream:  N/A               |     Reviewers:            
        Authors:  Michael Orlitzky  |     Merged in:            
   Dependencies:                    |      Stopgaps:            
------------------------------------+---------------------------------------
Changes (by fwclarke):

  * status:  needs_review => needs_work


Comment:

 * The code seems over-complicated to me.  Replacing the last few lines
 with
 {{{
     R = PolynomialRing(ZZ, 't')
     f = R([(-1)^(n - k)*binomial(n, k)*binomial(n + k, k) for k in range(n
 + 1)])
     return f((x - a)/(b - a))
 }}}
   is much simpler and is significantly faster.  Moreover, this makes
 expressions such as
 {{{
 legendre_P(4, Zmod(5), 3, 6)
 }}}
    evaluate correctly; at it stands the patch yields an
 {{{
 ArithmeticError: 0^0 is undefined.
 }}}

 * I don't see why `a` and `b` need to be real numbers.  Actually they
 could be polynomial variables, giving:
 {{{
 sage: R.<r,s,t> = QQ[]
 sage: legendre_P(2, t, r, s)
 6*((r - t)/(r - s) - 1)*(r - t)/(r - s) + 1
 }}}

 * I don't see the need to use `bool` in doctests such as
 {{{
 bool(legendre_P(0, x, 0, 1) == p0)
 }}}

 * It's not clear to me why back-quotes are used in some of the error
 strings:
 {{{
         raise TypeError('`n` must be a natural number')
 }}}
    but
 {{{
         raise ValueError('n must be nonnegative')
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13720#comment:2>
Sage <http://www.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.

Reply via email to