Message Boards Message Boards

0
|
5928 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Perform a numerical integration in at table with NIntegrate?

Posted 5 years ago

I have run into a problem with a table of numerical integration results. The code that creates the apparent bug is

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];
Table[NIntegrate[
  v[xx, yy], {x, y, z} \[Element] 
   re], {xx, .85, .95, .1}, {yy, .85, .95, .1}]

For xx=.95 and yy=.85, these values are not passed to the integration routine and the resulting table is

{{16.6953, 16.2125}, {NIntegrate[v[xx, yy], {x, y, z} \[Element] re], 
15.8431}}

I do not get a similar error if I do the equivalent integration in cylindrical coordinates

v1[x0_, y0_, \[Theta]_, x_] := 
  1/Sqrt[(x - x0)^2 + (r[x] Cos[\[Theta]] - y0)^2 + 
     r[x]^2 Sin[\[Theta]]^2];
Table[NIntegrate[
  v1[xx, yy, \[Theta], x] r[x] Sqrt[1 + (x/2)^2/(4 - x^2)], {x, -2, 
   2}, {\[Theta], 0, 
   2 \[Pi]}], {xx, .85, .95, .1}, {yy, .85, .95, .1}]

for which the resulting table is

{{16.6953, 16.2125}, {16.6037, 15.8431}}
POSTED BY: Mike Luntz

Hello Mike,

I do not think the problem is that values are not passed; if you use Integrate instead of NIntegrate, you see, what is going on:

Table[Integrate[v[xx, yy], {x, y, z} \[Element]  re], {xx, .85, .95, .1}, {yy, .85, .95, .1}]

enter image description here

For some reason this can not be evaluated to a numeric value. Maybe this rather has to do with ImplicitRegion: If one makes just a tiny change in the definition of re, e.g.

re = ImplicitRegion[x^2/4.00000001 + y^2 + z^2 == 1.0, {x, y, z}];

then it seems to work. But this of course is not really a satisfying answer/explanation.

Regards -- Henrik

POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract