4

Problem Given N 3-dimensional points which are {$p_1,p_2,..,p_n$} where $p_i = (x_i,y_i,z_i) $ . I have to find the value of the formula

enter image description here

for some given constant integers P, Q, R, S. all numbers are between 1 and M ( = 100).

I need an efficient method for the calculation for this formula

Please give any idea about how to reduce complexity better than $O(n^2)$

v78
  • 2,803
  • 21
  • 44
  • What are `P, Q, R, S` and their expressions like `Q(Yi - Yj)` supposed to be? – RBarryYoung Sep 12 '15 at 18:12
  • Alos, what does this have to do with FFT and Convolution? – RBarryYoung Sep 12 '15 at 18:13
  • Sorry for the confusion, Q(Yi-Yj) is the product of Q and (Yi-Yj) and now corrected. – v78 Sep 12 '15 at 18:14
  • It appears that that expression can be evaluated fastly using convolution or fft etc . There is no specific reason – v78 Sep 12 '15 at 18:18
  • A) I see no reason to assume that FFT/convolution would be effective here , but B) I could be wrong because this is really a site for practical programming question rather than theoretical ones. Yes, this question is a bit of both, but you might get a better esponse at one of CompSci sites: such as http://cs.stackexchange.com. – RBarryYoung Sep 12 '15 at 18:22
  • Duplicate: http://math.stackexchange.com/questions/1425772/formula-reduction-to-some-physical-interpretation – Paul R Sep 13 '15 at 06:30
  • Duplicate: http://mathoverflow.net/questions/217692/reduction-to-some-physical-interpretation-of-this-formula – Paul R Sep 13 '15 at 06:31
  • Duplicate: http://codegolf.stackexchange.com/questions/57322/reduction-to-some-physical-interpretation-of-this-formula – Paul R Sep 13 '15 at 06:31

2 Answers2

2

Assuming that all coordinates are between 1 and 100, then you could do this via:

  1. Compute 3d histogram of all points O(100*100*100) operations.

  2. Use FFT to compute convolution of histograms along each of the 3 axes

This will result in a 3d histogram of 3d vectors. You can then iterate over this histogram to compute your desired value.

The main point is that computing a convolution of histogram of values computes the histogram of pairwise differences of those values. This can also be used to compute a histogram of sums of values in a similar way.

Peter de Rivaz
  • 33,126
  • 4
  • 46
  • 75
0

Your problem looks like a particle potential problem (the kind you have in electrodynamics for instance), where you have to find some "potential" at the location (x_j, y_j) by summing all elementary contributions from the i-th particles.

The fast algorithm specific for this class of problems is the Fast Multipole method. Look up this keyword, but I must warn you it is by no means simple to understand or implement. Strong math background needed.

Emerald Weapon
  • 2,392
  • 18
  • 29