Sha256: f6786117e9543882971b02f2c0ec1f575471d8e832e99a8ba2dbe3904e9845c4
Contents?: true
Size: 263 Bytes
Versions: 2
Compression:
Stored size: 263 Bytes
Contents
module Variation class LinearFunction def self.from_points pt_a, pt_b, abruptness = 0.5 slope = (pt_b[1] - pt_a[1]) / (pt_b[0] - pt_a[0]).to_f intercept = pt_a[1] - (slope * pt_a[0]) lambda do |x| (slope * x) + intercept end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
variation-0.2.1 | lib/variation/functions/linear_function.rb |
variation-0.2.0 | lib/variation/functions/linear_function.rb |