Sha256: 741abd738882100d6a4af1062827d124967e3ab167e7bf6dbd2d99dad3811c77

Contents?: true

Size: 483 Bytes

Versions: 3

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

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

3 entries across 3 versions & 1 rubygems

Version Path
danica-2.7.7 lib/danica/expression/gauss.rb
danica-2.7.6 lib/danica/expression/gauss.rb
danica-2.7.5 lib/danica/expression/gauss.rb