Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Question about Integrate and If

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46645] Re: Question about Integrate and If
  • From: "John Jowett" <John.Jowett at cern.ch>
  • Date: Thu, 26 Feb 2004 17:53:43 -0500 (EST)
  • Organization: CERN
  • References: <c1iqub$69a$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,
         You can get the behaviour you want with:

Integrate[1/x, {x, a, 2a}, Assumptions -> a > 0]

If you look at the section on "Definite Integrals" in the Mathematica Book
or the Further Examples for the built-in function Integrate in the Help
Browser you will find some explanation.

John Jowett


"Antonio González" <SPAMgonferNO at esi.us.es> wrote in message
news:c1iqub$69a$1 at smc.vnet.net...
> Setting the trivial integral
>
> Integrate[1/x,{x,a,2a}]
>
> I obtain, in Mathematica 4.1 the simple result
>
> -Log[a] + Log[2a]
>
> that upon simplification gives Log[2].
>
> However, If I ask the same integral to Mathematica 5.0,
> I obtain
>
> If[a == 0, Log[2], Integrate[1/x, {x, a, 2*a}, Assumptions -> a != 0]]
>
> which is really stupid, as it is saying that if a==0,
> the integral (that would be singular in that case) is Log[2],
> but if a!=0 (which is the logical assumption) instead of
> giving the correct answer lets the question unanswered.
> In this case, the answer is trivial, but I have found the
> same behavior in more complicated integrals.
>
> The situation is still more complicated if I try to use
> assumptions. Making a copy and paste and asking
>
> Integrate[1/x, {x, a, 2*a}, Assumptions -> a != 0]
>
> the result is
>
> If[Im[a] != 0 || Re[a] != 0, Log[2], Integrate[x^(-1), {x, a, 2*a},
>   Assumptions -> a != 0 && Im[a] == 0 && Re[a] == 0]]
>
> that is even worse, as if I assume that a!=0, it is
> obvious that Im[a] != 0 || Re[a] != 0 (how could it be
> that a != 0 && Im[a] == 0 && Re[a] == 0 ?)
>
> Can anybody explain this strange behavior? Why does not give
> the answer
>
> If[a!= 0, Log[2],Indeterminate]
>
> or something like that?
>
>   Antonio
>
>



  • Prev by Date: Re: Matrix Element Extraction
  • Next by Date: Re: a question about [[ ]]
  • Previous by thread: Re: Question about Integrate and If
  • Next by thread: Combining Vectors to Form a Matrix