MathGroup Archive 2010

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

Search the Archive

Re: Different answer when running cell second time?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109715] Re: Different answer when running cell second time?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 13 May 2010 07:24:48 -0400 (EDT)

On 5/12/10 at 7:33 AM, jason.lee.quinn at gmail.com (Jason Quinn) wrote:

>If I open Mathematica 7.01.0 (64-bit Linux version) that only
>contains the following input in a single cell,

>Assuming[\[Sigma] > 0, Integrate[p/((Pi*\[Sigma]^2)*E^((p^2 -
>2*p*p0*Cos[2*(\[Phi] - \[Phi]0)] + p0^2)/(2*\[Sigma]^2))),  {p0, 0,
>Infinity}]]

>When I hit shift-enter, I get an answer. If I hit, shift-enter a
>second time, I get a different answer. Can anybody tell me why? This
>seems like a bug. It happens even if I clear all the variables used
>in the calculation.

I get the same results using Mathematica 7.01 on Mac OS X. The
two results look to be equivalent with the second result being
simpler than the first. When Integrate does its thing, it caches
intermediate results. The first time you execute Integrate, it
returns an answer likely based on the first solution found and
time constraints built into the algorithms Integrate uses. But
the second time you execute Integrate, the intermediate results
are still available in a cache. These intermediate results allow
further simplification within whatever constraints are built
into Integrate.



  • Prev by Date: Re: How to write reports and books in Mathematica
  • Next by Date: Problem with Nminimize
  • Previous by thread: Different answer when running cell second time?
  • Next by thread: Re: Different answer when running cell second time?