Complex output from a real integral

  • Context: Mathematica 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Complex Integral Output
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
7 replies · 2K views
member 428835
Hi PF!

I am integrating the following

Code:
sin\[Theta][x_, \[Alpha]_] := Sqrt[(2 - 2 x^2)/(
 3 - 4 x Cos[\[Alpha]] + Cos[2 \[Alpha]])]

cos\[Theta][x_, \[Alpha]_] := Sqrt[(Cot[\[Alpha]] - x Csc[\[Alpha]])/(
 1 + 2 x Cot[\[Alpha]] Csc[\[Alpha]] - 2 Csc[\[Alpha]]^2)]

\[Rho][x_, \[Alpha]_] := Sqrt[(3 - 4 x Cos[\[Alpha]] + 
    Cos[2 \[Alpha]]) Csc[\[Alpha]]^2]/Sqrt[2]

dn\[Phi]b[j_, x_, \[Alpha]_, L_] := 
 j LegendreP[j, L, 
     cos\[Theta][
      x, \[Alpha]]] (-Sqrt[1 - x^2] sin\[Theta][x, \[Alpha]] + 
      x cos\[Theta][x, \[Alpha]]) \[Rho][x, \[Alpha]]^(j - 1) + 
   sin\[Theta][x, \[Alpha]] D[
     LegendreP[j, L, z], {z, 
      1}] (Sqrt[1 - x^2] cos\[Theta][x, \[Alpha]] + 
      x sin\[Theta][x, \[Alpha]]) \[Rho][x, \[Alpha]]^(j - 1) /. 
  z -> cos\[Theta][x, \[Alpha]]

b[\[Alpha]_] := Cos[\[Alpha]]

NIntegrate[dn\[Phi]b[3, x, \[Pi]/3, 1], {x, b[\[Pi]/3], 1}]
The output for this integral is ##-1.1331 - 1.17012 i##. A plot of the integrand is attached. There is a singularity, but the imaginary component seems wrong. Any help?
 

Attachments

Physics news on Phys.org
1. If you would like assistance, it would help if you converted as much as you can of that code into conventional algebraic & analysis symbolic expressions that don't require "\special symbols", language-specific syntax, and (I imagine) version-specific built-in or special functions.
2. If that integrand is giving you a non-Real result, then presumably your integration path is responsible. But I have no idea where to find that specified within the code (because I don't happen to be fluent in that language).
 
  • Like
Likes   Reactions: FactChecker and BvU
JMz said:
1. If you would like assistance, it would help if you converted as much as you can of that code into conventional algebraic & analysis symbolic expressions that don't require "\special symbols", language-specific syntax, and (I imagine) version-specific built-in or special functions.
I'll temper that by saying that having code that can be copied and directly pasted into Mathematica is very useful when trying to help on the technical aspects of Mathematica.

However, @joshmccraney, I think that the problem here is not Mathematica but mathematics. You should start a new thread in the calculus forum with a mathematical description of the integral.
 
  • Like
Likes   Reactions: JMz
My apologies, @joshmccraney, for failing to notice that the thread's keyword is, in fact, Mathematica. (I suspected as much but failed to recognize that expressing the OP in Mathematica with that keyword was entirely appropriate -- even though the problem does indeed seem to lie within math, not Math.)
 
Thank you both. I'll create another thread, as it was unclear to me whether Mathematica was the culprit or the actual math.
 
Sounds good. (Great thumbnail, BTW. ;-)
 
  • Like
Likes   Reactions: member 428835