Re: Integrating Abs[Sin[]^2]
- To: mathgroup at smc.vnet.net
- Subject: [mg38865] Re: [mg38830] Integrating Abs[Sin[]^2]
- From: Dr Bob <majort at cox-internet.com>
- Date: Thu, 16 Jan 2003 03:21:10 -0500 (EST)
- References: <200301150719.CAA23405@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Integrate[] assumed that k is real, and gave the correct answer for that case. Try this: Integrate[Abs@Sin[(j + k I) x]^2, {x, 0, 1}] % /. j -> k % /. k -> 1 ((-k)*Sin[2*j] + j*Sinh[2*k])/ (4*j*k) ((-k)*Sin[2*k] + k*Sinh[2*k])/ (4*k^2) (1/4)*(-Sin[2] + Sinh[2]) This time, Integrate[] assumed j and k are real, but that makes j + k I perfectly general --- except that the answer involves division by the imaginary part. The real version of the answer is the limiting value of the complex version: Integrate[Abs@Sin[(j + k I) x]^2, {x, 0, 1}] Limit[%, k -> 0] Integrate[Abs@Sin[j x]^2, {x, 0, 1}] ((-k)*Sin[2*j] + j*Sinh[2*k])/ (4*j*k) 1/2 - Sin[2*j]/(4*j) (2*j - Sin[2*j])/(4*j) Bobby On Wed, 15 Jan 2003 02:19:39 -0500 (EST), Jos R Bergervoet <antispam at nospam.com> 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 > > -- majort at cox-internet.com Bobby R. Treat
- References:
- Integrating Abs[Sin[]^2]
- From: Jos R Bergervoet <antispam@nospam.com>
- Integrating Abs[Sin[]^2]