Re: OT : Approximate / fast math libraries ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Globe Trotter wrote:
While we are at this, can someone please point me to some C code for
integrating a function numerically? Something that is good?

Numerical integration is a multifarious topic. There are quite
a few packages available. It is a provable fact that there
is no one approach which can do all integrations efficiently,
or even at all. IOW, for every algorithm, there exists a
(Riemann) integrable function for which the algorithm cannot
produce a reasonable accuracy in a reasonable amount of time.
Exactly what is meant by that requires too much to go into
here, just take my word that whatever it is you want to do,
there is no program which can do it for all functions.

I have done a fair amount of numerical integration, and some
of the most successful techniques I've used do not do numerical
integration at all, but rather are differential equation solvers.

In short, numerical integration is not a "put in the function,
turn the crank, and out pops a number". Trying to do that, without
a fair amount of analysis beforehand, is just about guaranteed
to result in disaster eventually. The integrand must be evaluated
for singularities near the path of integration IN THE COMPLEX
PLANE.

Most techniques presume

(1) the function is analytic along the path of integration
(2) no singularities are nearby in the complex plane
(3) the first several terms of the power series expansion
near the path of integration contain most of the information
(the coeficients decrease rapidly)
(4) some sort of mean value theorem can be applied along the
path
(5) the errors of truncation and roundoff can be estimated
via simple formulas

If any of these presumptions is violated, then the package
can misbehave very badly, and give no indication. Usually,
if any of the presumptions is violated, then (5) is one of
them, and the package may very likely give no indication that
a problem occurred.

When singularities are on or near the path of integration,
then often special formulas may be developed, and many have.

I've had reasonable success using Runge Kutta techniques for
doing numerical integration. However, all presumptions of the
method used must be understood, and verified, or you'll end
up wasting a lot of CPU time, and possibly using results very
badly in error without even knowing it.

IOW, if you don't understand the problem, you'll never get
a solution, no matter how fast and accurate your computer's
math hardware may be.

I'm sorry that no more general hints may be given, but it
really is the case that you have to understand what you
are doing, and use the appropriate technique. There isn't
a "good integration package" which anyone can recommend you
to use, without first understanding what your application
is, and doing analysis of the integrand.

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux