Unless I am totally screwed up, the field inside a surface with uniform charge density should be 0 so the potential should be a constant. But when I attempt to numerically compute the potential interior to a surface I do not get a constant. The integration does return some error messages, but the result of the integration follows a regular shape so I am guessing that the error messages do not have a major impact on the result. The calculation I am attempting is
<< ComputerArithmetic`
re = ImplicitRegion[x^2/4 + y^2 + z^2 == 1.0, {x, y, z}];
v[x0_, y0_] := 1/Sqrt[(x - x0)^2 + (y - y0)^2 + z^2];
pot = Table[{xx, yy,
If[yy > Sqrt[1 - xx^2/4], NaN,
NIntegrate[v[xx, yy], {x, y, z} \[Element] re]]}, {xx, .05,
1.95, .1}, {yy, .05, 1.95, .1}];
The results of this calculation vary smoothly between a max of about 17 to a min of about 14.7.
In addition to this confusing result I think I have detected a bug in the way the integration routine mates with the Table function. Computing
NIntegrate[v[.85, .95], {x, y, z} \[Element] re]
returns a result. But when part of a table, the arguments .85 and .95 are apparently not passed to the function v.
Table[NIntegrate[
v[xx, yy], {x, y, z} \[Element]
re], {xx, .75, .95, .1}, {yy, .75, .95, .1}]
returns
NIntegrate::inumri: The integrand 1/Sqrt[(-0.95+x)^2+(-0.85+y)^2+z^2] has evaluated to Overflow, Indeterminate, or Infinity for all sampling points in the region with boundaries {{0.625,0.75},{0.999999999999999999990527764909997233148869688962838439242343509680,0.999999999999999980708641734607903536052376492842767408867549327610}}.
NIntegrate::inumr: The integrand 1/Sqrt[(x-xx)^2+(y-yy)^2+z^2] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,1},{0,1}}.