ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 08 Feb 2021 14:54:22 +0100Divergence of inverse squarehttps://ask.sagemath.org/question/55608/divergence-of-inverse-square/ Hello,
I tried to calculate the divergence of 1/r^2*e_r, but I got zero, where it should have been 4*pi*dirac_delta(r*e_r)
E.<r,th,ph>=EuclideanSpace(coordinates="spherical")
v=E.vector_field([1/r^2,0,0])
v.div().display()
Results is
E^3 --> R
(r, th, ph) |--> 0
Can this be considered as a bug?
Sun, 07 Feb 2021 00:15:43 +0100https://ask.sagemath.org/question/55608/divergence-of-inverse-square/Answer by eric_g for <p>Hello,</p>
<p>I tried to calculate the divergence of 1/r^2<em>e_r, but I got zero, where it should have been 4</em>pi<em>dirac_delta(r</em>e_r)</p>
<pre><code>E.<r,th,ph>=EuclideanSpace(coordinates="spherical")
v=E.vector_field([1/r^2,0,0])
v.div().display()
</code></pre>
<p>Results is </p>
<pre><code>E^3 --> R
(r, th, ph) |--> 0
</code></pre>
<p>Can this be considered as a bug? </p>
https://ask.sagemath.org/question/55608/divergence-of-inverse-square/?answer=55616#post-id-55616In the current implementation, vector fields are assumed to be smooth functions on their domain. The vector field that you have defined is not (actually, it is not even defined at $r=0$), so I would say this is not a bug.Sun, 07 Feb 2021 14:24:51 +0100https://ask.sagemath.org/question/55608/divergence-of-inverse-square/?answer=55616#post-id-55616Comment by curios_mind for <p>In the current implementation, vector fields are assumed to be smooth functions on their domain. The vector field that you have defined is not (actually, it is not even defined at $r=0$), so I would say this is not a bug.</p>
https://ask.sagemath.org/question/55608/divergence-of-inverse-square/?comment=55623#post-id-55623It would have been great, if it had given the dirac solution.Mon, 08 Feb 2021 14:54:22 +0100https://ask.sagemath.org/question/55608/divergence-of-inverse-square/?comment=55623#post-id-55623