MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: problem with integrating an interpolated list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103024] Re: problem with integrating an interpolated list
  • From: antononcube <antononcube at gmail.com>
  • Date: Fri, 4 Sep 2009 03:15:54 -0400 (EDT)
  • References: <h7b04r$d8$1@smc.vnet.net> <h7o85i$nht$1@smc.vnet.net>

On Sep 3, 7:57 pm, Harutyun Amirjanyan <amirjan... at gmail.com> wrote:
[...]
> WithNIntegrate, the nonsmooth behavior of InterpolatingFunction near
> the boundaries of pieces produces an error message and requires many
> recursive steps to evaluate accurately.

This is true and it is relevant given the definition of NewFunction.
Your statement also hints the solution of the problem Tobias has. We
need to define NewFunction as a piecewise function. Then NIntegrate
can use its piecewise pre-processing and gives quickly a result.


NNewFunction[x_, y_] :=
 Piecewise[{{0, x < 2}, {0, y < 0}, {0, x > MaxResolution - 2}, {0, y
> MaxResolution - 2}, {MyFunction[x, y], True}}]

In[74]:= NIntegrate[NNewFunction[x + 2, y + 2], {x, -10, 10}, {y, -10,
10}] // Timing

Out[74]= {0.142061, 11.0756}


These plots can be used for further validation and clarification:

Needs["Integration`NIntegrateUtilities`"]

Plot3D[NNewFunction[x + 2, y + 2], {x, -10, 10}, {y, -10, 10},
PlotPoints -> 50]

Plot3D[NewFunction[{x + 2, y + 2}], {x, -10, 10}, {y, -10, 10},
PlotPoints -> 50]

NIntegrateSamplingPoints@NIntegrate[NNewFunction[x + 2, y + 2], {x,
-10, 10}, {y, -10, 10}]



Anton Antonov




  • Prev by Date: Re: Mathematica 7.0.0 running on Mac OSX Snow Leopard ?
  • Next by Date: How do I assign variable names from a list of strings?
  • Previous by thread: Re: problem with integrating an interpolated list
  • Next by thread: how to solve the integer equation Abs[3^x-2^y]=1