problem with integrating an interpolated list

*To*: mathgroup at smc.vnet.net*Subject*: [mg102841] problem with integrating an interpolated list*From*: Tobias Baumann <ttobsen at hotmail.com>*Date*: Sat, 29 Aug 2009 06:31:19 -0400 (EDT)

Hi I've an problem with integrating an interpolated list. I use Mathematica 7 and I'm a pretty newbie. I generate a list of lists like this List2D = {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 5, 1, 0, 0}, {0, 0, 1, 4, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}; With MatrixForm it looks like 000000 000000 005100 001400 000000 000000 Now i make a ListInterpolation first order MyFunction = ListInterpolation[List2D, {{0, 6}, {0, 6}}, InterpolationOrder -> 1]; After this I norm the new Function to value 1. So I integrate NormFactor = Integrate[MyFunction[x, y], {x, 0, 6}, {y, 0, 6}] This works very well, the result is 396/25. For the next step, I prepare a new function, to make shure that outside of the interpolaten range the function is 0. In this step I also normalize "MyFunction": NewFunction[xy_List] := 0 /; xy[[1]] < 2 NewFunction[xy_List] := 0 /; xy[[2]] < 2 NewFunction[xy_List] := 0 /; xy[[1]] > MaxResolution - 2 NewFunction[xy_List] := 0 /; xy[[2]] > MaxResolution - 2 NewFunction[xy_List] := MyFunction [xy[[1]], xy[[2]]]/NormFactor Now, if I make an integration of "NewFunction" ist works really good if I try Output = Integrate[NewFunction[{x, y}], {x, -10, 10}, {y, -10, 10}]; Output Out = 1 But I can't integrate something like this Output = Integrate[NewFunction[{x+2, y+2}], {x, -10, 10}, {y, -10, 10}]; Output Out = 25/396 Integrate[InterpolatingFunction[{{0,6}, {0,6}}, <>][2 + x, 2 + y],{x,-10, 10}, {y,-10,10}] In this case the Output is no numerical result. I allways get the inputstring back (in a bit more graphical way). The problem is that I need to transform the x and y coordinate. Numerical integration is also no option. I get the right solution, but with the message "NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >>" It's also too slow for my project. I hope someone has any ideas. Thanks a lot, Tobias Complete Code for trying at home List2D = {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 5, 1, 0, 0}, {0, 0, 1, 4, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}; List2D // MatrixForm MaxResolution = Length[List2D]; MyFunction = ListInterpolation[List2D, {{0, MaxResolution}, {0, MaxResolution}}, InterpolationOrder -> 1]; NormFactor = Integrate[MyFunction[x, y], {x, 0, 6}, {y, 0, 6}] NewFunction[xy_List] := 0 /; xy[[1]] < 2 NewFunction[xy_List] := 0 /; xy[[2]] < 2 NewFunction[xy_List] := 0 /; xy[[1]] > MaxResolution - 2 NewFunction[xy_List] := 0 /; xy[[2]] > MaxResolution - 2 NewFunction[xy_List] := MyFunction [xy[[1]], xy[[2]]]/NormFactor Output = Integrate[ NewFunction[{x + 2, y + 2}], {x, -10, 10}, {y, -10, 10}]; Output