MathGroup Archive 2003

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

Search the Archive

Re: Re: Integrating Abs[Sin[]^2]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38995] Re: [mg38936] Re: Integrating Abs[Sin[]^2]
  • From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
  • Date: Fri, 24 Jan 2003 05:04:00 -0500 (EST)
  • References: <b032m9$mv4$1@smc.vnet.net> <b05qsi$2a7$1@smc.vnet.net> <b0jg1t$t97$1@smc.vnet.net> <200301221109.GAA05214@smc.vnet.net> <oprjevv7tramtwdy@smtp.cox-internet.com>
  • Sender: owner-wri-mathgroup at wolfram.com

"Dr Bob" <drbob at bigfoot.com> wrote:
> Mathematica is NOT giving wrong answers in this case.
>
> It is assuming (non-zero) real parameters and giving the right
> answer in that case.

Whether Mathematica is or is not giving a "wrong" answer in the case
result = Integrate[ Abs[Sin[k x]]^2, {x,0,1}]; N[ result /. k->I+1 ]
depends upon whether it is or is not appropriate for Mathematica to
make a default assumption that k is a nonzero real. IMO, that could be
debated.

But surely, as I noted previously in this thread, Mathematica -- at
least version 4.2 for Windows -- does give a wrong answer for
result = Integrate[ Abs[Sin[k x]]^2, {x,0,1}, Assumptions->
Element[k, Complexes]; N[ result /. k->I+1 ]. I do not see how the
incorrectness of this can be debated (other than to say that
Mathematica should be allowed to ignore an _explicitly stated_
assumption!)

David

> On Wed, 22 Jan 2003 06:09:24 -0500 (EST), David W. Cantrell
> <DWCantrell at sigmaxi.org> wrote:
>
> > Jos R Bergervoet <antispam at nospam.com> wrote:
> >> David W. Cantrell wrote:
> >> >
> >> > Jos R Bergervoet  <jos.bergervoet at philips.no_s_p_a_m.com>
> >> >>
> >> >>   result = Integrate[ Abs[Sin[k x]]^2, {x,0,1}]
> >> >>   N[ result /. k->I+1 ]
> >> >>
> >> >> (*  Analytical approach gives 0.261044 + 0.616283 I,  WRONG
!!! *)
> >> >>
> >> >>   k=I+1; NIntegrate[ Abs[Sin[k x]^2], {x,0,1}]
> >> >>
> >> >> (*  Numerical check gives 0.679391  *)
> >> >>
> >> ...
> >> >> What should I do to circumvent such errors?
> >> >
> >> > One thing that works in Mathematica (as well as in the other
> >> > CAS) is to
> >> >
> >> >  Integrate[ Abs[Sin[(a+b*I) x]]^2, {x,0,1}].
> >> >
> >> > This gives  (a*Sinh[2*b] - b*Sin[2*a]) / (4*a*b),
> >> >
> >> > which agrees with your result below.
> >>
> >> But again it is wrong! It only is correct if a and b happen
> >> to be real quantities, which is nowhere stated!
> >
> > Well, let me state it now here:
> >
> > I was merely trying to provide a "workaround" which would give
> > you a correct result in the event that your coefficient k was
complex.
> > (I was not trying in any way to exonerate Mathematica!) In that
> > event, k may be written, _without loss of generality_, as a+b*I,
> > where a and b are both REAL.
> >
> >> So the main question still is: Why is Mathematica making
> >> these very silly errors? One could expect it from an early
> >> version of a product, but that is not what Mathematica 4.x
> >> is!
> >
> > Yes, the main question remains.




  • Prev by Date: Re: Re: Solutions for functions containing jump discontinuities
  • Next by Date: Re: Re: Multivariate-T Simulation Problem
  • Previous by thread: Re: Re: Integrating Abs[Sin[]^2]
  • Next by thread: Re: Integrating Abs[Sin[]^2]