class Malge::ErrorFittedFunction::AXInv2

Assumed y = a /(x**2)

Public Instance Methods

equation() click to toggle source
# File lib/malge/errorfittedfunction/axinv2.rb, line 13
def equation
  sprintf("%f / (x**2)", * @coefficients)
end
expected_error(x) click to toggle source
# File lib/malge/errorfittedfunction/axinv2.rb, line 17
def expected_error(x)
  @coefficients[0] / (x**2)
end
fit() click to toggle source
# File lib/malge/errorfittedfunction/axinv2.rb, line 8
def fit
  inv_pairs =  @diff_abs_pairs.map {|pair| [1.0/(pair[0]**2), pair[1]]}
  @coefficients = Malge::LeastSquare.least_square_proportional(inv_pairs)
end
most_strict_pair() click to toggle source
# File lib/malge/errorfittedfunction/axinv2.rb, line 27
def most_strict_pair
  @raw_pairs.max_by{ |pair| pair[0] }
end
x(y) click to toggle source

y = a/x x = a/y

# File lib/malge/errorfittedfunction/axinv2.rb, line 23
def x(y)
  return Math::sqrt(@coefficients[0] / y)
end