Re: ContourPlot3D and NIntegrate

• To: mathgroup at smc.vnet.net
• Subject: [mg100989] Re: ContourPlot3D and NIntegrate
• From: antononcube <antononcube at gmail.com>
• Date: Fri, 19 Jun 2009 20:47:02 -0400 (EDT)
• References: <h0bu15\$8lu\$1@smc.vnet.net>

```Hi,

If you use the following defintion

VV[x_?NumericQ, y_?NumericQ, z_?NumericQ] :=
Module[{u, phi},
NIntegrate[(x^2 + y^2 + z^2)^(-3)*u*phi, {u, 0, 1}, {phi, 0, 2 Pi},
Method -> {Automatic, SymbolicProcessing -> 0}, PrecisionGoal ->
6]]

then the plot computation

ContourPlot3D[  VV[x, y, z], {x, 1, 2}, {y, 1, 2}, {z, 1, 2}] //
AbsoluteTiming

takes 44 seconds on my 2 year old MacBook Pro

Note that I have put the symbolic processing time to zero. You can
further see if using smaller precision gives satisfactory and faster
results for you.

Anton Antonov

On Jun 5, 4:09 pm, Henning Heiberg-Andersen
<henning.heibergander... at gmail.com> wrote:
> Hi,
>
> I don't understand what goes wrong in this sequence:
>
> *
>
> In[1]:=VV[x_,y_,z_]:=
>
> Module[{u,phi},NIntegrate[(x^2+y^2+z^2)^(-3)*u*phi,{u,0,1},{phi,0,2Pi}]
>
> ]
>
> In[2]:=
>
> ContourPlot3D[VV[x,y,z],{x,1,2},{y,1,2},{z,1,2}],
>
> AND THEN:
>
> NIntegrate::inumr: The integrand \[NoBreak](phi\$12637167
> u\$12637167)/(x^2+y^2+z^2)3\[NoBreak] has evaluated to non-numerical value=
s
> for all sampling points in the region with boundaries
> \[NoBreak]{{0,1},{0,6.28319}}\[NoBreak].
> =87<http://reference.wolfram.com/mathematica/ref/message/NIntegrate/inu=
mr...>
>
> Can anybody help?
>
> Sincerely,
>
> Henning Heiberg-Andersen

```

• Prev by Date: My first calculator =)
• Next by Date: Re: Strange Behaviour: CellAutoOverwrite
• Previous by thread: ContourPlot3D and NIntegrate
• Next by thread: question on passing arguments in a function within BarChart