Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2_1_10) is shown here.
fit_logarithmic(xs, ys)
public
# File lib/minitest/benchmark.rb, line 265
def fit_logarithmic xs, ys
n = xs.size
xys = xs.zip(ys)
slnx2 = sigma(xys) { |x,y| Math.log(x) ** 2 }
slnx = sigma(xys) { |x,y| Math.log(x) }
sylnx = sigma(xys) { |x,y| y * Math.log(x) }
sy = sigma(xys) { |x,y| y }
c = n * slnx2 - slnx ** 2
b = ( n * sylnx - sy * slnx ) / c
a = (sy - b * slnx) / n
return a, b, fit_error(xys) { |x| a + b * Math.log(x) }
end