Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1990

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

Search the Archive

Re: Bug in Integrate?

  • To: mathgroup at
  • Subject: Re: Bug in Integrate?
  • From: uunet!decide!bobk (Bob Korsan)
  • Date: Wed, 15 Aug 90 10:32:05 PDT

You write

----- Begin Included Message -----

>From saxony!uunet!!mathgroup-adm Tue Aug 14 20:59:55 1990
From: uunet!!smithw (William V. Smith)
To: mathgroup at
Subject: Bug in Integrate?

This problem came up in some instructional materials being developed
here. If any of you know what's going on here let me know.  I told
the person who handed it to me, that it might be related to the rather
awkward way Mathematica handles square roots.  So, try doing
this integration problem:


  a Integrate[Sqrt[(1-Cos[theta])^2+Sin[theta]^2],{theta,0,2 Pi}]



(*this is incorrect*)


  a NIntegrate[Sqrt[(1-Cos[theta])^2+Sin[theta]^2],{theta,0,2 Pi}]


   8. a

(*this is correct*)

Date: Fri, 10 Aug 90 23:24:01 MDT
From: smithw at (William V. Smith)
To: mathgroup at
Subject: Re: Another mathematica bug?

Whoops! I just got a chance to look at this one again and it appears
that NEITHER Integrate nor NIntegrate give the correct answer.  I
get 4aSqrt[2] working it out by hand.  Sorry about that.  Its been
a busy day.  Somebody want to check this?

----- End Included Message -----

Well, you are correct, the trouble is with Sqrt. If you look at the
integrand and simplify


Out[1]:=Sqrt[2 - 2 Cos[t]]

and then



      -2 Sqrt[2]
Sqrt[1 + -------------]
         (1 + Cos[t])

If you plot this you will notice that since Mathematica
always (EVEN WHEN IT SHOULDN'T) takes the positive
square root, the result is always negative in the
interval [0,2Pi]. Thus, the integrand evaluated at
both end points is the same and subtracts to zero.
This is a MAJOR BUG in version 1.2.1 and should be
corrected immediately.


|    "The range of what we think and do     | Bob Korsan                      |
|     is limited by what we fail to notice. | Decisions, Decisions!           |
|     And because we fail to notice that we | 2136 Lyon Avenue                |
|     fail to notice there is little we can | Belmont, CA 94002-1639          |
|     do to change until we notice how      | 1(415) 595-1206                 |
|     failing to notice shapes our thoughts | bobk at decide.UUCP                |
|     and deeds."                           | korsan at            |
|                 -- R. D. Laing            | {sun,uunet}!saxony!decide!bobk  |

  • Prev by Date: No Bug found...
  • Next by Date: N[10^-11,16]
  • Previous by thread: No Bug found...
  • Next by thread: Re: Bug in Integrate?