#8321: numerical integration with arbitrary precision
-------------------------+--------------------------------------------------
   Reporter:  burcin     |          Owner:                      
       Type:  defect     |         Status:  needs_work          
   Priority:  major      |      Milestone:  sage-4.7.2          
  Component:  symbolics  |       Keywords:  numerics,integration
Work_issues:             |       Upstream:  N/A                 
   Reviewer:             |         Author:  Stefan Reiterer     
     Merged:             |   Dependencies:                      
-------------------------+--------------------------------------------------

Comment(by benjaminfjones):

 I've run some more comparisons which include Burcin's relative error for
 mpmath's quad. Here are some results  for 6 test functions. The code that
 runs the tests is here:  https://gist.github.com/1166436

 In the output below:
  - GSL means we call `numerical_integral`
  - mpmath means we call `mpmath.call(mpmath.quad, mp_f, [a, b])` for an
 appropriate function `mp_f`
  - mpmath_rel means we call `mpmath.call(mpmath.quad, mp_f, [a, b],
 method=GaussLegendreRel)`

 All of the times are listed in seconds.

 {{{

 function: e^(-x^2)*log(x)  on  [17, 42]
 GSL:                      2.5657285007e-127                    time:
 0.001216173172
 mpmath:                   2.59225286296247e-127                time:
 0.0308299064636
 mpmath_rel (prec=64):     2.56572850056105156e-127             time:
 0.7594602108
 mpmath_rel (prec=100):    2.5657285005610514829173563974e-127  time:
 0.894016981125

 function: sqrt(-x^2 + 1)  on  [0, 1]
 GSL:                      0.785398167726                       time:
 0.000615119934082
 mpmath:                   0.785398163397448                    time:
 0.011482000351
 mpmath_rel (prec=64):     0.785398183809260289                 time:
 0.50303196907
 mpmath_rel (prec=100):    0.78539818380926028913861331848      time:
 0.57284116745

 function: sin(sin(x))  on  [0, 1]
 GSL:                      0.430606103121                       time:
 0.00026798248291
 mpmath:                   0.430606103120691                    time:
 0.0110800266266
 mpmath_rel (prec=64):     0.430606103120690605                 time:
 0.00665020942688
 mpmath_rel (prec=100):    0.43060610312069060491237735525      time:
 0.0202469825745

 function: max(sin(x), cos(x))  on  [0, pi]
 GSL:                      2.41421356237                        time:
 0.012158870697
 mpmath:                   2.41413598800040                     time:
 0.102693796158
 mpmath_rel (prec=64):     2.41424024561759656                  time:
 0.514449834824
 mpmath_rel (prec=100):    2.4142402456175965601829446506       time:
 0.583966970444

 function: e^cos(x)*sin(x)  on  [0, pi]
 GSL:                      2.35040238729                        time:
 0.000401973724365
 mpmath:                   2.35040238728760                     time:
 0.103391170502
 mpmath_rel (prec=64):     2.35040238728760291                  time:
 0.0510699748993
 mpmath_rel (prec=100):    2.3504023872876029137647637012       time:
 0.132436037064

 function: e^(-x^100)  on  [0, 1.1]
 GSL:                      0.994325851192                       time:
 0.000550031661987
 mpmath:                   0.994325851192472                    time:
 0.390738010406
 mpmath_rel (prec=64):     0.994325851192555258                 time:
 0.75753903389
 mpmath_rel (prec=100):    0.99432585119255525754634686152      time:
 0.875532865524
 }}}

 It looks like mpmath is now just as accurate as GSL but the times are
 obviously a lot longer. I agree with @kcrisman 's suggestion for calling
 GSL when the precision is default (float or RDF or 53 bits?) and calling
 mpmath with relative errors when the precision is higher. Perhaps adding
 the mpmath relative errors should be on a different ticket which this one
 will depend on?

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