On Fri, Jun 26, 2009 at 5:02 AM, Vinzent Steinberg<vinzent.steinb...@googlemail.com> wrote: > > > On Jun 26, 8:35 am, Toon Verstraelen <toon.verstrae...@ugent.be> > wrote: >> 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. > > Surely, this would be a quite advanced feature, we should not yet care > about it. But it would be possible I think. (It would involve > determining the function to integrate and creating a generic C > function, depending on the interface.)
Yes, I agree with everything that Vinzent said. Ondrej --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---