Re: Integrating Abs[Sin[]^2]
- To: mathgroup at smc.vnet.net
- Subject: [mg38955] Re: Integrating Abs[Sin[]^2]
- From: Jos R Bergervoet <antispam at nospam.com>
- Date: Tue, 21 Jan 2003 07:39:59 -0500 (EST)
- Organization: Philips Research Laboratories
- References: <b032m9$mv4$1@smc.vnet.net> <b05qsi$2a7$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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! 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! So could it be, perhaps, that Mathematica has now evolved so far that it has its own kind of humor, and is making these little "jokes" to entertain us? :-)) -- Jo