Re: Re: Integrating Abs[Sin[]^2]
- To: mathgroup at smc.vnet.net
- Subject: [mg38971] Re: [mg38936] Re: Integrating Abs[Sin[]^2]
- From: Dr Bob <drbob at bigfoot.com>
- Date: Thu, 23 Jan 2003 08:03:43 -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>
- Sender: owner-wri-mathgroup at wolfram.com
Mathematica is NOT giving wrong answers in this case.
It is assuming (non-zero) real parameters and giving the right answer in
that case.
Bobby
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.
>
> David
>
>
--
majort at cox-internet.com
Bobby R. Treat
- References:
- Re: Integrating Abs[Sin[]^2]
- From: "David W. Cantrell" <DWCantrell@sigmaxi.org>
- Re: Integrating Abs[Sin[]^2]