5

Naïvely this is what happens and it obviously is not helpful!

In[7]:= Conjugate[SphericalHarmonicY[1, 1, θ, ϕ]]
Out[7]= -(1/2) E^(-I Conjugate[ϕ]) Sqrt[3/(2 π)] Conjugate[Sin[θ]]

So, I tried stating initially that $\theta$ and $\phi$ are reals but still that doesn't seem to have helped any bit,

In[8]:= θ ∈ Reals; ϕ ∈ Reals;

In[9]:= SphericalHarmonicY[1, 1, θ, ϕ]
Out[9]= -(1/2) E^(I ϕ) Sqrt[3/(2 π)] Sin[θ]

In[10]:= Conjugate[SphericalHarmonicY[1, 1, θ, ϕ]]
Out[10]= -(1/2) E^(-I Conjugate[ϕ]) Sqrt[3/(2 π)] Conjugate[Sin[θ]]

Kindly tell me how to do this? (I want to calculate sums like $\sum\limits_{m=-\ell}^{\ell}\left| Y_{l,m} (\theta,\phi)\right|^2$.)

mmal
  • 3,508
  • 2
  • 18
  • 38
user6818
  • 1,171
  • 1
  • 12
  • 27

4 Answers4

4

Almost always in such situations, ComplexExpand is your friend:

Conjugate[SphericalHarmonicY[1, 1, θ, ϕ]] // ComplexExpand
(* -(Sqrt[3/(2*Pi)]*Cos[ϕ]*Sin[θ])/2 + (I/2)*Sqrt[3/(2*Pi)]*Sin[θ]*Sin[ϕ] *)
mmal
  • 3,508
  • 2
  • 18
  • 38
murray
  • 11,888
  • 2
  • 26
  • 50
  • Thanks! But isn't there a way to just make Mathematica understand that theta and phi are reals? I mean, I want to do many calculations like this in one file and I would like to have it declared once and for all that \theta and \phi are reals. Isn't there a way for that? – user6818 Apr 21 '13 at 23:09
  • This thing of "ComplexExpand" doesn't seem to work if I say have a coefficient like of $(1/a)Y_{l,m}(\theta,\phi)$. Then ComplexExpand doesn't understand that $a$ is real and is making an unnecessary mess of the expression. – user6818 Apr 22 '13 at 00:07
  • ComplexExpand does an expansion making the assumption that all variables and symbolic constants involved are real. There are not really "assertions" like \[theta] \[Element] Reals that do anything. Sometimes setting values for the global $Assumptions will do what you want, but that's only for affecting subsequent uses of certain functions such as Simplify and Integrate. – murray Apr 22 '13 at 03:18
  • 2
    I disagree with this answer, though not to the extent of downvoting. ComplexExpand does more, than just assuming all symbols to be real. As you can see, It has transformed Exp[I \[Phi]] to Cos[\[Phi]] + I Sin[\[Phi]]. I view this as undesirable behavior and would often prefer to see it drop Conjugates, with minimal alteration of the form of the expression. – LLlAMnYP Apr 15 '15 at 13:24
  • I agree with LLIAMnYP. Here is a minimal method that avoid this issue: Refine[Conjugate[SphericalHarmonicY[1, 1, θ, ϕ]], _Symbol ∈ Reals]. For an exhaustive discussion, see here. – Jess Riedel Sep 27 '17 at 18:53
3

This is the spherical harmonic:

SphericalHarmonicY[1, 1, \[Theta], \[Phi]]

It returns this:

-(1/2) E^(I \[Phi]) Sqrt[3/(2 \[Pi])] Sin[\[Theta]]

And this is its complex conjugate:

SphericalHarmonicY[1, 1, \[Theta], \[Phi]] /. I -> -I

returning this:

-(1/2) E^(-I \[Phi]) Sqrt[3/(2 \[Pi])] Sin[\[Theta]]

as it can be expected.

Alexei Boulbitch
  • 39,397
  • 2
  • 47
  • 96
3

Rule

{Complex[re_, im_] :> Complex[re, -im]}     

seems to convert complex expressions which contain symbols which are meant to be real.

Rule

{I -> -I}     

does not, even on simple example:

2 I /.{I -> -I}
2 I

the reason being that symbol I is automatically translated by Mathematica to

Complex[0, 1]

and rule above is interpreted by Mathematica as

Complex[0, 1] -> Complex[0, -1]

However, when I apply it to a simple expression (say, 2 + 3 I), I am working with a different expression (in this case Complex[2, 3]), so the rule is not applicable.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Vladimir
  • 202
  • 1
  • 8
  • 3
    Your pattern is not exhaustive. For example ArcSin[2] is a complex number that won't get picked up by your pattern. – Greg Hurst Dec 09 '14 at 22:36
2

The best way about this, using again the spherical harmonics, is this:

  1. Define a symbol for the complex conjugate, e.g. Ybar

  2. Simplify the expression for the spherical harmonic:

    Y[l_, m_, θ_, ϕ_] := SphericalHarmonicY[l, m, θ, ϕ]
    
  3. Define Ybar

    Ybar[l_, m_, θ_, ϕ_] := SphericalHarmonicY[l, m, θ, ϕ] /. I -> -I
    

And that's it

Sektor
  • 3,320
  • 7
  • 27
  • 36
Eitan
  • 21
  • 1