On Thu, Dec 4, 2008 at 7:25 PM, Jason Grout <[EMAIL PROTECTED]> wrote:
>
> William Stein wrote:
>> On Thu, Dec 4, 2008 at 7:11 PM, Tim Lahey <[EMAIL PROTECTED]> wrote:
>>> On Dec 4, 2008, at 10:05 PM, Jason Grout wrote:
>>>
>>>> Tim Lahey wrote:
>>>>>> Jason
>>>>> Is there an easy way to get the integrand, variable and bounds out of the
>>>>> integral? That way, if one has tried to analytically evaluate it, they
>>>>> can pull it out and try numerically evaluating it easily. In fact, it
>>>>> probably could be done automatically.
>>>>>
>>>> sage: a=integrate(250*cos(pi*x/180)^1.8 + 170.35 , x, 0, 18)
>>>> sage: a
>>>> integrate(250*cos(pi*x/180)^1.8 + 170.35, x, 0, 18)
>>>> sage: a.arguments()
>>>> (250*cos(pi*x/180)^1.8 + 170.35, x, 0, 18)
>>>>
>>> In that case, it should be simple to feed the integral to scipy. One
>>> could write a simple wrapper to numerically integrate integrals which
>>> can't be done analytically.
>>
>> It would be better to call the numerical_integral function
>> that is already in Sage, which Josh Kantor wrote, which
>> is pretty sophisticated.  It uses GSL and a C callback function.
>> Then improve the implementation of that function to also use
>> scipy.  To easy steps instead of one hard one.
>
> Should we phase GSL out of numerical_integral too?  Should we replace it
> with the equivalent scipy call (which would make it massively shorter
> and simpler)?

Yes, it is very tempting to do so.   One thing is that each function evaluation
could in theory be much faster with the GSL version, since GSL takes
as input a C-level callback function, whereas I think scipy's quadpack
wrapper doesn't.

Jason said:

> Both GSL and scipy call quadpack.

I'm not sure exactly what this means, since probably scipy's quadpack
is a fortran library, but GSL is definitely built 100% fortran free
(there's no fortran code in gsl and no fortran dependencies).   Maybe
GSL has a C port of quadpack, or some other sort of translation of the
code.  So I suspect GSL and scipy are calling into separate separate
code that is compiled using a different compiler, so there could be
differences in performance and capabilities.

 -- William

--~--~---------~--~----~------------~-------~--~----~
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://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to