\begingroup

通过运行此代码

v = 1/2 (1 - Sum[(2 l + 1)/l * LegendreP[l + 1, 0] * LegendreP[l, Cos[θ]] * r^l, {l, 1, Infinity}]);
e = -Grad[v, {r, θ, φ}, "Spherical"];
d = FullSimplify[Div[e, {r, θ, φ}, "Spherical"]];
Print[d];

我明白了

(2*r*Sum[(1 + 2*l)*r^(-1 + l)*LegendreP[l, Cos[\[Theta]]]*LegendreP[1 + l, 0], {l, 1, Infinity}] + r^2*Sum[(1 + 2*l)*(-r^(-2 + l) + l*r^(-2 + l))*LegendreP[l, Cos[\[Theta]]]*LegendreP[1 + l, 0], {l, 1, Infinity}] + Cot[\[Theta]]*Sum[-(((1 + 2*l)*r^l*LegendreP[1 + l, 0]*((-1 - l)*Cos[\[Theta]]*LegendreP[l, Cos[\[Theta]]] + (1 + l)*LegendreP[1 + l, Cos[\[Theta]]])*Sin[\[Theta]])/(l*(-1 + Cos[\[Theta]]^2))), {l, 1, Infinity}] + Sum[-(((1 + 2*l)*r^l*Cos[\[Theta]]*LegendreP[1 + l, 0]*((-1 - l)*Cos[\[Theta]]*LegendreP[l, Cos[\[Theta]]] + (1 + l)*LegendreP[1 + l, Cos[\[Theta]]]))/(l*(-1 + Cos[\[Theta]]^2))) - (2*(1 + 2*l)*r^l*Cos[\[Theta]]*LegendreP[1 + l, 0]*((-1 - l)*Cos[\[Theta]]*LegendreP[l, Cos[\[Theta]]] + (1 + l)*LegendreP[1 + l, Cos[\[Theta]]])*Sin[\[Theta]]^2)/(l*(-1 + Cos[\[Theta]]^2)^2) - ((1 + 2*l)*r^l*LegendreP[1 + l, 0]*Sin[\[Theta]]*(-((-1 - l)*LegendreP[l, Cos[\[Theta]]]*Sin[\[Theta]]) - ((-1 - l)*Cos[\[Theta]]*((-1 - l)*Cos[\[Theta]]*LegendreP[l, Cos[\[Theta]]] + (1 + l)*LegendreP[1 + l, Cos[\[Theta]]])*Sin[\[Theta]])/(-1 + Cos[\[Theta]]^2) - ((1 + l)*((-2 - l)*Cos[\[Theta]]*LegendreP[1 + l, Cos[\[Theta]]] + (2 + l)*LegendreP[2 + l, Cos[\[Theta]]])*Sin[\[Theta]])/(-1 + Cos[\[Theta]]^2)))/(l*(-1 + Cos[\[Theta]]^2)), {l, 1, Infinity}])/(2*r^2)

我认为应该是0

我认为主要问题是1 - Cos[x]^2无法转换为Sin[x]^2。如果 Mathematica 无法自动完成,我希望手动完成。我该如何实现?

\endgroup


最佳答案
4

\begingroup

问题似乎是无法访问被加数Simplify

simplifySummand = Sum[s_, i__] :> With[{ss = Simplify[s]}, Sum[ss, i]];

v = 1/2 (1 - 
     Sum[(2 l + 1)/l*LegendreP[l + 1, 0]*LegendreP[l, Cos[\[Theta]]]*
       r^l, {l, 1, Infinity}]);
e = -Grad[v, {r, \[Theta], \[CurlyPhi]}, "Spherical"] /. 
   simplifySummand;
d = Simplify[
  Div[e, {r, \[Theta], \[CurlyPhi]}, "Spherical"] /. simplifySummand]

替代方法:

v = 1/2 (1 - 
     Sum[(2 l + 1)/l*LegendreP[l + 1, 0]*LegendreP[l, Cos[\[Theta]]]*
       r^l, {l, 1, Infinity}]);
e = -Grad[v, {r, \[Theta], \[CurlyPhi]}, "Spherical"];
d = Simplify[
   Div[e /. Sum -> Inactive[Sum], {r, \[Theta], \[CurlyPhi]}, 
    "Spherical"]];
d = Activate[d]

\endgroup

\begingroup

不确定为什么会有这么多的答案,当发生这种情况时:

Simplify[1 - Cos[x]^2]

(*  Sin[x]^2  *)

\endgroup

1

  • \begingroup
    不确定为什么会有这么多答案,我猜是因为没有人尝试过这个Simplify命令:)
    \endgroup


    – 

\begingroup

TrigFactor[1 - Cos[x]^2]

22\sin ^2(x)

\endgroup

\begingroup

在 Windows 14.1 中

Simplify[Simplify[1 - Cos[x]^2 // TrigToExp] // ComplexExpand]

Sin[x]^2

\endgroup