Vinzent Steinberg wrote:
> On Jun 25, 8:33 am, Toon Verstraelen <toon.verstrae...@ugent.be>
> wrote:
>> In [15]: ccode(integrate(sin(x)/x,x))
>> Out[15]: Integral(sin(x)/x, x)
>>
>> This should always raise an exception. Such a thing is never ever going
>> to be compilable.
> 
> We could use a library (maybe sepcified by the user) that can evaluate
> Integrals numerically.

Thanks for all the helpful comments. The numerical integration is a bit 
troublesome, and probably something we can not fix at the ccode level. C does 
not support lambda functions or functions defined inside other functions. In 
this case sin(x)/x should have been defined elsewhere as a separate function. 
Then the numerical integration routine can take a pointer to that function as a 
first argument. (It's a C problem and can be done in other languages like 
Python.)
I'm afraid that the current ccode/codegen design does not allow this kind of 
features for some languages, and a more holistic approach  would be necessary. 
(where ccode and codegen are merged in one module, somthing like the work of 
Marc Dewing). I also think it is a bit beyond my current intentions with 
codegen. The original idea was to let it implement lenghtly formula's that no 
one wants to code by hand.
I would suggest to raise a NotImplementedError, until we find an appropriate 
solution.

cheers,

Toon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

begin:vcard
fn:Toon Verstraelen
n:Verstraelen;Toon
org:Ghent University;Center for Molecular Modeling
adr:;;Proeftuinstraat 86;Ghent;;9000;Belgium
email;internet:toon.verstrae...@ugent.be
title:ir.
tel;work:+32 (0) 9 264 65 56
tel;home:+32 (0) 9 351 56 05
x-mozilla-html:FALSE
url:http://molmod.ugent.be
version:2.1
end:vcard

Reply via email to