Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a huge data file which I need to do some analysis on it. The file is built in this way that for each 4 variables, there is a value of the function:

List={{x,y,z,w},f[x,y,z,w]}

A part of the real data is the following List:

tab={{{0.0001, 1., -1., 1.*10^-6}, 0.6704}, {{0.0001, 1., -0.85,3.98107*10^-6}, 0.964659}, {{0.0001, 1., -0.7,0.0000199526}, 0.491676}, {{0.0001, 1., -0.55, 0.0001}, 0.0974736}};

For each value of the x and y parameters, I need to NIntegrate with respect to z and w. If I could have the whole function wrt all parameters, f[x,y,z,t], I would do:

tab2=Flatten[Table[{{x,y},NIntegrate[f[x,y,z,w], {z,zmin,zmax},{w,wmin,wmax}]},{x,xmin,xmax},{y,ymin,ymax}],1];

and then I would Interpolate tab2 with respect to {x,y}:

final=Interpolation[tab2];

I have almost 4 million points, I can do the analysis in this way, but how can I be sure that the Interpolation function is a correct function, while there are too many approximations to make it? I know that Interpolation works for any n-dimension, but it won't be acurate anymore for more than 2 parameters. Is there a way that I do this kind of analysis without needning to Interpolate with respect to all parameters? For example is there a way that I can just Interpolate with respect to {z,w}, I do the Integration, then I Interpolate the result with respect to {x,y}?

share|improve this question
    
What kind of analysis do you want to do? –  belisarius Dec 3 '13 at 22:00
    
@belisarius As I wrote, I need to Integrate with respect to the third and forth variable, then at the end I need to have a function with respect to the first and second ones. If I could use Interpolation with respect to all variables, it could be easy to do it. But it's not possible to do that. –  ZKT Dec 4 '13 at 0:32
1  
Interpolation[tab] @@@ tab[[All, 1]] - tab[[All, 2]] // Abs // Total gives $3.33067 \times 10^{-16}$, so it looks like it works pretty well to me. "Problem with", "some analysis", "doesn't work well", "need to integrate wrt third and fourth variable", "at the end I need to have a function". These phrases are not meaningful to someone who does not already know what you are trying to accomplish. Sorry, but your question is too vague to be answerable in its present form. Please clarify. –  Oleksandr R. Dec 4 '13 at 2:02
    
@OleksandrR. I edited the question. Is it clear enough now or I need to add more details? –  ZKT Dec 4 '13 at 2:22
    
If X and Y coordinates are integers in all data then you can collect all {{x_,y_,,},_} subsets and make interpolation function for each subset. The result will be in this form, for example: f[x,y][z,w] –  Kamov Sergey Dec 4 '13 at 2:43

1 Answer 1

This is an opportunity for you to clarify your question or give a better example.

The coding example that you posted as non-working, does work:

tab = {{{1., 3., 7., 5.}, 1.85541}, {{1., 3., 8., 5.}, 1.76612}, {{1., 3., 7., 6.}, 1.99826}, 
       {{1., 3., 8., 6.}, 1.89112}, {{1., 4., 7., 5.}, 0.957483}, {{1., 4., 8., 5.}, 0.868198},
       {{1., 4., 7., 6.}, 1.10034}, {{1., 4., 8., 6.}, 0.993198}, {{2., 3., 7., 5.}, 4.85541}, 
       {{2., 3., 8., 5.}, 4.76612}, {{2., 3., 7., 6.}, 4.99826}, {{2., 3., 8., 6.}, 4.89112}, 
       {{2., 4., 7., 5.}, 3.95748}, {{2., 4., 8., 5.}, 3.8682}, {{2., 4., 7., 6.}, 4.10034}, 
       {{2., 4., 8., 6.}, 3.9932}};
f = Quiet@Interpolation[tab];
tab2 = Flatten[Table[{{x, y}, NIntegrate[f[x,y,z,w], {z,7,8}, {w,5,6}]}, {x, 1, 2}, {y, 3, 4}], 1]

(*
 {{{1, 3}, 1.87773}, {{1, 4}, 0.979805}, {{2, 3}, 4.87773}, {{2, 4}, 3.9798}}
*)
share|improve this answer
    
I edited the problem, putting a part of my real list. I also tried to explain my problem. My biggest worry is that I'm not sure the Interpolation wrt 4 parameters would work correctly and acurately. –  ZKT Dec 4 '13 at 4:26
    
@ZKT It should work "correctly and accurately" ... unless there is a bug (which of course can ever happen). Just use it and have a cross-checking contraption at hand. –  belisarius Dec 4 '13 at 4:31
    
Thanks. My colleagues were complaining about my method, so I was trying to find another way for doing the analysis, to become sure about the results. –  ZKT Dec 4 '13 at 4:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.