MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Built-in functions to C code

  • To: mathgroup at
  • Subject: [mg31579] Re: [mg31544] Built-in functions to C code
  • From: Daniel Lichtblau <danl at>
  • Date: Wed, 14 Nov 2001 03:41:57 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

"Toshiyuki (Toshi) Meshii" wrote:
> Hello,
> I have a program written in Mathematica.
> Since It takes long time in calculating NIntegrate, I was wondering whether
> I can translate my program to C-language.
> I know there is a command called CForm, but it does not translate NIntegrate
> to an detailed C code.
> Can someone help me on my problem?
> -Toshi

I am very curious to know what you think a C translation might do with
NIntegrage. I will point out that NIntegrate itself is implemented in C.

Your best possibilities are

(i) Experiment with different methods and other options that influence
NIntegrate. It may be that the default settings are far from optimal for
the particular quadratures you require. This is especially likely if,
say, the integrand has singularities of some sort in the domain of

(ii) Use standard commercial or free library code to do the quadrature.
For this I imagine you would need to use MathLink to go between this and
your Mathematica program.

(iii) Determine whether some symbolic preprocessing might be of help.
This is likely in cases where the indefinite integration (or part
thereof, if an iterated integral) can be done symbolically, and there
are no singularities so that Newton-Liebniz rule may then be applied.
Somethimes other sorts of symbolic preprocesing can also help simply by
making subsequent numeric evaluations of the integrand faster, or by
removing cancelling singularities in separate parts of the original

If typical NIntegrate calls are not too complicated you might want to
post one, say in Mathematica InputForm.

Daniel Lichtblau
Wolfram Research

  • Prev by Date: Re: Rendering Error in Raster and RasterArray
  • Next by Date: Re: [Novice] Automatic bracketing and Defaults Setup
  • Previous by thread: Built-in functions to C code
  • Next by thread: Re: Built-in functions to C code