       Re: Definite Integration in Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg74589] Re: Definite Integration in Mathematica
• From: "dimitris" <dimmechan at yahoo.com>
• Date: Tue, 27 Mar 2007 04:04:09 -0500 (EST)
• References: <etqo3f\$10i\$1@smc.vnet.net><eu7rtg\$bgr\$1@smc.vnet.net>

```>(By the way, as I just realized, Michael Trott
> in his book on symbolics has quite some interesting things to say related=
to this issue.)

There are a great many books about Mathematica.

Bu definetely if you want a book that combines Mathematica
with advanced mathematics for a various scientific fields (even form
current research) this book is Trott's Guidebooks. The whole series
deserves the money.

> However, in many practical applications people want to have an integral i=
n the
> former sense, and it is very disconcerting to fall down a discontinuity s=
tep along
> an integral of a continous integrand on the real line due to a singularit=
y of the
> integrand somewhere in the complex plane.  Therefore, I guess, the design=
ers of "the other
> CAS", which Dimitris uses for comparison, obviously opted to return an in=
tegral, which is continuous along
> the real axis (if such an integral is available in the set of possible so=
lutions).

It's just happen in this case the antiderivative returned by the other
CAS to be continuous
in the real axis. For other integrals usually discontinuous
antiderivatives are returned.
For example

(*other CAS*)
int(1/(5+cos(x)),x);
1/6*6^(1/2)*arctan(1/3*tan(1/2*x)*6^(1/2))

(*mathematica*)
Integrate[1/(5 + Cos[x]), x]
ArcTan[Sqrt[2/3]*Tan[x/2]]/Sqrt

both have jump discontinuity at x=+/- n*Pi,  n=odd.

See this thread for a clever method by Peter Pein in order
to get a continuous antiderivative with Mathematica.

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!)

Also based on my experience Mathematica is quantum steps
in front of other CAS (no I don't take any money from WRI!)
regarding integration capabilities.

For an example let

f = HoldForm[Integrate[Cos[Log[z]]/(1 + z^2)^Pi, {z, 0, Infinity}]]

The indefinite integral first

ReleaseHold[f /. Integrate[h_, {x_, __}] :> Integrate[h, x]]
FullSimplify[D[%, z] == Cos[Log[z]]/(1 + z^2)^Pi]

(1/4 + I/4)*z^(1 - I)*Hypergeometric2F1[1/2 - I/2, Pi, 3/2 - I/2, -
z^2] +
(1/4 - I/4)*z^(1 + I)*Hypergeometric2F1[1/2 + I/2, Pi, 3/2 + I/2, -
z^2]
True

The definite integral along with check...

Timing[g=ReleaseHold[f]]
{145.422*Second, (Pi*(-((Gamma[1/2 - I/2]*Sech[(1/2)*(1 - 2*I*Pi)*Pi])/
Gamma[(3/2 - I/2) - Pi]) -
(Gamma[1/2 + I/2]*Sech[(1/2)*(1 + 2*I*Pi)*Pi])/Gamma[(3/2 + I/2)
- Pi]))/(4*Gamma[Pi])}

{Chop[N[F, 21]], ReleaseHold[f /. Integrate[x___] :> NIntegrate[x,
WorkingPrecision -> 50, PrecisionGoal -> 20]]}
{0.142291882821508343786,0.142291882821508343786}

In my point of view this is a very tough integral (appeared in another
forum).
And getting an analytic result clearly demonstrates Mathematica's
integration
capabilities!

Let compare it with the other CAS I used in order to compare sometimes
its results with Mathematica
and vice versa...

The definite integral first

int(cos(ln(z))/(1+z^2)^Pi, z= 0..infinity);
int(cos(ln(z))/((1+z^2)^Pi),z = 0 .. infinity)

and now the indefinite

int(cos(ln(z))/(1+z^2)^Pi, z);
int(cos(ln(z))/((1+z^2)^Pi),z)

A numerical integration is possibly of course

evalf(Int(cos(ln(z))/(1+z^2)^Pi, z= 0..infinity););
0=2E1422918828

Best Regards
Dimitris

=CF/=C7 Michael Weyrauch =DD=E3=F1=E1=F8=E5:
> Hello,
>
>    thanks, Dimitris, for bringing up this issue. (By the way, as I just r=
ealized, Michael Trott
> in his book on symbolics has quite some interesting things to say related=
to this issue.)
>
> My remark in this thread clearly was written in the spirit of "functions =
of one real
> variable". As I see my statements are clearly incorrect in the sense of  =
"functions of a complex
> variable".
>
> However, in many practical applications people want to have an integral i=
n the
> former sense, and it is very disconcerting to fall down a discontinuity s=
tep along
> an integral of a continous integrand on the real line due to a singularit=
y of the
> integrand somewhere in the complex plane.  Therefore, I guess, the design=
ers of "the other
> CAS", which Dimitris uses for comparison, obviously opted to return an in=
tegral, which is continuous along
> the real axis (if such an integral is available in the set of possible so=
lutions).
>
> This is not just a matter of aestetics or simplicity as Dimitris remark i=
>
> >Do you prefer the extend antiderivative over the compact one obtained
> >directly
> >by Mathematica only because is real in the real axis?
> >As regards myself, no!
>
> In applications we have to use that solution which makes practical sense,=
and in many
> applications it's the integral which is continouus (and differentiable) f=
or a continouus integrand
> on the real axis. Of course, it's my task as a physicist or engineer to s=
ee if a mathematical
> solution serves my purposes or not, however, in such rather intriguing ca=
ses, it would be
> desirable that  the designers of Mathematica would help me by providing a=
n Option
> to Integrate, in which I could ask for an integral which is continuous on=
the real axis if such an integral
> exists for a particular integrand.
> (As I understand the remark of Daniel Lichtblau in some future version of=
Mathematica
> they may provide such an Option).
>
> Thanks again
>
> Michael Weyrauch

```

• Prev by Date: Re: Self-teaching snag
• Next by Date: Re: Integrate (a difficult integral)
• Previous by thread: Re: Re: Re: Definite Integration in Mathematica
• Next by thread: Re: Definite Integration in Mathematica