# How can I make Mathematica compute an operator?

I would like Mathematica to write down the Laplace-Beltrami operator in $R^N$ $$\Delta f = \frac{\partial^2 f}{\partial r^2} + \frac{N-1}{r} \frac{\partial f}{\partial r} + \frac{1}{r^2} \delta f,$$ $$\delta = \sum\limits_{j = 1}^{N - 1} {\frac{1} {{q_j \left( {\sin \theta _j } \right)^{N - j - 1} }}\frac{\partial } {{\partial \theta _j }}\left( {\left( {\sin \theta _j } \right)^{N - j - 1} \frac{\partial } {{\partial \theta _j }}} \right)} ,$$ $$\begin{array}{*{20}c} {q_1 = 1,} & {q_j = \left( {\sin \theta _1 \sin \theta _2 \cdots \sin \theta _{j - 1} } \right)^2 ,} & {j = 2, \ldots ,N - 1} \\ \end{array}$$ as a function of $N$, i.e. I want to specify $N$ and compute the symbolic sum of $\delta$. I tried with

q[1] := 1

q[j_] := (Product[Sin[Subscript[θ, i]], {i, 1, j - 1}])^2

δ[N_] :=
Sum[1/(q[j] (Sin[Subscript[θ, j]])^(N - j - 1)) \!$$\*SubscriptBox[\(∂$$,
SubscriptBox[$$θ$$, $$j$$]]$$( \*SuperscriptBox[\((Sin[ \*SubscriptBox[\(θ$$, $$j$$]])\), $$N - j - 1$$]\
\*SubscriptBox[$$∂$$,
SubscriptBox[$$θ$$, $$j$$]])\)\), {j, 1, N - 1} ]


but it does not work:

Syntax::sntxi: Incomplete expression; more input is needed.

Anyone has any idea?

Thanks

• Please do not post code as LaTeX. Post it in a way that it can be copied and pasted back to Mathematica. Aug 25, 2016 at 15:14
• Note that you cannot use N, it's a built-in. Aug 25, 2016 at 15:21
• Also, see this, and this. Aug 25, 2016 at 15:23
• I will recommend checking prior MSE posts related to this topic. Among other things, Product is not going to be useful because it assumes commuting factors. Aug 25, 2016 at 15:42
• Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– user9660
Aug 25, 2016 at 18:04

The partial derivatives are causing the problems in your above code. If you realy just want to write it down here is a version that just prints the definition:

\[Delta][N_] :=
Sum[Row[{1/(q[j] Sin[Subscript[\[Theta], j]]^(N - j - 1)), (
"\[PartialD]")/Subscript["\[PartialD]\[Theta]", j], "(",
Sin[Subscript[\[Theta], j]]^(N - j - 1), ("\[PartialD]")/
Subscript["\[PartialD]\[Theta]", j], ")"}], {j, 1, N - 1} ]


This will create a sum of terms which can not be manipulated algebraically by mathematica since they are row expressions.

• Thank you Steil, that was what I was looking for. Aug 25, 2016 at 19:37