Sha256: 1321c25809c7d9a3f6dbdb958e47033696f0cb6b1d244cb805eb1b6749841f09

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

module Danica
  class Function::Gauss < Function
    variables :x, median: :u, variance_root: { latex: '\theta', gnu: :v }

    private

    def function_block
      @function_block ||= product(parcels)
    end

    def parcels
      [
        division(1, denominator),
        exponential(exp)
      ]
    end

    def denominator
      squared_root(
        product(2, PI, variance),
      )
    end

    def exp
      negative(
        division(
          power(group(
            sum(x, negative(median))
          ), 2),
          product(2, variance)
        )
      )
    end

    def variance
      @variance ||= power(variance_root, 2)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danica-2.2.0 spec/support/models/functions/gauss.rb