Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Re: Integrate with If

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22203] Re: [mg22180] Integrate with If
  • From: schadow at netcom.ca
  • Date: Fri, 18 Feb 2000 02:34:39 -0500 (EST)
  • References: <200002170624.BAA04409@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> Why does
> 
>         Integrate[If[Sin[t] > 0, 1, 0] , {t, -Pi, Pi}]
> 
> evaluate to 2Pi?
> 
>         Plot[If[Sin[t] > 0, 1, 0] , {t, -Pi, Pi} ]
> 
> looks all right.
> 
> 
> Puzzled,
> 
> Johan Berglind,
> Chalmers, Goteborg,
> Sweden.
> 

I have no an answer, but here are some other 'interesting' results 

f[x_] = If[Sin[x] > 0, 1, 0]

Integrate[f[x], {x, -\[Pi], 0}] 

gives 0 (correc)

Integrate[f[x], {x, -\[Pi], 2}]

gives 0 (wrong)

\!\(Integrate[f[x], {x, \(-\[Pi]\), \[Pi] - 1\/100000}]\)

gives 0 (wrong).

One way to get a correct result is:

Integrate[f[x], {x, -\[Pi], 0, \[Pi]}]

or with NIntegrate

NIntegrate[f[x], {x, -\[Pi], 0, \[Pi]}]

NIntegrate[f[x], {x, -\[Pi], \[Pi]}]


Wolfgang

========================================================================
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
Canada                       www  : http://www.triumf.ca/people/schadow 

========================================================================


  • Prev by Date: Re: shell commands in notebooks
  • Next by Date: Re: Re: A Dead Thread? Re. Coloring ExtendGraphics ListContourPlot s...
  • Previous by thread: Re: Integrate with If
  • Next by thread: Re: Integrate with If