Sha256: 9744c474ba73b51db11bbc67c0c08fa1f5da53cd66eddbb895a5c867b355ed65

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 Bytes

Contents

class Reputation
  class Functions
    class Step
      
      include Mixin
      
      attr_accessor :a, :k, :c
      
      def initialize(args = {})
        constants = {
          :a => -1,  # lower asymptote
          :k => 1,   # upper asymptote
          :c => 0.5  # point of switch
        }.merge( args )
        @c = constants[:c]
        @k = constants[:k]
        @a = constants[:a]
      end
      
      def f(x)
        limit( x.to_f >= c.to_f ? k : a )
      end
      
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reputation-0.0.5 lib/reputation/functions/step.rb
reputation-0.0.4 lib/reputation/functions/step.rb
reputation-0.0.3 lib/reputation/functions/step.rb
reputation-0.0.2 lib/reputation/functions/step.rb