Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Closed form integral of abs(cos(x))

  1. Jul 15, 2014 #1
    Hi everyone.

    Recently, I came across a closed form solution to ∫|cos(x)|dx as
    sin(x-∏*floor(x/∏+1/2)) + 2*floor(x/∏+1/2)

    I have no idea how to reach this solution but checking this for definite integral from 0 to 3∏/4 or ∏ seems to work. Using |cos(x)| as cos(x)*sgn(cos(x)) doesn't help in reaching at the solution. Does someone know how to get this closed form?

  2. jcsd
  3. Jul 16, 2014 #2

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    That is correct as a definite integral,
    \int_0^x \lvert \cos t \rvert \, dt =
    \sin\left(x - \pi \left\lfloor \frac x \pi + \frac 1 2\right\rfloor \right)
    + 2\left\lfloor \frac x \pi + \frac 1 2\right\rfloor

    As an indefinite integral it's better to write [itex]\int \lvert\cos x\rvert\,dx = \sin x \operatorname{sgn}(\cos x)+C[/itex]

    How to get that closed form? By being creative. You're not going to find any of the standard integration methods that will yield that nice closed form solution.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook