Message Boards Message Boards

2
|
5095 Views
|
5 Replies
|
12 Total Likes
View groups...
Share
Share this post:
GROUPS:

Integral funkiness

Posted 12 years ago
I have a rather curious problem. I'm trying to solve this integral:
step1 = Integrate[
  Cos[q + ((k2 - k2 Cos[\[Theta]]) \[Rho] Cos[\[Phi]] -
       k2 Sin[\[Theta]] \[Rho] Sin[\[Phi]])] \[Rho], {\[Phi], 0,
   2 \[Pi]},
  Assumptions -> {k2 > 0 && \[Theta] \[Element] Reals && \[Rho] > 0}]
The answer it gives me for that is
2 \[Pi] \[Rho] Cos[q]
This seems to be independent of Theta. However, if I plug in a value for Theta before doing the integral. For example Theta = Pi / 2 gives:
2 \[Pi] \[Rho] BesselJ[0, Sqrt[2] k2 \[Rho]] Cos[q]
And Theta = Pi gives
2 \[Pi] \[Rho] BesselJ[0, 2 k2 \[Rho]] Cos[q]
Obviously, the result does depend on Theta then, even though the initial answer has no theta dependence. Is this a bug I stumbled upon in Mathematica 8.0.1.0 for Linux or am I missing something fundamental here?
POSTED BY: J K
5 Replies
Posted 12 years ago
Thanks! That's a very neat approach. I think you made a minor mistake at the end though. I've gone through the steps you mentioned, but the series one gets is
In[13]:= Sum[(-1)^o q^(2 o)/(2 o)!, {o, 0, \[Infinity]}]

Out[13]= Cos[q]
There is an extra factor of (-1)^o there and the series starts from o=0 instead of o=1. With those modifications it works. So in the end one instead gets
Cos[q] ConditionalExpression[
2 ? ? BesselJ[0, Sqrt[(k2 - x)^2 + y^2] ?],
Sqrt[(k2 - x)^2 + y^2] ? Reals]
, which is definitely the answer I was looking for.

I had obtained that answer through a different approach, which I feel is simply a workaround for the bug, but to wit:
The original formula was
Cos[q + ((k2 - k2 Cos[?]) ? Cos[?] - k2 Sin[?] ? Sin[?])] ?
, which I had rewritten in the form
Cos[q + \[Gamma]1 Cos[\[Phi]] - \[Gamma]2 Sin[\[Phi]] \[Rho]
= Cos[q + \Sqrt[\[Gamma]1^2 + \[Gamma]2^2] Cos[\[Phi] + \[Beta]]]
, where the new angle ? is defined as
Cos[\[Beta]] = \[Gamma]1/Sqrt[\[Gamma]1^2 + \[Gamma]2^2]
Sin[\[Beta]] = \[Gamma]2/Sqrt[\[Gamma]1^2 + \[Gamma]2^2]
Doing so allowed Mathematica to solve the integral, giving the same answer as your method produced.
POSTED BY: J K
Okay, you figured it out; last night I found it strange to generate Cosh during integration of Cos. Just for the logs
 In[40]:= Clear[fN, fA]
 fN[q_, k2_, \[Theta]_, \[Rho]_] :=
  NIntegrate[
   Cos[q + ((k2 - k2 Cos[\[Theta]]) \[Rho] Cos[\[Phi]] -
        k2 Sin[\[Theta]] \[Rho] Sin[\[Phi]])] \[Rho], {\[Phi], 0,
    2 \[Pi]}]
 fA[q_, k2_, \[Theta]_, \[Rho]_] :=
  2 \[Pi] \[Rho] Cos[q] BesselJ[0,
     Sqrt[(k2 -
        k2 Cos[\[Theta]])^2 + (k2 Sin[\[Theta]])^2] \[Rho]] /; \
(-\[Pi] + \[Theta])/(2 \[Pi]) \[NotElement] Integers

In[55]:= Clear[ted]
ted = Transpose[
   RotateLeft[
    Join[RandomReal[{-1, 5}, {3,
       30}], {RandomReal[{-\[Pi] + 1/1000, \[Pi] - 1/1000}, 30]}]]];

In[67]:= Chop[(fA @@@ ted) - (fN @@@ ted)]

Out[67]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
POSTED BY: Udo Krause
Hi there,

this you can possibly solve: First of all, one sets 
q = 0, k2 Cos[?]= x, k2 Sin[?] = y
because the q is a strong obstacle and the ?-terms are unimportant for the integral. The simplified integral
(* q = 0, k2 Cos[\[Theta]] \[Rule] x, k2 Sin[\[Theta]]\[Rule] y *)
Integrate[
Cos[((k2 - x) \[Rho] Cos[\[Phi]] - y \[Rho] Sin[\[Phi]])] \[Rho], {\[Phi], 0, 2 \[Pi]},
Assumptions -> {k2 > 0 && \[Theta] \[Element] Reals && \[Rho] > 0}]

ConditionalExpression[
2 \[Pi] \[Rho] BesselJ[0, Sqrt[(k2 - x)^2 + y^2] \[Rho]],
Sqrt[(k2 - x)^2 + y^2] \[Element] Reals]
The conditional means
In[8]:= Reduce[(k2 - k2 Cos[\[Theta]])^2 + (k2 Sin[\[Theta]])^2 >= 0, \[Theta], Reals]

Out[8]= (C[1] \[Element]
    Integers && \[Theta] == \[Pi] +
     2 \[Pi] C[1]) || (-\[Pi] + \[Theta])/(2 \[Pi]) \[NotElement] Integers
and one finds
In[7]:= S
Integrate[Sin[((k2 - x) \[Rho] Cos[\[Phi]] - y \[Rho] Sin[\[Phi]])] \[Rho], {\[Phi], 0, 2 \[Pi]},
Assumptions -> {k2 > 0 && \[Theta] \[Element] Reals && \[Rho] > 0}]

Out[7]= 0
Why this is interesting? If you develop the orginal integral into a seris in q and integrate
Integrate[Series[
  Cos[q + ((k2 - k2 Cos[\[Theta]]) \[Rho] Cos[\[Phi]] -
       k2 Sin[\[Theta]] \[Rho] Sin[\[Phi]])] \[Rho], {q, 0,
   12}], {\[Phi], 0, 2 \[Pi]}]
you are left with only the both integrals shown above, one is zero, so the result is
(Cosh[q]- 1) ConditionalExpression[
2 \[Pi] \[Rho] BesselJ[0, Sqrt[(k2 - x)^2 + y^2] \[Rho]],
Sqrt[(k2 - x)^2 + y^2] \[Element] Reals]
x and y do depend on \ because of
In[13]:= Sum[q^(2 o)/(2 o)!, {o, 1, Infinity}]

Out[13]= -1 + Cosh[q]

Best regards
Udo.
POSTED BY: Udo Krause
Posted 12 years ago
Ah, thanks. Good to see that I'm not going crazy. emoticon
POSTED BY: J K
This may be an issue with your version of Mathematica - I was able to reproduce your first result in Mathematica 8.0.1, but was not able to reproduce the result in 8.0.4 or 9.0.1.  Those later versions returned the input unevaluated after a lengthy calculation.
POSTED BY: Karl Isensee
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract