       Re: Another strange bug in Mathematica 4.0's Integrate

• To: mathgroup at smc.vnet.net
• Subject: [mg25438] Re: Another strange bug in Mathematica 4.0's Integrate
• From: Hendrik van Hees <h.vanhees at gsi.de>
• Date: Sun, 1 Oct 2000 02:44:22 -0400 (EDT)
• References: <8q21lp\$hoh@smc.vnet.net> <ztgz5.89556\$Zh6.152771@ralph.vnet.net> <8qlo62\$q42@smc.vnet.net> <8r19m2\$hv3@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Ok, then please tell me, _how_ Integrate is defined in Mathematica
because this will help me a lot in more difficult problems. Let me again
cite the really strange behaviour for this very simple Integral:

Mathematica 4.0 for Students: Linux Version
-- Motif graphics initialized --

In:= Integrate[Sqrt[(r-x)(r+x)],{x,-r,r},Assumptions->{r>0}]

2
Pi r Sqrt[r ]
Out= -------------
4

Of course the result should be twice as big and this result you get
indeed from a _mathematically identical expression for the integrand_:

In:= In:= Integrate[Sqrt[r^2-x^2],{x,-r,r},Assumptions->{r>0}]

2
Pi r
Out= -----
2

Ok. Let's look what happens with the indefinite integrals:

x Sqrt[(r - x) (r + x)]
Out= ----------------------- -
2

2                                 Sqrt[r - x] x
r  Sqrt[(r - x) (r + x)] ArcTan[--------------------]
(-r + x) Sqrt[r + x]
>    -----------------------------------------------------
2 Sqrt[r - x] Sqrt[r + x]

In:=  Integrate[Sqrt[r^2-x^2],x,Assumptions->{r>0}]

2    2
2        x Sqrt[r  - x ]
r  ArcTan[---------------]
2    2                   2    2
x Sqrt[r  - x ]                -r  + x
Out= --------------- - --------------------------
2                      2

This explains a lot! As you see in the first expression Mathematica
splits the square root! I guess for the definite integral the boundaries
of the integral are naively put in and of course at the boundaries in
the first expression you are running in trouble because you are
evaluating the square root along the branch cut which runs along the
negative real axis. If Mathematica would handle branch cuts and so on
correctly it should at least print a warning that it is running into
that problems.

My only way out in really serious calculations is to take the indefinite
integrals (checking by differentiation if they are correct) and then to
take the correct expression by putting it on the right Riemann sheet by
hand.

--
Hendrik van Hees		Phone:  ++49 6159 71-2751
c/o GSI-Darmstadt SB3 3.183	Fax:    ++49 6159 71-2990
Planckstr. 1			mailto:h.vanhees at gsi.de