Sha256: dbd30027c6737903550607492fd486bc672600554a72430d4c449cdd9b4a0d63

Contents?: true

Size: 456 Bytes

Versions: 4

Compression:

Stored size: 456 Bytes

Contents

module Danica
  class Expression::Gauss < Expression.build(:x, average: { latex: '\mu', gnuplot: :u }, variance_root: { latex: '\sigma', gnuplot: :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

4 entries across 4 versions & 1 rubygems

Version Path
danica-2.7.4 lib/danica/expression/gauss.rb
danica-2.7.3 lib/danica/expression/gauss.rb
danica-2.7.2 lib/danica/expression/gauss.rb
danica-2.7.1 lib/danica/expression/gauss.rb