Sha256: 15004f11fae41a9357558a9b5492936be5e3d44b32124dcd64dac910c1ad1ae4

Contents?: true

Size: 814 Bytes

Versions: 16

Compression:

Stored size: 814 Bytes

Contents

#!/usr/bin/env ruby

require 'test_helper'
require 'more_math'

class FunctionsTest < Test::Unit::TestCase
  include MoreMath::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

16 entries across 16 versions & 1 rubygems

Version Path
more_math-1.3.0 tests/functions_test.rb
more_math-1.2.2 tests/functions_test.rb
more_math-1.2.1 tests/functions_test.rb
more_math-1.2.0 tests/functions_test.rb
more_math-1.1.0 tests/functions_test.rb
more_math-1.0.2 tests/functions_test.rb
more_math-1.0.1 tests/functions_test.rb
more_math-1.0.0 tests/functions_test.rb
more_math-0.4.0 tests/functions_test.rb
more_math-0.3.3 tests/functions_test.rb
more_math-0.3.2 tests/functions_test.rb
more_math-0.3.1 tests/functions_test.rb
more_math-0.3.0 tests/functions_test.rb
more_math-0.2.1 tests/functions_test.rb
more_math-0.1.0 tests/functions_test.rb
more_math-0.0.4 tests/functions_test.rb