Sha256: 6592d5cb6e1ed5d75c251141b71871733c3c7b2a24f68b90f7d2bfccf24eeda0

Contents?: true

Size: 448 Bytes

Versions: 7

Compression:

Stored size: 448 Bytes

Contents

module Danica
  class Expression::Gauss < Expression.build(:x, average: { latex: '\mu', gnu: :u }, variance_root: { latex: '\sigma', gnu: :v }) { num(1) / denominator * exponential(exp) }

    private

    def denominator
      variance_root * sqrt(num(2) * PI)
    end

    def exp
      - (
          ((x - average) ** 2) /
          (num(2) * variance)
      )
    end

    def variance
      @variance ||= variance_root ** 2
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
danica-2.6.4 lib/danica/expression/gauss.rb
danica-2.6.3 lib/danica/expression/gauss.rb
danica-2.6.2 lib/danica/expression/gauss.rb
danica-2.6.1 lib/danica/expression/gauss.rb
danica-2.6.0 lib/danica/expression/gauss.rb
danica-2.5.1 lib/danica/expression/gauss.rb
danica-2.5.0 lib/danica/expression/gauss.rb