Re: Integrating Abs[Sin[]^2]
- To: mathgroup at smc.vnet.net
- Subject: [mg38850] Re: [mg38830] Integrating Abs[Sin[]^2]
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Thu, 16 Jan 2003 03:18:53 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In this case avoiding Abs by first converting the integrand (using ComplexExpand) to a different form gives the right answer: ComplexExpand[Integrate[ComplexExpand[Abs[Sin[k*x]]^2, {k}, TargetFunctions -> {Conjugate}], {x, 0, 1}], {k}, TargetFunctions -> {Re, Im}] -(Sin[2*Re[k]]/(4*Re[k])) + Sinh[2*Im[k]]/(4*Im[k]) Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ On Wednesday, January 15, 2003, at 04:19 PM, Jos R Bergervoet wrote: > A strange result appeared when using > > Mathematica 4.1 for Linux > Copyright 1988-2000 Wolfram Research, Inc. > -- Motif graphics initialized -- > > in computing the following: > > 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 *) > > > So why is the analytical result for |Sin[k x]|^2 wrong? > What should I do to circumvent such errors? > > Thanks in adv., > > -- Jos <jos.bergervoet at philips.no_s_p_a_m.com> > > PS: For those interested, the correct analytical result is: > > (Sinh[2Im[k]]/Im[k] - Sin[2Re[k]]/Re[k]) / 4 > > >