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$.)

  • 1
    $\begingroup$ Try Simplify[Conjugate[SphericalHarmonicY[1, 1, θ, ϕ]], θ ∈ Reals && ϕ ∈ Reals] $\endgroup$ – J. M.'s discontentment Apr 22 '13 at 9:57
  • $\begingroup$ Simply writing θ ∈ Reals; ϕ ∈ Reals; is not the way to indicate to Mathematica that those variables are real. Try looking up $Assumptions and Assumptions. $\endgroup$ – Sjoerd C. de Vries Apr 22 '13 at 15:46

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[ϕ] *)
| improve this answer | |
  • $\begingroup$ 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? $\endgroup$ – user6818 Apr 21 '13 at 23:09
  • $\begingroup$ 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. $\endgroup$ – user6818 Apr 22 '13 at 0:07
  • $\begingroup$ 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. $\endgroup$ – murray Apr 22 '13 at 3:18
  • 2
    $\begingroup$ 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. $\endgroup$ – LLlAMnYP Apr 15 '15 at 13:24
  • $\begingroup$ 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. $\endgroup$ – Jess Riedel Sep 27 '17 at 18:53

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.

| improve this answer | |


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

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


{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.

| improve this answer | |
  • 3
    $\begingroup$ Your pattern is not exhaustive. For example ArcSin[2] is a complex number that won't get picked up by your pattern. $\endgroup$ – Chip Hurst Dec 9 '14 at 22:36

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.