#9706: New Version of orthogonal Polynomials
-------------------------------+--------------------------------------------
   Reporter:  maldun           |       Owner:  burcin                           
       Type:  defect           |      Status:  new                              
   Priority:  minor            |   Milestone:                                   
  Component:  symbolics        |    Keywords:  orthogonal polynomials, symbolics
     Author:  Stefan Reiterer  |    Upstream:  N/A                              
   Reviewer:                   |      Merged:                                   
Work_issues:                   |  
-------------------------------+--------------------------------------------

Comment(by maldun):

 I added in the latest patch (and orthogonal_polys.4.py contains these
 changes also) a new symbolic evaluation method for the orthogonal
 polynomials: Instead of call Maxima or use of the recursion, the
 polynomial is evaluated just using explicit formulas from Abramowitz and
 Stegun. This is an O(n) algorithm of course.

 a little comparison on my machine:
 old version:

 sage: time chebyshev_T(10,x);
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.04 s
 sage: time chebyshev_T(100,x);
 CPU times: user 0.13 s, sys: 0.01 s, total: 0.14 s
 Wall time: 0.23 s
 sage: time chebyshev_T(1000,x);
 CPU times: user 5.01 s, sys: 0.01 s, total: 5.02 s
 Wall time: 6.98 s
 sage time chebyshev_T(5000,x);
 ??? (I got no output her after 2min)

 sage: time gegenbauer(10,5,x);
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.05 s
 sage: time gegenbauer(100,5,x);
 CPU times: user 0.19 s, sys: 0.00 s, total: 0.19 s
 Wall time: 0.29 s
 sage: time gegenbauer(1000,5,x);
 CPU times: user 5.46 s, sys: 0.02 s, total: 5.48 s
 Wall time: 7.79 s


 New Version
 sage: time chebyshev_T(10,x);
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.01 s
 sage: time chebyshev_T(100,x);
 CPU times: user 0.06 s, sys: 0.00 s, total: 0.06 s
 Wall time: 0.08 s
 sage: time chebyshev_T(1000,x);
 CPU times: user 1.22 s, sys: 0.00 s, total: 1.22 s
 Wall time: 1.22 s
 sage: time chebyshev_T(5000,x);
 CPU times: user 27.17 s, sys: 0.15 s, total: 27.32 s
 Wall time: 27.46 s

 sage: time gegenbauer(10,5,x);
 CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
 Wall time: 0.01 s
 sage: time gegenbauer(100,5,x);
 CPU times: user 0.03 s, sys: 0.00 s, total: 0.03 s
 Wall time: 0.04 s
 sage: time gegenbauer(1000,5,x);
 CPU times: user 1.08 s, sys: 0.01 s, total: 1.09 s
 Wall time: 1.11 s


 A little bit faster :) I also don't need to spawn an instance of maxima
 which makes the initialisation faster.

 And now also wider symbolic evaluation is possible:

 old version:
 sage: var('a')
 a
 sage: gegenbauer(3,a,x)
 ...
 NameError: name 'a' is not defined

 new version:
 sage: var('a')
 a
 sage: gegenbauer(3,a,x)
 4/3*x^3*gamma(a + 3) - 2*x*gamma(a + 2)

 The code needs now some cleanup, especially the documentations.
 The complete versions for legendre_Q, gen_legendre_P, and gen_legendre_Q
 will not be finished
 soon since the mpmath functions, don't seem to work correctly...
 I only provide a call function for maxima for them now.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9706#comment:4>
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