Re: Integrating Abs[Sin[]^2]
- To: mathgroup at smc.vnet.net
- Subject: [mg38936] Re: Integrating Abs[Sin[]^2]
- From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
- Date: Wed, 22 Jan 2003 06:09:24 -0500 (EST)
- References: <b032m9$mv4$1@smc.vnet.net> <b05qsi$2a7$1@smc.vnet.net> <b0jg1t$t97$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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.
David
- Follow-Ups:
- Re: Re: Integrating Abs[Sin[]^2]
- From: Dr Bob <drbob@bigfoot.com>
- Re: Re: Integrating Abs[Sin[]^2]