Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Inconsistent behaviour of Integrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112462] Re: Inconsistent behaviour of Integrate
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Thu, 16 Sep 2010 06:00:26 -0400 (EDT)

On 15 Sep 2010, at 10:13, Andreas Maier wrote:

> Dear Andrzej Kozlowski,
>
> Andrzej Kozlowski wrote:
>> This depends on the speed on your computer. On my MacBook PRI I get:
>>
>> In[1]:== Integrate[
>> Sqrt[(x - 1/2)^2 + (y - 1/2)^2], {x, 0, 1}, {y, 0, 1}]
>>
>> Out[1]== (1/24)*(4*Sqrt[2] + Log[17 + 12*Sqrt[2]])
>>
>> However, if I use Maxim Rytin's trick to reduce performance thus:
>>
>> Dynamic[Pause[.5], UpdateInterval -> 1]
>>
>> ClearSystemCache[]
>
> Thank you for that hint. On the computers I tested your solution it wasn'=
t even
> necessary to reduce the performance. A single call of
>
> ClearSystemCache[]
>
> before using Integrate[] seemed to be enough to consistently produce the
> same results. Still for me it is very surprising, that a computer algebra=
 program
> like mathematica doesn't produce predictable results by default.
> Maybe some general commands for the beginning of a notebook, like
>
> SystemCache[Off]
> SystemPerformance[50]
>
> would be useful for Mathematica, so that one can be sure all the commands
> always produce the same results, independent of the machine they are running on.

Well, on a fast computer Mathematica will consistently produce the better result, unless your CPU is busy with other things or you on purpose decide to reduce performance. On a slower computer you will get the better (more "reduced") result on a second attempt after cashing it. The alternative would be to let your computer run for much longer. That would make Integrate more consistent but would also probably make many users loose patience.
Having everyone get the "less good" result would not seem to me like "progress".
>
>
> P.S.: I still wonder why Factor[17 + 12 Sqrt[2]] doesn't come up with
> (1 + Sqrt[2])^4. Can Factor[] only work with expressions involving variables
> like x, y...?

Yes. Factor only factors polynomials.

Andrzej Kozlowski

>
>> On 14 Sep 2010, at 11:12, Andreas Maier wrote:
>>
>>> Hello,
>>>
>>> I'm using Mathematica 7.0.1.0 on Linux x86 (64bit). I have a notebook
>>> file, where I integrate the same integral twice:
>>>
>>> In[1]:== Integrate[Sqrt[(x - 1/2)^2 + (y - 1/2)^2], {x, 0, 1}, {y, 0,
>>> 1}]
>>> Out[1]== 1/6 (Sqrt[2] + ArcSinh[1])
>>>
>>> In[2]:== Integrate[Sqrt[(x - 1/2)^2 + (y - 1/2)^2], {x, 0, 1}, {y, 0,
>>> 1}]
>>> Out[2]== 1/24 (4 Sqrt[2] + Log[17 + 12 Sqrt[2]])
>>>
>>> As you can see from the output, integrating the same integral a second
>>> time gives a different result. If I integrate the same integral a
>>> third and a fourth time I always get the second result again. Only if
>>> I restart the mathematica kernel, I get the first result again.
>>> The results are equivalent, since
>>>
>>> Log[17 + 12 Sqrt[2]] == Log[(1 + Sqrt[2])^4] == 4* Log[(1 + Sqrt[2]) ===
 4* ArcSinh[1]
>>>
>>> but somehow Mathematica seems to be able to do this simplification
>>> only once. Is this inconsistent behaviour a bug? Is there a
>>> possibility to give mathematica a hint, so that he always find the
>>> first solution 1/6 (Sqrt[2] + ArcSinh[1]) to the integral?
>>> From
>>>
>>> In[3]:== Expand[(1 + Sqrt[2])^4]
>>> Out[3]== 17 + 12 Sqrt[2]
>>>
>>> In[4]:== Factor[%]
>>> Out[4]== 17 + 12 Sqrt[2]
>>>
>>> I also figured that Mathematica doesn't seem to be able to factorize
>>> an expression like 17 + 12 Sqrt[2] into (1 + Sqrt[2])^4. Is this a
>>> known problem? Or should I use a different command to find this
>>> factorization?
>>>
>>> Sincerely,
>>> Andreas Maier
>>>
>>
>


  • Prev by Date: ANOVA question
  • Next by Date: Re: Inconsistent behaviour of Integrate
  • Previous by thread: Re: Inconsistent behaviour of Integrate
  • Next by thread: Re: Inconsistent behaviour of Integrate