Re: once more integrate

• To: mathgroup at smc.vnet.net
• Subject: [mg20793] Re: [mg20735] once more integrate
• Date: Sun, 14 Nov 1999 18:13:46 -0500 (EST)
• References: <199911100517.AAA19687@smc.vnet.net.>
• Sender: owner-wri-mathgroup at wolfram.com

```Reply from Wolfram:

> In[4]:= Integrate[1/x^2,{x,-2,2}]
>
> Out[4]= Infinity                    (correct)
>
> In[5]:= Integrate[1/x^2,{x,-Abs[a],2}] /. a -> 2
>
> Out[5]= -1                           (not correct)
>
> In[6]:=  Integrate[1/x^2,{x,-Abs[a],2}]
>
>           1      1
> Out[6]= -(-) - ------
>           2    Abs[a]
>
> In[7]:=  Integrate[1/x^2,{x,-a,a}]
>
>                               -2
> Integrate::idiv: Integral of x   does not converge on {-a, a}.
>
>                    -2
> Out[7]= Integrate[x  , {x, -a, a}]
>
> In the first case Mathematica gives the corrcet answer, in the
> second case it overlooks the singularity. In the third case the
> answer is at least not wrong.
>
>
> ========================================================================
> Wolfgang Schadow             Phone: +1-604-222-1047 ext. 6453 (office)
> TRIUMF                              +1-604-875-6066           (home)
> Theory Group                   FAX: +1-604-222-1074
> 4004 Wesbrook Mall
> Vancouver, B.C. V6T 2A3      email: schadow at triumf.ca
>
> ========================================================================
>
> ----------------------------------------------------------------------------
>
> Hello,
>
> Thank you for the email.
>
> 1)  You cannot do a replacement after and integral as you have done.  The
> reaon is that Mathematica evaluates the integral first, and then does the
> replacement.
>
> 2)  If you make the integral in this case a function of a as follows:
>
> In[1]:= f[a_]:= Integrate[1/x^2, {x, -Abs[a], 2}]
>
> Then you can then evaluate the integral correctly by passing 2 to the
> integral before it is evaluated:
>
> In[2]:= f[2]
>
> Out[2]= Infinity
>
> In the following case:
>
> In[3]:=  Integrate[1/x^2, {x, -Abs[a], 2}]
>
>   You do get an incorrect answer, but it is the same answer as the one you
> would get if you did it by hand.  The Fundamental Theorem of calculus is
> "dumb" in that it doesn't know there is a singularity at x=0.  You can
> only use the Fundamental Theorem of calculus if you know that your
> function is well behaved and has no singularities.
>
>   If you don't give an exact value for a bound, Mathematica will try to
> use the Fundamental Theorem of calculus, which gives a bad result in this
> case.
>
>   As long as you specify an exact value for a before hand or in place of
> a, you will get the correct answer.
>
> Sincerely,
>
> Jeffrey Bryant
> Technical Support
> Wolfram Research, Inc.
> support at wolfram.com

========================================================================
Wolfgang Schadow             Phone: +1-604-222-1047 ext. 6453 (office)
TRIUMF                              +1-604-875-6066           (home)
Theory Group                   FAX: +1-604-222-1074
4004 Wesbrook Mall
Vancouver, B.C. V6T 2A3      email: schadow at triumf.ca