Sha256: 90aee93faa786ebe629035b2fb84b6e8456e5370980c9a29ea35d52bf2cf6299

Contents?: true

Size: 444 Bytes

Versions: 2

Compression:

Stored size: 444 Bytes

Contents

module Danica
  class Function::Gauss < Function.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

2 entries across 2 versions & 1 rubygems

Version Path
danica-2.4.4 lib/danica/function/gauss.rb
danica-2.4.3 lib/danica/function/gauss.rb