Complex output from a real integral

  • Context: Mathematica 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Complex Integral Output
Click For Summary

Discussion Overview

The discussion revolves around the integration of a complex function using Mathematica, specifically focusing on the output of an integral that yields a complex number. Participants explore the potential reasons for the unexpected imaginary component in the result and the implications of the singularity present in the integrand.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • The original poster (OP) presents a complex integral and notes that the output includes an imaginary component, which they find concerning.
  • Some participants suggest that converting the code into conventional algebraic expressions might facilitate better understanding and assistance.
  • One participant posits that the issue may not lie with Mathematica itself but rather with the mathematical formulation of the integral.
  • Another participant encourages the OP to create a new thread in the calculus forum for a more mathematical discussion of the integral.
  • There is acknowledgment of the appropriateness of using Mathematica in the context of the thread, despite some confusion about the source of the problem.

Areas of Agreement / Disagreement

Participants express differing views on whether the issue is related to Mathematica or the underlying mathematics, indicating that the discussion remains unresolved.

Contextual Notes

Participants note the presence of a singularity in the integrand, which may influence the behavior of the integral, but do not resolve the implications of this singularity on the output.

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
Thanks! I'm a huge fan!
 
(Me, too.)
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 9 ·
Replies
9
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
3
Views
2K