Is the Nonelementary Integral of cos(x)/x^2 Positive or Negative?

  • Thread starter nawidgc
  • Start date
  • Tags
    Integral
In summary, the nonelementary integral of cos(x)/x^2 can be either positive or negative depending on the value of x. When x is positive, the integral is positive, and when x is negative, the integral is negative. This result is due to the oscillatory nature of the cosine function and the inverse square relationship with x. However, when integrating over a symmetric interval, the positive and negative contributions cancel out, resulting in a net integral of zero. Therefore, the sign of the nonelementary integral of cos(x)/x^2 is not constant and depends on the specific values and range of x.
  • #1
nawidgc
25
0
I have a function namely cos(x)/x^2 which I need to integrate in the
limits of x = -1 to x = +1.

If we plot the integrand (attched xls file, integrand plotted for different number of sampling points), you can see that the integrand is positive all the time inside the limits of integration. Also note that the integrand is singular in the given limit at x=0.

Now since this integral is not a simple one to handle, I resorted to
Mathematica for solving it. Strangely, Mathematica returns a value of
negative 2.97 for the integral (I only remember the first two digits
after decimal point). Question is, when the integrand is positive all
the time, how can the integral be negative. When I try some online
integration tools for this function, they return with message that
this integral is likely to be a nonelementary kind. I know funny
things do happen at the singularities but the answer from Mathematica
does not make sense to me. Does anyone have any comments on this?
Thanks for your help.

gcd.

PS. I tried to evaluate the integral with Trapezoid rule (see yellow box in attached xls file) and the answer returned does make sense.
 

Attachments

  • question1.xls
    40.5 KB · Views: 236
Physics news on Phys.org
  • #2
Hi !
the integral doesn't converge for x tending to 0.
The response of WolframAlpha is correct.
 

Attachments

  • Photo1.jpg
    Photo1.jpg
    16.3 KB · Views: 1,039
  • #3
I am surprised to see the message from WolframAlpha for with Mathematica I could get -2.97 as the answer.

In any case (divergent integral as you say or negative area under the curve as I found), my point is if you look at the curve of cos(x)/x^2, you can see a definite area under it. I don't understand why wouldn't this integral converge or return a positive value.
 
  • #4
nawidgc said:
I have a function namely cos(x)/x^2 which I need to integrate in the
limits of x = -1 to x = +1.

If we plot the integrand (attched xls file, integrand plotted for different number of sampling points), you can see that the integrand is positive all the time inside the limits of integration. Also note that the integrand is singular in the given limit at x=0.

Now since this integral is not a simple one to handle, I resorted to
Mathematica for solving it. Strangely, Mathematica returns a value of
negative 2.97 for the integral (I only remember the first two digits
after decimal point). Question is, when the integrand is positive all
the time, how can the integral be negative. When I try some online
integration tools for this function, they return with message that
this integral is likely to be a nonelementary kind. I know funny
things do happen at the singularities but the answer from Mathematica
does not make sense to me. Does anyone have any comments on this?
Thanks for your help.

gcd.

PS. I tried to evaluate the integral with Trapezoid rule (see yellow box in attached xls file) and the answer returned does make sense.

Hey nawidgc and welcome to the forums.

You can't just evaluate this integral the way you have because you have a singularity at x = 0. If you try and integrate it normally then you are going to get a nonsensical answer.

Basically the reason in a nutshell is that at x = 0 you'll get a vertical asymptote. If you don't understand go to Wolfram Alpha and graph your function.
 
  • #5
I don't know what is going on with Mathematica.

However, why would you expect to get a finite number out of this integral? Would you ever try to integrate .5/x^2 over this interval? I hope not. The integrand blows up at zero so you get an integral that does not converge.

Also, 0 is not a singular point of the function. The function is not defined at x=0. An example of a singular point would be something like x=0 for the function f(x) = |x|.

You have also made an error in you excel file. In the column labeled "x^2" you actually have 1/x^2 so then when you divide cosx by 1/x^2 in column D you are really getting cosx * x^2. I changed col D to B*C and the graph and the trapezoid integral changed to what it should be.
 
  • #6
nawidgc said:
I am surprised to see the message from WolframAlpha for with Mathematica I could get -2.97 as the answer.

In any case (divergent integral as you say or negative area under the curve as I found), my point is if you look at the curve of cos(x)/x^2, you can see a definite area under it. I don't understand why wouldn't this integral converge or return a positive value.

It will "converge" in your excel file (even if you correct it as I did), but this is just a reflection of the fact that you are not sampling the function at x=0, which is where the bad stuff happens. If you change the value in A12 to 0, then the trapezoidal estimation blows up, as it should.
 
  • #7
Robert1986 said:
Also, 0 is not a singular point of the function. The function is not defined at x=0. An example of a singular point would be something like x=0 for the function f(x) = |x|.

I didn't say singular, I said singularity. I'll quote what I said:

You can't just evaluate this integral the way you have because you have a singularity at x = 0. If you try and integrate it normally then you are going to get a nonsensical answer.

http://en.wikipedia.org/wiki/Mathematical_singularity
 
  • #8
Thanks Robert! Yes, I did make a blunder and my sincere apologies for the confusion.
And yes, the integral does not converge if you do sample at x=0.

But if I am interested only in the area under the curve (assuming that the integral converges if you skip x=0 sample), should it matter whether I sample at x=0 or not?
 
  • #9
nawidgc said:
Thanks Robert! Yes, I did make a blunder and my sincere apologies for the confusion.
And yes, the integral does not converge if you do sample at x=0.

But if I am interested only in the area under the curve (assuming that the integral converges if you skip x=0 sample), should it matter whether I sample at x=0 or not?

It would help us if you gave us some context for your question.

If it is for example related to a physical problem of some sort, then it would to tell us what variables and quantities (like velocity, displacement, etc) are involved and the context in which they are involved.
 
  • #10
  • #11
Robert1986 said:
WHOA! I wasn't even referring to your post. I was referring to the OP, though I'm not sure he said "singular" either.

Sorry, my mistake! :) [But you got to admit, it was a big coincidence!]
 
  • #12
Thanks Chiro for your comments.

Let me at the outset admit that the function cos(x)/x^2 does not arise from a physical problem. I have chosen it to verify a different numerical method to integrate a function arising out of physical problem.

I am trying to solve a Boundary Integral Equation (BIE) for acoustic scattering in 2D. The function that needs to be integrated in the BIE is hypersingular (of the 1/x^2 form where x is the distance between two points). One of my function from the BIE looks like
(n_1 \cdot n_2)/x^2 where n_1 and n_2 are the normals at the two points. At singularity when the two points are one and the same, the dot product of these two normals equals 1. So my function (n_1 \cdot n_2)/x^2 looks essentially the same as cos(x)/x^2 at singularity (at x=0, cos(0)=1 and n_1 \cdot n_q =1). I therefore thought I should try simpler (:uhh:) function like cos(x)/x^2 in Mathematica.

gcd.
 
  • #13
chiro said:
Sorry, my mistake! :) [But you got to admit, it was a big coincidence!]

Yes, it was, especially when I actually did misquote the OP. So, I guess I deserved to get called out on that by someone. :)
 
  • #14
nawidgc said:
Thanks Chiro for your comments.

Let me at the outset admit that the function cos(x)/x^2 does not arise from a physical problem. I have chosen it to verify a different numerical method to integrate a function arising out of physical problem.

