1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Challenge 4: There's no app for that: integration

  1. Oct 18, 2013 #1

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    a.) Poor Wolfram Alpha got asked to calculate the following integral
    [tex] \int_{0}^{\infty} e^{-ax} \frac{\sin(x)}{x} dx [/tex]
    but couldn't handle it!

    http://www.wolframalpha.com/input/?i=int_{0}^{infty}+e^{-ax}+sin(x)+/xdx

    (Results are not guaranteed if you use wolfram alpha pro to spend more time calculating as I don't have that).

    Prove that you're smarter than a computer and solve this integral for all a > 0.

    b.) For reasons unknown, Wolfram Alpha can solve this exactly if a is an integer, but it won't tell the steps for how it solved it. As a side challenge, instead calculate the integral in a way that only works if a is an arbitrary positive or non-negative (your choice) integer.

    Feel free to answer either a, b or a and b.
     
  2. jcsd
  3. Oct 18, 2013 #2

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Lie! :p.
    If you enter a decimal number, the result is always a decimal number. If you enter an exact non-negative number (does not matter if integer or not, try 4/7 or pi or whatever), you get an exact result. A variable works as well, if you make sure it is positive.

    a=0 leads to the sine integral and the result is pi/2.
     
  4. Oct 18, 2013 #3

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Well I figure if it can this it should be able to figure out the one in the challenge. At any rate it's a nice integral that admits a bunch of neat tricks to solving it so have at it!


    I see now that perhaps part b was from my misunderstanding of how wolfram alpha operates - I tested it with things like a=2.1 and a=3.2 to see if it would calculate those and it just gave a decimal, but now I'm guessing that's just a quirk in how wolfram alpha interprets the output form that I want?
     
    Last edited: Oct 18, 2013
  5. Oct 18, 2013 #4
    How about if we start by letting:

    [tex]I(a)=\int_0^{\infty} e^{-ax} \frac{\sin(x)}{x}dx,\quad I(0)=\pi/2[/tex]

    And it would be nice if we could compute [itex]\frac{dI}{da}[/itex] as that would rid the denominator of [itex]x[/itex]. Not sure if that integrand satisfies Leibniz's criteria for differentiating under the integral sign though.
     
  6. Oct 18, 2013 #5
    We have that [tex]\int_{0}^{∞}e^{-ax}\frac{\sin(x)}{x}dx = \lim_{t→∞}\int_{0}^{t}e^{-ax}\frac{\sin(x)}{x}dx = \lim_{t→∞} I(a, t)[/tex]

    According to http://en.wikipedia.org/wiki/Differentiation_under_the_integral_sign, Leibniz's theorem is true if both [itex]e^{-ax}\frac{\sin(x)}{x} [/itex] and [itex]-e^{-ax}\sin(x) [/itex] are continuous on the region [itex]0 ≤ x ≤ t, 0 ≤ a < ∞[/itex]

    This is true (obvious for any nonzero x). The only trouble is when x is zero.
    Define [itex]ψ(a,x) = e^{-ax}\frac{\sin(x)}{x}, x ≠ 0[/itex] and [itex] ψ( a, 0 ) = 1 [/itex]
    Then [itex]ψ(a,x)[/itex] is equal to the integrand except perhaps at x = 0, but one point does not affect the value of the integral [itex] I(a,t) = \int_{0}^{t}e^{-ax}\frac{\sin(x)}{x}dx = \int_{0}^{t}ψ(a,x)dx[/itex]
    But since [itex]\lim_{x→0}\frac{\sin(x)}{x} = 1[/itex], the limit and the value [itex]ψ(a,0)[/itex] coincide so [itex]ψ[/itex] is indeed continuous on the region of interest.

    Now applying Leibniz's rule, we get:
    [tex]\frac{∂}{∂a}I(a,t) = \int_{0}^{t}-e^{-ax}\sin(x)dx = e^{-at}\left( \frac{a}{a^2+1}\sin(t) + \frac{1}{a^2+1}\cos(t) \right) - \frac{1}{a^2+1}[/tex]

    This is bounded above by [itex]e^{-at} - \frac{1}{a^2+1}[/itex] and below by [itex]-e^{-at}-\frac{1}{a^2+1}[/itex]
    Therefore, the sequence of derivatives [itex]\frac{∂}{∂a} I(a,t), t → ∞[/itex] converges uniformly to [itex]-\frac{1}{a^2+1}[/itex]. Moreover, the sequence [itex]I(a,t), t→∞[/itex] converges (pointwise) to [itex]I(a) = \int_{0}^{∞}e^{-ax}\frac{\sin(x)}{x}dx[/itex] (by definition). Moreover, the functions are continuous and therefore integrable. I think these conditions are sufficient to ensure that the derivatives [itex]\frac{∂}{∂a} I(a,t), t → ∞[/itex] converge to [itex]\frac{d}{da}I(a)[/itex]. Therefore, [itex]I'(a) = -\frac{1}{a^2+1}[/itex] and so:

    [itex]I(a) = I(0) - \arctan(a)[/itex] where [itex]I(0) = \int_{0}^{∞}\frac{\sin(x)}{x}dx = \frac{\pi}{2} [/itex] is the Dirichlet integral.

    [itex]\int_{0}^{∞}e^{-ax}\frac{\sin(x)}{x}dx = \frac{\pi}{2} - \arctan(a)[/itex].


    I hope I have not overlooked something!

    EDIT:
    I realized that uniform convergence holds only on [itex]0 < a < ∞[/itex] so the equation [itex]I'(a) = -\frac{1}{a^2+1} [/itex] is guaranteed only for [itex] a > 0 [/itex]. I think this can be patched by showing that [itex]I(a)[/itex] is continuous at 0.
     
    Last edited: Oct 18, 2013
  7. Oct 18, 2013 #6

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Edit: Oh, has been solved 4 minutes before my post. I'll leave it here, maybe someone spots where I got wrong.


    I tried a different approach, but I guess I have some sign/substitution errors somewhere.

    First, let the lower integration border be ##\epsilon>0## and interpret the integral as limit of ##\epsilon \to 0## later.

    Then
    $$\int_{\epsilon}^{\infty} e^{-ax} \frac{\sin(x)}{x} dx
    = \frac{1}{2i} \int_{\epsilon}^{\infty} e^{-ax} \frac{e^{ix}-e^{-ix}}{x} dx
    = \frac{1}{2i} \left( \int_{\epsilon}^{\infty} \frac{1}{x}e^{-ax+ix} dx\; +\; \int_{\epsilon}^{\infty} \frac{1}{x}e^{-ax-ix} dx \right)$$

    Consider the first integral:
    $$\int_{\epsilon}^{\infty} \frac{1}{x}e^{-ax+ix} dx$$
    This can be seen as integral in the complex numbers. The integrand has a pole at x=0 and nowhere else.

    attachment.php?attachmentid=63089&stc=1&d=1382140283.png

    Define:
    ##\displaystyle \theta=arctan(1/a)## (this is nice!) and ##A=|a+i|=\sqrt{a^2+1}##

    We can use the upper red loop in the sketch to evaluate it. As the size of the loop goes to infinity, the contribution from the large curved section goes to zero (due to e-ax).

    Let ##x=\frac{a+i}{A}r##. Then we can write the contribution from the inclined section as real integral:
    $$\int_\epsilon^{\infty} \frac{A}{(a+i)r}e^{-Ar} dr = \frac{A}{a+i} \int_{\epsilon A}^{\infty} \frac{e^{-r}}{r} dr$$
    We cannot take the limit ##\epsilon \to 0## at this point, and we cannot evaluate it either, so we just leave it. We have to count this negatively in the loop.

    What about the small curved section? This is the classic integral over f(z)/z, the result is ##\theta f(0)## plus some expression that will vanish in the limit ##\epsilon \to 0## afterwards. Here, f(0)=e0=1, so the result is just ##\theta##. Again, we have to count this negatively.


    Consider the second integral:
    $$\int_{\epsilon}^{\infty} \frac{1}{x}e^{-ax-ix} dx$$
    Follow the same procedure, just with ##x=\frac{a-i}{A}r##. The integral becomes
    $$\int_\epsilon^{\infty} \frac{A}{(a-i)r}e^{-Ar} dr = \frac{A}{(a-i)} \int_{\epsilon A}^{\infty} \frac{e^{-r}}{r} dr$$
    The small curved section gives ##\theta## again, this time with a positive sign, so the contributions cancel.

    Our total integral is now 1/(2i) times the sum of the two real integrals obtained above:

    $$ \frac{1}{2i} A \frac{(a-1)+(a+1)}{A^2} \int_{\epsilon A}^{\infty} \frac{e^{-r}}{r} dr
    = -i \frac{a}{A} \int_{\epsilon A}^{\infty} \frac{e^{-r}}{r} dr$$
    And here the problem is visible. This integral does not converge for ##\epsilon \to 0## (and the result is purely imaginary, literally and figuratively.).
     

    Attached Files:

  8. Oct 19, 2013 #7
    Yeah, that's what I need Boorglar: rigor to justify taking the derivative that way. Thanks.

    Also mfb, spotted some mistakes:

    (1) The first integral expression should be:

    $$\int_{\epsilon}^{\infty} e^{-ax} \frac{\sin(x)}{x} dx
    = \frac{1}{2i} \int_{\epsilon}^{\infty} e^{-ax} \frac{e^{ix}-e^{-ix}}{x} dx
    = \frac{1}{2i} \left( \int_{\epsilon}^{\infty} \frac{1}{x}e^{-ax+ix} dx\; -\; \int_{\epsilon}^{\infty} \frac{1}{x}e^{-ax-ix} dx \right)$$

    (2) An integral over an indentation around a simple pole at the origin for [itex]f(z)/z[/itex] (as radius goes to zero) is [itex]\theta i f(0)[/itex]. You forgot the i.

    Did it quick but looks like it ends up being:

    [tex]\frac{1}{2 i} \left(i\arctan(1/a)+\int_0^{\infty} f(r)dr+i\arctan(1/a)-\int_0^{\infty}f(r) dr\right)[/tex]

    which then gives us the requisite [itex]\arctan(1/a).[/itex]
     
    Last edited: Oct 19, 2013
  9. Oct 19, 2013 #8

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Oh, that sign was a stupid mistake.
    I forgot the i, but as the contributions canceled (due to the sign error, crap) I did not check that again.

    I'm not sure if the prefactors work out properly, if I just change the sign I don't get matching prefactors for the two integrals.
     
  10. Oct 19, 2013 #9
    Ok, just to check it, I'll just let [itex]z=re^{i\theta}[/itex] on the top path and [itex]z=re^{-i\theta}[/itex] on the bottom path with [itex]\theta=\arctan(1/a)[/itex]

    For the top, I get:

    [tex]\int_0^{\infty} \frac{e^{x(i-a)}}{x} dx=i\theta+\int_0^{\infty} \frac{e^{re^{i\theta}(i-a)}}{r}dr[/tex]

    and the bottom:

    [tex]\int_0^{\infty} \frac{e^{-x(i+a)}}{x} dx=-i\theta+\int_0^{\infty} \frac{e^{-re^{-i\theta}(i+a)}}{r}dr[/tex]

    so that when we add everything up, we get the factor

    [tex]\int_0^{\infty} \frac{e^{re^{i\theta}(i-a)}}{r}dr-\int_0^{\infty} \frac{e^{-re^{-i\theta}(i+a)}}{r}dr[/tex]

    and

    [tex]e^{r e^{i\theta(i-a)}}-e^{-r e^{-i\theta(a+i)}}=0[/tex]

    for [itex]\theta=\arctan(1/a)[/itex].
     
  11. Oct 19, 2013 #10

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Okay. Good to see that the "direct" approach is possible.
     
  12. Oct 19, 2013 #11
    I probably should have written that as:

    [tex]\frac{1}{2 i} \left(i\arctan(1/a)+\int_0^{\infty} f(r,\theta)dr+i\arctan(1/a)-\int_0^{\infty}g(r,\theta) dr\right)[/tex]

    and [itex]f(r,\theta)-g(r,\theta)=0[/itex] for [itex]\theta=\arctan(1/a)[/itex].
     
  13. Oct 19, 2013 #12

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Boorglar, that's a really nice proof that you can take the derivative through the integral. You don't actually need to know what the value at a=0 is separately, since it's easy to calculate that as a goes to infinity the integral goes to zero.
     
  14. Oct 24, 2013 #13

    jbunniii

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    If we put
    $$f(x) = \begin{cases}
    e^{-ax} & \text{ if }x \geq 0 \\
    0 & \text{ if }x < 0\end{cases}$$
    and ##g(x) = \sin(x)/x##, then we need to evaluate ##I = \int_{-\infty}^{\infty} f(x) g(x) dx##, which we may also write as
    $$I = \left.\int_{-\infty}^{\infty} f(x) g(x) e^{-iux} dx\right|_{u = 0}$$
    This is the Fourier transform of ##fg##, evaluated at ##u=0##. If we denote ##\hat{f} = \mathcal{F}f## and ##\hat{g} = \mathcal{F}g##, the Fourier transforms of ##f## and ##g##, respectively, then we have ##\widehat{fg} = \hat{f} * \hat{g}##, where ##*## denotes the convolution operation: ##(\hat{f} * \hat{g})(u) = \int_{-\infty}^{\infty} \hat{f}(v) \hat{g}(u-v) dv##.

    Our integral ##I## is equal to the convolution evaluated at ##u=0##: ##\int_{-\infty}^{\infty} \hat{f}(v) \hat{g}(-v) dv##. Let us evaluate ##\hat{f}## and ##\hat{g}##:

    $$\begin{align}
    \hat{f}(u) &= \int_{0}^{\infty} e^{-ax} e^{-iux} dx \\
    &= \int_{0}^{\infty} e^{-(a+iu)x} dx \\
    &= \frac{1}{a+iu} \\
    \end{align}$$
    It's also well known that ##\sin(x)/x## has a "rectangular" Fourier transform:
    $$\hat{g}(u) = \begin{cases}
    1 & \text{ if }|u| < 1/2 \\
    0 & \text{ if }|u| > 1/2 \\
    \end{cases}$$
    (I'm probably missing a ##2\pi## scale factor somewhere.) Putting the pieces together, our integral is equivalent to
    $$I = \int_{-1/2}^{1/2} \frac{1}{a + iu} du$$
    which Wolfram Alpha tells me works out to ##2 \cot^{-1}(2a)##, but I don't remember which "stupid calculus trick" is needed to show this. Note that ##\cot^{-1}(x) = \pi/2 - \tan^{-1}(x)##, so my answer is close to Boorglar's except I screwed up a scale factor somewhere.
     
  15. Oct 24, 2013 #14

    jbunniii

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Hmm, I guess I can do that last integral as follows:
    $$\begin{align}
    I = \int_{-1/2}^{1/2} \frac{1}{a + iu} du &= \int_{-1/2}^{1/2}\frac{a-iu}{a^2 + u^2} du \\
    &= \int_{-1/2}^{1/2} \frac{a}{a^2 + u^2} du \\
    \end{align}$$
    where the last equality holds because ##\int_{-1/2}^{1/2} \frac{u}{a^2 + u^2} du = 0## (the integrand is an odd function).
    This should be handled by a trig substitution: ##u = a \tan \theta##. But I'm too tired to crank through the details.
     
  16. Oct 24, 2013 #15

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    Cool mfb, I had a go at this problem for about 10 minutes earlier this week, and I got right up to your image but then got stuck / lost interest thinking about the additional contributions and running into the same problem with divergent integrals.
     
  17. Oct 24, 2013 #16

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    jbunniii, I'm suspicious that you never plug in a u=0 anywhere.... at the end that integral looks like the product of the fourier transforms, not their convolution (which is easily fixed of course). That's a really clever way of attacking the problem.
     
    Last edited: Oct 24, 2013
  18. Oct 24, 2013 #17

    jbunniii

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I do plug in ##u = 0##:
    $$\begin{align}
    I &= \left.\int_{-\infty}^{\infty} f(x) g(x) e^{-iux} dx\right|_{u = 0} \\
    &= \left.(\hat{f} * \hat{g})(u)\right|_{u=0}\\
    &= \left.\int_{-\infty}^{\infty} \hat{f}(v) \hat{g}(u-v) dv\right|_{u=0}\\
    &= \int_{-\infty}^{\infty} \hat{f}(v) \hat{g}(-v) dv \\
    &= \int_{-\infty}^{\infty} \hat{f}(v) \hat{g}(v) dv
    \end{align}$$
    where the last inequality follows because in our case ##\hat{g}## is an even function.
     
  19. Oct 24, 2013 #18

    jbunniii

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I'll try to fix the scale factors later today if I have time.
     
  20. Oct 24, 2013 #19

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I see, I missed the fact that they end up looking exactly the same.
     
  21. Oct 24, 2013 #20

    jbunniii

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    My scale factor woes are a result of the ##2\pi## factor that appears in the formula for the inverse Fourier transform:
    $$f(x) = \frac{1}{2\pi}\int_{-\infty}^{\infty}\hat{f}(u) e^{iux} du$$
    One consequence of this is that the Fourier transform of ##fg## is in fact ##\frac{1}{2\pi}(\hat{f}*\hat{g})##, not ##\hat{f}*\hat{g}##. It also means that my Fourier transform of ##\sin(x)/x## dx was wrong. In fact, it should be
    $$\hat{g}(u) = \begin{cases}
    \pi & \text{ if }|u| < 1 \\
    0 & \text{ if }|u| > 1 \\
    \end{cases}$$
    We verify this by calculating the inverse Fourier transform:
    $$\begin{align}
    g(x) &= \frac{1}{2\pi}\int_{-\infty}^{\infty}\hat{g}(u) e^{iux} du \\
    &= \frac{1}{2} \int_{-1}^{1} e^{iux} du \\
    &= \frac{1}{2 i x} \left.e^{iux}\right|_{-1}^{1} \\
    &= \frac{1}{2i x} (e^{ix} - e^{-ix}) \\
    &= \frac{1}{ x} \left( \frac{e^{ix} - e^{-ix}}{2i} \right) \\
    &= \frac{1}{ x} \sin(x) \\
    &= \frac{\sin(x)}{x} \\
    \end{align}$$
    My calculation of the Fourier transform of ##f## was OK.

    Now our integral is equal to the convolution (with the ##2\pi## scale factor) evaluated at ##u = 0##:
    $$I = \frac{1}{2\pi} \int_{-\infty}^{\infty} \hat{f}(v) \hat{g}(-v) dv$$
    Since ##\hat{g}## is even, this is equivalent to
    $$I = \frac{1}{2\pi} \int_{-\infty}^{\infty} \hat{f}(v) \hat{g}(v) dv$$
    Plugging in the results for ##\hat{f}## and ##\hat{g}##, we have
    $$\begin{align}
    I &= \frac{1}{2\pi} \int_{-1}^{1} \frac{1}{a+iu} (\pi) du \\
    &= \frac{1}{2} \int_{-1}^{1} \frac{1}{a+iu} du \\
    &= \frac{1}{2} \int_{-1}^{1} \frac{a - iu}{a^2 + u^2} du \\
    &= \frac{1}{2} \int_{-1}^{1} \frac{a}{a^2 + u^2} du
    \end{align}$$
    which Wolfram tells me is equal to ##\tan^{-1}(1/a)##.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Challenge 4: There's no app for that: integration
  1. A Euclidean Challenge (Replies: 10)

Loading...