1
$\begingroup$

I would like to know if there is a syntax that allows me to enter a sum that has coefficients that vary for every term? I have no interest in evaluating them numerically, but rather to keep them as symbols with indices set by the iteration variable of the sum.

See for example this spherical harmonics, where the f coefficient is what I'm referring to.

enter image description here

The ultimate goal is to enter a similar sum in a way that allows me to calculate its partial derivatives.

$\endgroup$
  • $\begingroup$ Have you tried using Sum ? $\endgroup$ – Sektor May 19 '15 at 11:15
  • $\begingroup$ Well yes, I can use that for basic sums. However, I do not find any syntax for entering the coefficient f (in the example sum), and make it have different indices set by the iteration variables (l and m in this case). $\endgroup$ – prulken May 19 '15 at 11:25
  • $\begingroup$ f is just a function depending on two variables. Here you can find an example with 2 nested summations. Other than that I really don't see what can be done besides getting your hands dirty and experimenting with Sum. $\endgroup$ – Sektor May 19 '15 at 11:34
  • $\begingroup$ I guess the answer to my question is a "no" then. Thank you for your answers! Let's see if I can make this work the long way. $\endgroup$ – prulken May 19 '15 at 11:57
  • 1
    $\begingroup$ Rikard, how should we interpret the $f(m,l)$ in your summation? Are you really defining $f(r,\theta,\phi)$ as a function of the same $f(m,l)$, or should the second f be considered a parameter? In which case you should probably give it another name to avoid confusion... $\endgroup$ – MarcoB May 19 '15 at 13:23
2
$\begingroup$

Is it not just this?

g[r_,θ_,ϕ_] := 
  Sum[Sum[f[l, m]  r^l SphericalHarmonicY[l, m, θ, ϕ], {m, -l, l}], {l, 0, ∞}]
$\endgroup$
  • $\begingroup$ It is not, because you have a function g defined in terms of f. And OP has f` defined in terms of f. $\endgroup$ – Sektor May 19 '15 at 13:18
  • 1
    $\begingroup$ @Sektor well I did wonder about that too. I wonder in particular if the OP actually meant that as you interpret it, or whether the $f^m_l$ is just a parameter... $\endgroup$ – MarcoB May 19 '15 at 13:26
  • $\begingroup$ Sorry, I did not fully analyse this equation as I just chose it to serve as an example of my more general question. Now that you point it out, perhaps it wasn't the best of examples because of this ambiguity. I meant it in the way that I believe you have interpreted it. f(m,l) should be thought of as a parameter that is dependent on the current index of the sum. Not that f is defined in terms of f. Thank you for your code! This one in particular yields 0 as all partial derivatives, but that equation is not what I'm working with after all. To simply use f[l,m] is what I was looking for. $\endgroup$ – prulken May 19 '15 at 14:10
  • 3
    $\begingroup$ The whole beastie is expressible as a single sum: Sum[f[l, m] r^l SphericalHarmonicY[l, m, θ, ϕ], {l, 0, ∞}, {m, -l, l}]. Note the Mathematica convention of having the outermost iterator come first. $\endgroup$ – J. M. is in limbo May 19 '15 at 15:18

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.