# Potential from a rather complicated distribution

1. Sep 5, 2015

### treynolds147

1. The problem statement, all variables and given/known data
A charge distribution has the form $\rho=-\frac{q}{4\pi ra^{2}}(1-\frac{r^{2}}{a^{2}})\exp(-\frac{r^{2}}{2a^{2}})$. Compute the total charge Q, the electric field E, the potential $\Phi$, and the electrostatic energy W for this charge distribution.

2. Relevant equations
$\Phi=\frac{1}{4\pi\epsilon_{0}}\int\rho(\mathbf{x}')\frac{1}{|\mathbf{x}-\mathbf{x}'|}\,\mathrm{d}^{3}x'$

3. The attempt at a solution
This one is pretty straightforward in what it's asking. I calculate the total charge alright, but then I try calculating the potential, and that's where I start getting nonsense. To me, the charge distribution should be independent of angle, so I can just use $\frac{1}{r}$ in place of $\frac{1}{|\mathbf{x}-\mathbf{x}'|}$. Using spherical coordinates, I end up with $-\frac{1}{4\pi\epsilon_{0}}\frac{q}{a^{2}}\int_{0}^{\infty}(1-\frac{r^{2}}{a^{2}})\exp(-\frac{r^{2}}{2a^{2}})\,\mathrm{d}r$, which ends up giving me a constant potential of $(\frac{\sqrt{2}}{2}-1)\frac{\sqrt{\pi}}{4\pi\epsilon_{0}}\frac{q}{a}$. And of course, that gives me a zero electric field upon taking the gradient, which can't be right at all! I'm really not sure where I'm going wrong here, any ideas?

2. Sep 5, 2015

### TSny

More explicitly, this would read $\Phi(\mathbf{x})=\frac{1}{4\pi\epsilon_{0}}\int\rho(\mathbf{x}')\frac{1}{|\mathbf{x}-\mathbf{x}'|}\,\mathrm{d}^{3}x'$

This isn't correct. $\mathbf{x}'$ is the integration variable and $\mathbf{x}$ is some fixed point at which you are calculating the potential. For a general $\mathbf{x}$, the integral looks pretty messy.

I would suggest getting the electric field first and then getting the potential from the field.

3. Sep 6, 2015

### treynolds147

Is it at all possible to obtain the electric field from $\nabla\cdot\mathbf{E}=\rho/\epsilon_{0}$? I'd rather avoid having to work out the field from the proper integral definition if I can help it.

4. Sep 6, 2015

### TSny

Yes. But you might find it easier to work with the integral form of Gauss's law.

5. Sep 6, 2015

### treynolds147

Well I worked out from Gauss's law that the electric field would just be $-\frac{1}{4\pi\epsilon_{0}}\frac{q}{r^{2}}$. What's striking to me about this result though is that I get different energies depending on which equation I use. If I use $W=\frac{\epsilon_{0}}{2}\int|\mathbf{E}|^{2}\,\mathrm{d}^{3}x'$ for the energy stored in the field, I end up getting an infinite energy. However, using $W=\frac{1}{2}\int\rho(\mathbf{x}')\Phi(\mathbf{x}')\,\mathrm{d}^{3}x'$ will give me an energy of zero. That doesn't seem right at all, is there some nuance between these equations that explains the discrepancy?

6. Sep 6, 2015

### TSny

I don't think this is correct. Can you show more detail of how you used Gauss's law to get this result?

7. Sep 6, 2015

### treynolds147

Ah, for some reason I had blindly plugged in the total charge into the RHS of Gauss's law. Being a bit more careful I get
$\oint_{S}\mathbf{E}\cdot\mathrm{d}\mathbf{A}=\frac{1}{\epsilon_{0}}\int\rho(\mathbf{x}')\,\mathrm{d}^{3}x'$,
and upon using the charge distribution the RHS becomes
$\oint_{S}\mathbf{E}\cdot\mathrm{d}\mathbf{A}=-\frac{q}{a^{2}\epsilon_{0}}(\exp(\frac{-r^{2}}{2a^{2}})(a^{2}+r^{2})-a^{2})$,
and so
$E_{r}=-\frac{q}{4\pi\epsilon_{0}r^{2}a^{2}}(\exp(\frac{-r^{2}}{2a^{2}})(a^{2}+r^{2})-a^{2})$.
Of course, just slap an r hat on that to make it the actual electric field. Nevertheless, this still gives me an infinite energy when I integrate $|\mathbf{E}|^{2}$ so I must be doing something wrong.

8. Sep 6, 2015

### TSny

Your expression for the field looks correct to me. I don't think it will give infinite energy.

Last edited: Sep 6, 2015
9. Sep 6, 2015

### treynolds147

Well upon squaring the field, I get $\frac{\epsilon_{0}}{2}\int|\mathbf{E}|^{2}\,\mathrm{d}^{3}x'=\frac{q^{2}}{8\pi\epsilon_{0}a^{4}}\int\frac{1}{r^{4}}(a^{4}(1-e^{-r^{2}/2a^{2}})+r^{4}e^{-r^{2}/2a^{2}})r^{2}\,\mathrm{d}r$ (where I already integrated over the solid angle). The term $\int\frac{1}{r^{2}}(a^{4}(1-e^{-r^{2}/2a^{2}}))\,\mathrm{d}r$ does not converge.

10. Sep 7, 2015

### TSny

I don't see how you are getting your expression for $|\mathbf{E}|^2$. Shouldn't $e^{-r^2/a^2}$ appear somewhere due to squaring $e^{-r^2/2a^2}$?

Also, when you are integrating a sum of terms, it is possible for the integral of individual terms to diverge even though the integral of the entire integrand converges.

Last edited: Sep 7, 2015
11. Sep 7, 2015

### treynolds147

Ah, you're totally right about $e^{-r^{2}/a^{2}}$, I forgot to square that for some reason. $|\mathbf{E}|^{2}$ should be $e^{-r^{2}/a^{2}}(a^{4}+r^{4}+2a^{2}r^{2})-2e^{-r^{2}/2a^{2}}(a^{4}+r^{2}a^{2})+a^{4}$.

At any rate, is there any particular rule for when it's safe to ignore a divergent term in an integral? Because that last $a^{4}/r^{2}$ seems to be the main culprit of the divergence while the rest of the integrand gives some crazy value of $-\frac{(2^{5/2}-5)\sqrt{\pi}a^{3}}{4}$. (I don't have any access to proper math software so I'm trying to make due with what I can to evaluate this wonderful integral.)

12. Sep 7, 2015

### TSny

Ugh, it will be tedious to do by hand. In a case like this, I would integrate the individual terms as indefinite integrals and then collect the resultant expressions. Then evaluate at the limits. For the lower limit you would need to take the limit of the entire expression as r→ 0. For some of the indefinite integrals you will get something involving the error function. But the error function has nice values at 0 and infinity.

Mathematica just pops out a simple result for the entire definite integral.

Indefinite integrals can be done here: http://www.wolframalpha.com/input/?i=integrate+Exp[-r^2/a^2]

Last edited: Sep 7, 2015
13. Sep 7, 2015

### treynolds147

For the indefinite integral I get $\frac{1}{15r^{2}}(3a^{5}+ae^{-r^{2}/a^{2}}(3a^{4}+8a^{2}r^{2}-r^{4})+e^{-r^{2}/2a^{2}}(-6a^{5}-8a^{3}r^{2}+8ar^{4})-\sqrt{\pi}r^{5}\text{erf}\frac{r}{a}+4\sqrt{2\pi}r^{5}\text{erf}(\frac{r}{\sqrt{2}a}))$. Wolframalpha isn't really able to compute between the limits because the expression becomes too long but oh well, I'll settle for a more general expression.
I figured this problem would be nasty but not this nasty!

14. Sep 7, 2015

### TSny

I don't get your expression for the indefinite integral. For example, I find (with the help of Mathematica !) that all of the integrated terms that produce the error function cancel out except for one term that yields $\frac{\pi^{3/2}}{a}\text{erf}(r/a)$. Here I have left out the overall factor of $\frac{q^2}{16\pi^2\epsilon_0^2}$ as well as the factor $\frac{\epsilon_0}{2}$ for the energy, but I did include the factor of $4\pi$ for the integration over spherical shells.

Besides the erf term, everything else reduces to 4 other terms as shown below. (I don't think I'm giving away too much to show you what I get. I could have an error!)

Anyway, it looks very tedious to do by hand or just using integral tables.

#### Attached Files:

• ###### messy integral.png
File size:
1,022 bytes
Views:
50
Last edited: Sep 7, 2015