MathGroup Archive 2009

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

Search the Archive

Re: Re: Bug with Integrate in v7?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103277] Re: [mg103262] Re: Bug with Integrate in v7?
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sat, 12 Sep 2009 07:26:42 -0400 (EDT)
  • References: <h859sa$pva$1@smc.vnet.net> <h87pdf$5f6$1@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

NIntegrate fails on the whole interval, but succeeds if we break it into  
two intervals:

g[x_] = Piecewise[{{Sin[x]^4, -\[Pi] <=
       x <= -\[Pi]/2}, {Sin[x]^10, -\[Pi]/2 <=
       x <= \[Pi]/2}, {Sin[x]^16, \[Pi]/2 < x <= \[Pi]}}];
NIntegrate[g@x Sin[x], {x, -\[Pi], 0}] +
  NIntegrate[g@x Sin[x], {x, 0, Pi}] -
  Integrate[g@x Sin[x], {x, -Pi, Pi}]

-4.59355*10^-14

Bobby

On Fri, 11 Sep 2009 18:57:19 -0500, guerom00 <guerom00 at gmail.com> wrote:

> I stumbled on this one :
>
> In[59]:= f=Piecewise[{
> {Sin[x]^4,-\[Pi]<=x<=-\[Pi]/2},
> {Sin[x]^10,-\[Pi]/2<=x<=\[Pi]/2},
> {Sin[x]^16,\[Pi]/2<x<=\[Pi]}
> }];
> NIntegrate[f Sin[x],{x,-\[Pi],\[Pi]}]
> Integrate[f Sin[x],{x,-\[Pi],\[Pi]}]
>
> Out[60]= 0.
> Out[61]= -(25576/109395)
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Limit computed incorrectly
  • Next by Date: Re: Produce PDFs of Documentation notebooks?
  • Previous by thread: Re: Bug with Integrate in v7?
  • Next by thread: Re: Bug with Integrate in v7?