Jabarkan sum_sq_x = 0 dari Korélasi dalam bahasa sunda

for i in 2 to N:

sweep = (i - 1.0) / i

delta_x = x[i] - méan_x

delta_y = y[i] - méan_y

sum_sq_x += delta_x * delta_x * sweep

sum_sq_y += delta_y * delta_y * sweep

sum_coproduct += delta_x * delta_y * sweep

méan_x += delta_x / i

méan_y += delta_y / i

pop_sd_x = sqrt( sum_sq_x / N )

pop_sd_y = sqrt( sum_sq_y / N )

cov_x_y = sum_coproduct / N

correlation = cov_x_y / (pop_sd_x * pop_sd_y)

For an enlightening experiment, check the correlation of {900,000,000 + i for i=1...100} with {900,000,000 - i for i=1...100}, perhaps with a few values modified.  Poor algorithms will fail.