I am trying to solve a Boundary Integral Equation (BIE) for acoustic scattering in 2D. The function that needs to be integrated in the BIE is hypersingular (of the 1/x^2 form where x is the distance between two points). One of my function from the BIE looks like
(n_1 \cdot n_2)/x^2 where n_1 and n_2 are the normals at the two points. At singularity when the two points are one and the same, the dot product of these two normals equals 1. So my function (n_1 \cdot n_2)/x^2 looks essentially the same as cos(x)/x^2 at singularity (at x=0, cos(0)=1 and n_1 \cdot n_q =1). I therefore thought I should try simpler (:uhh:) function like cos(x)/x^2 in Mathematica.

gcd.

I'm just wondering if you could 'censor' some area of distance to give a zero contribution, kind of like how it's done in ElectroMagnetism. For example in a faraday cage the field inside the 'cage' is zero (or something like that) but outside it's according to the formula.

The interpretation of this is that you basically make your function you are trying to integrate equal to zero in some small region [-e,e] where e is a small number and outside of that the function is still the same.

You would have to think about the effect this would have on your answer, but I imagine that at some point the effect would end up changing once you got within e units of the element itself.

Alternatively you could substitute the zero function in [-e,e] with some other custom function that doesn't diverge like say a Gaussian function or something else.

This way you split the integration into two parts [-e,e] and the rest of the real line your function is defined on and this way you get a result that doesn't blow up and also something that is more representative of your actual system.

Personally I'd imagine that once you get so close in terms of distance that the behaviour of the function actually changes, maybe even like the faraday example listed above [just a thought!].
 
  • #15
nawidgc said:
my point is if you look at the curve of cos(x)/x^2, you can see a definite area under it.

Big mistake ! This is not true in case of x close to 0.
The "area unter it" becomes very big, even for very small distance between two values of x.
Examples :
 

Attachments

  • Integrals.JPG
    Integrals.JPG
    7.6 KB · Views: 441
  • #16
The integral "clearly" diverges, as previously stated. you should really have made a better drawning.

h2pUr.png


Oh, and perhaps you actually meant

[tex] \int_{-\infty}^{\infty} \frac{1 - \cos x}{x^2} \, \mathrm{d}x[/tex] ?
A clever transformation, turns this integral into

[tex] \int_{-\infty}^{\infty} \frac{\sin x}{x} \, \mathrm{d}x[/tex]

Which can easilly be evaluated
 
  • #17
Nebuchadnezza said:
[tex] \int_{-\infty}^{\infty} \frac{\sin x}{x} \, \mathrm{d}x[/tex]

Which can easilly be evaluated

Easily be evaluated?? I don't think it is a very elementary integral...
 

What is a nonelementary integral?

A nonelementary integral is an integral that cannot be expressed in terms of elementary functions. Elementary functions include basic operations such as addition, subtraction, multiplication, division, exponentiation, and logarithms.

Why are nonelementary integrals important?

Nonelementary integrals are important because they arise in many mathematical and scientific problems that cannot be solved using elementary functions. They also have applications in fields such as physics, engineering, and economics.

How are nonelementary integrals evaluated?

Nonelementary integrals can be evaluated using various techniques such as substitution, integration by parts, and trigonometric substitution. However, there are many nonelementary integrals that cannot be evaluated analytically and require numerical methods for approximation.

What are some examples of nonelementary integrals?

Some examples of nonelementary integrals include the Gaussian integral, the Fresnel integral, and the error function. These integrals arise in various areas of mathematics and science, such as probability, optics, and statistics.

Can nonelementary integrals be solved using software?

Yes, nonelementary integrals can be solved using software such as Mathematica, Maple, or MATLAB. These software programs use algorithms to evaluate integrals numerically and can handle a wide range of functions and expressions. However, it is still important to understand the principles behind nonelementary integrals and their applications.

Similar threads

Replies
8
Views
161
Replies
4
Views
1K
  • Calculus
Replies
8
Views
2K
Replies
3
Views
1K
Replies
4
Views
1K
  • Calculus
Replies
5
Views
1K
Replies
3
Views
1K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
5
Views
2K
Back
Top