DSPRelated.com
Forums
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →

Is there a good way to compute indefinite integral numerically? How does FFT compare to numerical integration?

Started by Mike ●May 18, 2007
widmar wrote:

(snip)

> Even so, there's a usual caveat - use at your own risk and *ymmv*, and > particularly so when dealing with infinite intervals. Case in point, > integrate sinc(t) from zero to inf with quadpack code for such matters,
> http://netlib.org/quadpack/qagi.f
> a globally adaptive quadrature integrator for infinite intervals. Since > the integral is known - pi/2 - it is less than comforting how poor the > result turns out to be.
I would think integrating sinc(t) is about as easy as summing a harmonic series. For Gaussian quadrature there are formulae that consider non-uniform weighting, including ones for infinite integrals. Maybe not for 1/x weighting, though. -- glen
Androcles wrote:
(snip)

> When a mathematician writes "pi" he means an exact quantity. > When a computer produces 3.1415926535897932384626433832795 > then that's as exact as I want it to be, but it's not pi.
Computers can do that, too. Many calculators can do a symbolic pi and use it in numerical calculations. Mathematica can also do that. I have also wondered about a floating point arithmetic format with a bit that indicates "multiply this value by pi". But yes, most don't do that. (snip of FFT discussion)
> : An indefinite integral doesn't have a numerical value.
> Correct.
> : That is what the +C indicates.
> Huh? > An indefinite integral is analytical; it has no > predefined limits and is expressed as a function. > A definite integral has a value, the limits are known. > Explain, please.
I meant pretty much what you said. The +C that all indefinite integrals have is a symbolic indication that only a symbolic value is meaningful. It seemed that the OP wanted a numeric value for one. Consider the integral of zero, which is zero for all definite integrals, but the indefinite integral still doesn't have a numeric value. -- glen
On May 18, 3:27 am, "Mike" <meathea...@gmail.com> wrote:
> Hi all, > > I want to take Foureir transform of f(t), which is F(v), > > and a continuous-time Foureir transform needs to integrate from -infinity to > +infinity. > > It's too complicated, and there is no closed-form solution. So I need to > compute the Foureir transform numerically... > > How to do that? I have some past experience with FFT but now I need to renew > my memory. > > Please give me some pointers about how to convert the infinite range > integration to finite sums in FFT? > > Moreover, the Foureir transform can also be computed by numerical > integration, what's the disadvantage and advantage of both approaches? > Before I begin the work, I would like to hear your expert opinions and > comments about these approaches. > > Thanks a lot!
Hello Mike, If you don't like the inteval being infinite, just do a transformation to make it over a finite interval. Can you tell what the integrand is? Then someone may give you some more help with your problem. Clay
On May 19, 11:22 am, "Androcles" <Engin...@hogwarts.physics> wrote:

> : An indefinite integral doesn't have a numerical value. > > Correct. > > : That is what the +C indicates. > > Huh? > An indefinite integral is analytical; it has no predefined limits > and is expressed as a function. > A definite integral has a value, the limits are known. > Explain, please.
I think the OP means "improper integral" Richard
Richard Brown wrote:

(snip)

> I think the OP means "improper integral"
Now that makes a lot more sense. There are Gaussian Quadrature solutions for integrals like f(x)exp(-x)dx from 0 to infinity. As usual for Gaussian Quadrature, exact for f(x) a polynomial of the appropriate degree. -- glen
"glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message 
news:4LadnYv2n-Io-8zbnZ2dnUVZ_oKnnZ2d@comcast.com...
> Richard Brown wrote: > > (snip) > >> I think the OP means "improper integral" > > Now that makes a lot more sense. > > There are Gaussian Quadrature solutions for integrals > like f(x)exp(-x)dx from 0 to infinity. As usual for > Gaussian Quadrature, exact for f(x) a polynomial of > the appropriate degree. > > -- glen >
What Matlab program to use? Thanks!
"Clay" <physics@bellsouth.net> wrote in message 
news:1179709874.908239.74380@y18g2000prd.googlegroups.com...
> On May 18, 3:27 am, "Mike" <meathea...@gmail.com> wrote: >> Hi all, >> >> I want to take Foureir transform of f(t), which is F(v), >> >> and a continuous-time Foureir transform needs to integrate from -infinity >> to >> +infinity. >> >> It's too complicated, and there is no closed-form solution. So I need to >> compute the Foureir transform numerically... >> >> How to do that? I have some past experience with FFT but now I need to >> renew >> my memory. >> >> Please give me some pointers about how to convert the infinite range >> integration to finite sums in FFT? >> >> Moreover, the Foureir transform can also be computed by numerical >> integration, what's the disadvantage and advantage of both approaches? >> Before I begin the work, I would like to hear your expert opinions and >> comments about these approaches. >> >> Thanks a lot! > > Hello Mike, > > If you don't like the inteval being infinite, just do a transformation > to make it over a finite interval. Can you tell what the integrand is? > Then someone may give you some more help with your problem. > > Clay >
It's a Foureir transform and inverse Foureir transform. So integrand involves the X(t)*exp(i*w*t), and the X(t) is complicated and has no closed-form, and it comes from the numerical solution of an ODE... so I am worried about the numerical errors from both ODEs and the numerical integrations and afraid that the numerical error got amplified... and as you can see, it probably has no room for transforming...


> It's a Foureir transform and inverse Foureir transform. So integrand > involves the X(t)*exp(i*w*t), and the X(t) is complicated and has no > closed-form, and it comes from the numerical solution of an ODE... so I am > worried about the numerical errors from both ODEs and the numerical > integrations and afraid that the numerical error got amplified... and as you > can see, it probably has no room for transforming...
Hi, My application also involves computing such Fourier integrals. Yesterday I looked into GNU GSL at http://www.gnu.org/software/gsl/. I was able to write a C program to compute I = \int_a^{+\infty} dx f(x) sin(omega x), where a and omega are finite numbers. You may want to look into it if you can reduce your problem into such semi-infinite interval of integration. After that it is only a question of incorporating it into a Matlab environment which should be possible using mex. marky
glen herrmannsfeldt wrote:
> > I would think integrating sinc(t) is about as easy as summing > a harmonic series.
It would seem so until you try it numerically, Si(x) = x - x^3/3*3! + x^5/5*5! - x^7/7*7! + ... for even moderately large x. In fact, even with rudimentary skills you'd know you're dead in a water before you even started. So, what's a trick with series that makes it easy? --- sdx - modeling, simulation. http://www.sdynamix.com
"widmar" <jrw@sdynamix.com> wrote in message 
news:46576CE0.630B4299@sdynamix.com...
: glen herrmannsfeldt wrote:
: >
: > I would think integrating sinc(t) is about as easy as summing
: > a harmonic series.
:
: It would seem so until you try it numerically,
:
: Si(x) = x - x^3/3*3! + x^5/5*5! - x^7/7*7! + ...
:
: for even moderately large x.

Correction:
sine(x)
or
sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ...+x^(2k-1)/(2k-1)!
for all x belonging to R.


This brings up an interesting point.
For x = 2pi,
sin(x) = ... (terms as above)... = 0

So...
Let y = x modulo 2pi.
sin(x) = y - y^3/3*3! + y^5/5*5! - y^7/7*7! + ...+y^(2k-1)/(2k-1)!


: In fact, even with rudimentary skills
: you'd know you're dead in a water before you even started. So, what's a
: trick with series that makes it easy?

Two tricks, actually.
1) 1/3! is a constant, 0.1667
2) You only need as many terms as the accuracy desired within
the limitations of the computer.

Disadvantage: rounding errors accumulate.
1.67 / 20 = 0.0835
0.16666666666666666666666666666667/20 =
0.0083333333333333333333333333333333



I would think integrating sin(t) is about as easy as summing
a harmonic series, too.