Sha256: 7e24289f34d1b25c6c9d9d4ef91de2baca20e755a5db307af2131f28bf148da1

Contents?: true

Size: 811 Bytes

Versions: 3

Compression:

Stored size: 811 Bytes

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'bullshit'

class TestFunctions < Test::Unit::TestCase
  include Bullshit::Functions

  def gammaP5_2(x)
    gammaP_regularized(x, 5 / 2.0)
  end

  def gammaQ5_2(x)
    gammaQ_regularized(x, 5 / 2.0)
  end

  X1 = [ 0.0, 0.1, 0.5, 0.9, 0.95, 0.995, 1.0, 2, 3, 5, 10, 100 ]

  Y1 = [ 0.0000000000, 0.0008861388, 0.0374342268, 0.1239315997, 0.1371982774,
    0.1494730091, 0.1508549639, 0.4505840486, 0.6937810816, 0.9247647539,
    0.9987502694, 1.0000000000 ]

  def test_gammaPQ
    assert gammaQ_regularized(1, -1).nan?
    assert gammaP_regularized(1, -1).nan?
    assert gammaP5_2(-1).nan?
    assert gammaQ5_2(-1).nan?
    X1.zip(Y1) do |x, y|
      assert_in_delta y, gammaP5_2(x), 1E-10
      assert_in_delta y, 1 - gammaQ5_2(x), 1E-10
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
flori-bullshit-0.1.0 tests/test_functions.rb
bullshit-0.1.1 tests/test_functions.rb
bullshit-0.1.0 tests/test_functions.rb