MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Integrate[Abs[Cos[u]], u] for u real

  • To: mathgroup at
  • Subject: [mg73753] Integrate[Abs[Cos[u]], u] for u real
  • From: "David W. Cantrell" <DWCantrell at>
  • Date: Tue, 27 Feb 2007 05:52:05 -0500 (EST)
  • References: <errl49$80t$> <erugbv$8o$>

In a thread with the informative title "Fw: Re: Fw: 2",
"dimitris" <dimmechan at> wrote:
> Hi Jerry.
> Someone could say this conversation is a little pointless since I
> don't have version 4.2.
> As I said I could find many occasions that 5.2 shows superior
> performance than 4.2. But as I understood is a matter of what
> applications someone is interested in.
> Anyway...
> I want you just to execute the following in your version 4.2:
> In[183]:=
> Integrate[Abs[Cos[u]], {u, 0, x*Pi}]
> Out[183]=
> Integrate[Abs[Cos[u]], {u, 0, Pi*x}]
> (*in version 4.0 you get the incorrect result Sqrt[Cos[Pi x]^2] Tan[Pi x];
> the correct symbolic result
> is Sqrt[Cos[Pi x]^2] Tan[Pi x] + 2 Floor[x + 1/2]  see here

I presume you meant for us to look specifically at Paul Cally's

Besides the fact that x was implicitly assumed to be real, it should be
noted that Cally's "correct" result is not fully correct, being
Indeterminate when x = (1/2 + an integer).

A result which is fully correct follows from the fact, not obtainable by
Mathematica AFAIK, that

for real u, Abs[Cos[u]] has a continuous antiderivative

Sin[u] (-1)^Floor[u/Pi + 1/2] + 2 Floor[u/Pi + 1/2].

Hence, the definite integral considered by Cally is correctly (and also
more simply)

Sin[Pi x] (-1)^Floor[x + 1/2] + 2 Floor[x + 1/2].

Perhaps a result equivalent to the above already appears at the Wolfram
Functions site, but I was unable to find it.

It's also interesting to see what the current version does if we try to
restrict x so that things should be easy:

Integrate[Abs[Cos[u]], {u, 0, Pi x}, Assumptions-> -1/2 <= x <= 1/2]

Piecewise[{{1, x == 1/2}, {Sin[Pi*x], -1/2 <= x < 0 || 0 < x < 1/2}}]

Strangely, Mathematica's answer is mute for x == 0 and it considers
x == 1/2 separately. The simple complete answer is merely Sin[Pi x].

David W. Cantrell

  • Prev by Date: Change multiplication operations into convolution operations (result & follow up question)
  • Next by Date: Re: conditional is giving wrong value
  • Previous by thread: Re: all the possible minors of a matrix
  • Next by thread: Questions ...