Why can't math software solve the integral $\int\limits_{-a/2}^{a/2}\int\limits_{-a/2}^{a/2}\frac{1}{\sqrt{x^2+y^2+z^2}}dxdy$?

245 Views Asked by At

Consider the task of finding the electric field at a height $z$ above the center of a square sheet of side a carrying uniform charge $\sigma$.

I am asking this in the math stack exchange because electromagnetism at this stage is essentially applied calculus and my question is mainly about an integral (assuming the motivating reasoning below explaining how I reached the integral is correct).

In fact, to cut to the chase, my question is why can my math software (Maple) solve the indefinite integral

$$\iint\frac{1}{\sqrt{x^2+y^2+z^2}}dxdy\tag{0}$$

pretty quickly

enter image description here

but not the definite integral

$$\int\limits_{-a/2}^{a/2}\int\limits_{-a/2}^{a/2}\frac{1}{\sqrt{x^2+y^2+z^2}}dxdy\tag{11}$$ ?

Context for how I reached this integral

I am interested specifically in finding the electric field $\vec{E}$ at the point $P$ in the picture below by first calculating the electric potential at that point (I have already done this calculation in a different way, by integrating the electric field at point $P$ generated by infinitesimal pieces of the square sheet, but I am not interested in that calculation in the current question).

enter image description here

By electric potential I mean $V$ defined by

$$\vec{E}=-\nabla V\tag{1}$$

Just to remember where this comes from, given a single point charge $q$ at position $\vec{r}$, the electric field at $\vec{r}_p$ is

$$\vec{E}(\vec{r}_p)=k_e\frac{q}{r^2}\hat{r}\tag{2}$$

where

$$r=\lVert \vec{r}_p-\vec{r} \rVert\tag{3}$$

$$\hat{r}=\frac{\vec{r}}{r}=\frac{\vec{r}_p-\vec{r}}{\lVert \vec{r}_p-\vec{r} \rVert}\tag{4}$$

It can be shown that the curl of $\vec{E}$ is $0$ and hence that $\vec{E}$ is a gradient. By convention, we call a negative potential function of $\vec{E}$ by the name $V$ and thus we have (1).

Here is what I came up with

$$dV=\frac{k_edq}{r}\tag{5}$$

$$\vec{r}_p=\langle 0,0,z\rangle\tag{6}$$

$$\vec{r}=\langle x,y,0\rangle\tag{7}$$

$$\vec{r}_p-\vec{r}=\langle -x,-y,z\rangle\tag{8}$$

$$r = \sqrt{x^2+y^2+z^2}\tag{9}$$

$$dq=\sigma dA=\sigma dxdy\tag{10}$$

Hence

$$V(\vec{r}_p)=k_e\sigma\int\limits_{-a/2}^{a/2}\int\limits_{-a/2}^{a/2}\frac{1}{\sqrt{x^2+y^2+z^2}}dxdy\tag{11}$$

I usually use software (Maple) to solve integrals. The downside is that I don't spend too much time anymore thinking about difficult integrals or why we can or can't solve an integral.

The integral in (11) is one integral that Maple seems not to be able to solve, and my question is why?

2

There are 2 best solutions below

0
On

For what it's worth as a comparison, in Mathematica:

Integrate[1/Sqrt[x^2 + y^2 + z^2], x, y]

1/2 (-2 z ArcTan[(x y)/(z Sqrt[x^2 + y^2 + z^2])] - x Log[1 - y/Sqrt[x^2 + y^2 + z^2]] +
x Log[1 + y/Sqrt[x^2 + y^2 + z^2]] + 2 y Log[x + Sqrt[x^2 + y^2 + z^2]])

Integrate[1/Sqrt[x^2+y^2+z^2], {x,-a/2,a/2}, {y,-a/2,a/2}, Assumptions -> {a > 0, z > 0}]

-4 z ArcCot[(2 Sqrt[2] z Sqrt[a^2 + 2 z^2])/a^2] - a (Log[a^2 + 4 z^2] +
Log[-a + Sqrt[2] Sqrt[a^2 + 2 z^2]] - 3 Log[a + Sqrt[2] Sqrt[a^2 + 2 z^2]])

While, using Rubi packages specialized in antiderivatives:

Int[Int[1/Sqrt[x^2 + y^2 + z^2], x], y]

-z ArcTan[(x y)/(z Sqrt[x^2 + y^2 + z^2])] +
y ArcTanh[x/Sqrt[x^2 + y^2 + z^2]] +
x ArcTanh[y/Sqrt[x^2 + y^2 + z^2]]

Int[Int[1/Sqrt[x^2 + y^2 + z^2], {x, -a/2, a/2}], {y, -a/2, a/2}]

-4 z ArcTan[a^2/(2 Sqrt[2] z Sqrt[a^2 + 2 z^2])] +
4 a ArcTanh[a/(Sqrt[2] Sqrt[a^2 + 2 z^2])]

In all four cases the results were obtained in a fraction of a second or so.

On the other hand, it must however be taken into account that the antiderivative implies "only" mechanical transformations (so much so that Maple's antiderivative contains a forest of $\sqrt{-z^2}$, unusable in $\mathbb{R}$), while integration over intervals implies a myriad more checks on the validity of the final result, therefore it's always good to direct the calculation by indicating the range of variability of the parameters.

0
On

That would be because you're not telling Maple everything you know, and thus asking a much harder problem than you mean to. So if you're precise:

int(int(1/sqrt(x^2 + y^2 + z^2), x=-a/2..a/2), y=-a/2..a/2) assuming a>0, z::real;
                /                  (1/2)\  
            2   |     /   2      2\     |  
  -signum(z)  ln\-a + \2 a  + 4 z /     / a

                    /                 (1/2)\  
                2   |    /   2      2\     |  
     + signum(z)  ln\a + \2 a  + 4 z /     / a

                  2        /       a        \  
     + 2 signum(z)  arcsinh|----------------| a
                           |           (1/2)|  
                           |/ 2      2\     |  
                           \\a  + 4 z /     /  

                  /                     2      2\            
                  |2 I a signum(z) z + a  + 4 z |            
     - 2 I arctanh|-----------------------------| signum(z) z
                  |                   (1/2)     |            
                  |      /   2      2\          |            
                  \    a \2 a  + 4 z /          /            

                            /    2                        2\  
                            |-4 z  + 2 I a signum(z) z - a |  
     - 2 I signum(z) arctanh|------------------------------| z
                            |                    (1/2)     |  
                            |       /   2      2\          |  
                            \     a \2 a  + 4 z /          /  

     - 2 signum(z) z Pi

CASes are not magic and won't use information that you don't tell them!