MathGroup Archive 2007

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

Search the Archive

Re: Definite Integration in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74656] Re: Definite Integration in Mathematica
  • From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
  • Date: Fri, 30 Mar 2007 02:55:22 -0500 (EST)
  • References: <eufq77$7hj$1@smc.vnet.net>

"dimitris" <dimmechan at yahoo.com> wrote:
> Hi.
>
> I apologise for the delay.
>
> I will reply to your questions in this post; but I want the current
> post to serve as a sum up of this beautiful thread. So I apologise also
> for its considerable length and not anwering at once to your queries.

There is certainly no need to apologize.
Congratulations that you are to be a father!

Due to the length of your message, I've removed (snipped) a great deal
below, leaving only the material essentially related to my response.

> f[x_] :== 1/(2 + Cos[x])
>
> The indefinite integral by Mathematica
>
> F[x_] == Integrate[f[x], x]
> (2*ArcTan[Tan[x/2]/Sqrt[3]])/Sqrt[3]

> >From an old book about Mathematica (Mathematica for Scientists and
> Enginners by R. Gass we got (but without further explanation...)
>
> FF[x_] == (-2*3^(1/2)*ArcTan[Sin[x]/(Cos[x] + 1)])/3 +
> (2*3^(1/2)*ArcTan[(3^(1/2)*Sin[x])/(3*(Cos[x] + 1))])/3 +
> (3^(1/2)*x)/3

> as a continuous antiderivative in the real axis.
>
> I will be very glad if you could show me how exactly the author get
> previous antiderivative or what method in general would you follow
> in order to get a continuous antiderivative in the real axis.

Below, I'll show what I suspect that Gass did and also show what I
would then do in this problem.

> It is time to answer your first second question
>
> > Unfortunately, I don't have Trott's book. Since it's very easy to
> > obtain, could you also please show us the continuous
> > antiderivative for
> > 1/(5 + Cos[x]) obtained by Trott's method?
>
> As you see I chose another example (similar to Trott's) because I
> want to show also the continuous antiderivative by Gass' book.
>
> I don't know what you have understood but stating that
>
> > > But in case of recognizing the jump discontinuity and its position,
> > > it is very easy to obtain a continous antiderivative adding the
> > > piecewise constant (see the relevant example from Trott's book!)
>
> I really mean something like
>
> Fc[x_] :== Piecewise[{{F[x], Inequality[-4*Pi, LessEqual, x, Less,
> -3*Pi]}, {Pi/Sqrt[3], x ==== -3*Pi},
>     {F[x] + 2*(Pi/Sqrt[3]), -3*Pi < x < -Pi}, {4*(Pi/Sqrt[3]), x
> ==== -
> Pi}, {F[x] + 4*(Pi/Sqrt[3]), -Pi < x < Pi},
>     {6*(Pi/Sqrt[3]), x ==== Pi}, {F[x] + 6*(Pi/Sqrt[3]), Pi < x <
> 3*Pi},
> {8*(Pi/Sqrt[3]), x ==== 3*Pi},
>     {F[x] + 8*(Pi/Sqrt[3]), Inequality[3*Pi, Less, x, LessEqual,
> 4*Pi]}}]
>
> I hope you are not dissapointed!

To be honest, yes, that is disappointing because it is messy and, more
importantly, it is not an antiderivative valid over the _whole_ real
line.

--------------------------------------

For 1/(2 + Cos[x]), we wish to get an antiderivative which is valid on
R. As you showed (in some of what I snipped), the standard Weierstrass
substitution, u = Tan[x/2], leads to the same antiderivative as that
returned by Mathematica, (2*ArcTan[Tan[x/2]/Sqrt[3]])/Sqrt[3].

The only type of singularity occurs when x = (2n + 1)Pi, n integer. By
looking at the difference between limits from either side of, say, Pi,
we see that these discontinuities are caused by jumps of 2 Pi/Sqrt[3].
To remove those jumps, we may simply add 2 Pi/Sqrt[3] Floor[(x + Pi)/(2 Pi)]
to Mathematica's antiderivative. Let's call this result F1[x]:

(2 ArcTan[Tan[x/2]/Sqrt[3]] + 2 Pi Floor[(x + Pi)/(2 Pi)])/Sqrt[3]

Although F1[x] has no jumps, it is still Indeterminate at x = (2n + 1)Pi.
But these singularities are removable. The only question remaining is how
to remove them "nicely".

Note that 2 Pi Floor[(x + Pi)/(2 Pi)]  is the same as  x - 2 ArcTan[Tan[x/2]],
except that the latter is Indeterminate at x = (2n + 1)Pi.
Substituting accordingly in F1[x], we get F2[x]:

(2 ArcTan[Tan[x/2]/Sqrt[3]] + x - 2 ArcTan[Tan[x/2]])/Sqrt[3]

This seems no better, and perhaps even worse, than F1[x]. But, simply
noting that Tan[x/2] and Sin[x]/(1 + Cos[x]) are identical, F2[x] is
the result given by Gass. (Of course, whether he obtained his result
by my method, I have no idea.)

We still have removable singularities to get rid of. The trick (which can
perhaps be done with Mathematica, although I don't know how) is to
combine the two arctangents of F2[x] into a single arctangent. Using
just basic trig to do so, F2[x] can be "rewritten" as F3[x]:

(x - 2 ArcTan[Sin[x]/(Cos[x] + 2 + Sqrt[3])])/Sqrt[3]

which is my suggested antiderivative on R. The nice thing is that,
having combined the two former arctangents, each of which was
Indeterminate at x = (2n + 1)Pi, we have gotten rid of the removable
discontinuities, the new single arctangent being defined for all reals.

- - - - -

More generally, for 1/(a + Cos[x]) with a > 1 or a < -1, the above process
can be applied to give an antiderivative valid on R:

(x - 2 ArcTan[Sin[x]/(Cos[x] + a + Sign[a] Sqrt[a^2 - 1])])/(Sign[a] Sqrt[a^2 - 1]).

Kind regards,
David W. Cantrell

P.S. There is a way that F1[x] could be _made_ valid throughout R. One
might suggest that the reason that F1[x] is Indeterminate at x = (2n + 1)Pi
in Mathematica is the presence of Tan[x/2], but I do not agree. Tan[x/2] is
defined for _all_ real x in Mathematica; in particular, at x = (2n + 1)Pi,
its value is ComplexInfinity. The reason that F1[x] is Indeterminate is
that ArcTan[ComplexInfinity] is Indeterminate. That, in my opinion, need
not be the case! ArcTan is, after all, just the principal branch of the
multivalued inverse tangent relation. What we choose to call the principal
branch is, in essence, _arbitrary_. That being the case, what harm would be
done by assigning a value to ArcTan[ComplexInfinity]? Granted,
ArcTan[Infinity] is +Pi/2, while ArcTan[-Infinity] is -Pi/2. But I see no
reason why we could not reasonably choose to say that
ArcTan[ComplexInfinity] is one of those. If we chose
ArcTan[ComplexInfinity] = -Pi/2, then F1[x], as originally given, would be
valid throughout R. If we instead chose ArcTan[ComplexInfinity] = +Pi/2,
then the Floor in F1 would need to be replaced by Ceiling to give us an
antiderivative valid throughout R. My point is that Indeterminate is
a "dead end" which should be avoided when there is a reasonable, even if
arbitrary, way to do so.


  • Prev by Date: Re: 2X2 arrays
  • Next by Date: Re: Definite Integration in Mathematica
  • Previous by thread: Re: Definite Integration in Mathematica
  • Next by thread: Re: Definite Integration in Mathematica