malge 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,6 +1,14 @@
1
1
  = vasputils changelog
2
2
 
3
- == Master (for 0.0.7)
3
+ == Master (for 0.0.8)
4
+
5
+ == Version 0.0.7)
6
+ * Add Malge::ErrorFittedFunction::AXInv2
7
+ * Add Malge::ErrorFittedFunction::AXInv3
8
+ * Malge::ErrorFittedFunction may raise UnableCalculationError if contain not finit value in coefficients after fitting.
9
+ * Debug Malge::ErrorFittedFunction; to delete finest value.
10
+ * Obsolete Malge::ErrorFittedFunction#finest_y; Use Malge::ErrorFittedFunction#most_strict_pairs alternatively.
11
+ * Change behavior of Malge::ErrorFittedFunction when generated; To keep the most precise value pair.
4
12
 
5
13
  == Version 0.0.6)
6
14
  * Rename Malge::ErrorFittedFunction::AXInv to Malge::ErrorFittedFunction::AXInvPlusB
data/Gemfile CHANGED
@@ -10,5 +10,5 @@ group :development do
10
10
  gem "bundler", "~> 1.2.2"
11
11
  gem "jeweler", "~> 1.8.3"
12
12
  gem "simplecov", ">= 0"
13
- gem "psych", ">= 0"
13
+ #gem "psych", ">= 0"
14
14
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -5,8 +5,8 @@ require "malge/errorfittedfunction/aexpbx.rb"
5
5
  require "malge/errorfittedfunction/aexpbx32.rb"
6
6
  require "malge/errorfittedfunction/axinv.rb"
7
7
  require "malge/errorfittedfunction/axinv32.rb"
8
- require "malge/errorfittedfunction/axinvplusb.rb"
9
- require "malge/errorfittedfunction/axinv32plusb.rb"
8
+ require "malge/errorfittedfunction/axinv2.rb"
9
+ require "malge/errorfittedfunction/axinv3.rb"
10
10
  require "malge/leastsquare.rb"
11
11
  require "malge/matrix.rb"
12
12
  require "malge/simultaneousequations.rb"
@@ -12,6 +12,7 @@ class Malge::ErrorFittedFunction
12
12
  class TypeError < Exception; end
13
13
  class SizeMismatchError < Exception; end
14
14
  class NotImplementedError < Exception; end
15
+ class UnableCalculationError < Exception; end
15
16
 
16
17
  #Generate error fitted function from x[i] and y[i].
17
18
  #Errors are generated y[i] and y_true assumed by the expected most precise y[i].
@@ -24,15 +25,18 @@ class Malge::ErrorFittedFunction
24
25
  end
25
26
 
26
27
  @raw_pairs = data_pairs
27
- @diff_abs_pairs = data_pairs.map { |pair| [pair[0], (pair[1] - finest_y).abs] }
28
- @diff_abs_pairs.delete_at(-1)
28
+ @diff_abs_pairs = data_pairs.map { |pair| [pair[0], (pair[1] - most_strict_pair[1]).abs] }
29
29
  fit
30
+
31
+ @coefficients.each do |coef|
32
+ raise UnableCalculationError unless coef.finite?
33
+ end
30
34
  end
31
35
 
32
- ##Return expected error
33
- #def expected_errors(x)
34
- # raise NotImplementedError, "Define #{__method__}() in the inherited class."
35
- #end
36
+ #Return string which is easily readable for people to know the function.
37
+ def equation
38
+ raise NotImplementedError, "Define #{__method__}() in the inherited class."
39
+ end
36
40
 
37
41
  #Return expected error at x, condition variable, on the fitted function.
38
42
  #Note that this method does not return the error between actual and true value.
@@ -47,9 +51,7 @@ class Malge::ErrorFittedFunction
47
51
  #Ignore last value of x[i] and y[i].
48
52
  def variance
49
53
  sum = 0.0
50
- #pp @diff_abs_pairs
51
54
  @diff_abs_pairs.each do |pair|
52
- #pp pair
53
55
  sum += (pair[1] - expected_error(pair[0]) )**2
54
56
  end
55
57
  sum
@@ -61,12 +63,12 @@ class Malge::ErrorFittedFunction
61
63
  end
62
64
 
63
65
  #Return the value of y[i] at which the most precise data is expected to be obtained.
64
- def finest_y
66
+ def most_strict_pair
65
67
  raise NotImplementedError, "Define #{__method__}() in the inherited class."
66
68
 
67
69
  #In the most case, it would be sufficient to select belows.
68
- @raw_pairs.max_by { |pair| pair[0] }[1]
69
- @raw_pairs.min_by { |pair| pair[0] }[1]
70
+ @raw_pairs.max_by{ |pair| pair[0] }
71
+ @raw_pairs.mix_by{ |pair| pair[0] }
70
72
  end
71
73
 
72
74
  private
@@ -79,8 +81,5 @@ class Malge::ErrorFittedFunction
79
81
  raise NotImplementedError, "Define #{__method__}() in the inherited class."
80
82
  end
81
83
 
82
- #Return the most precise y[i].
83
- #This depends on each data and function.
84
- #E.g., does a higher or lower value lead precise?
85
84
  end
86
85
 
@@ -5,6 +5,9 @@
5
5
  #
6
6
  #NOTE: @coefficients[0] might become negative value.
7
7
  # Need discussion for dealing?
8
+ #
9
+ #NOTE: Zero value for |y - y_last| is simply ignored due to impossible log evaluation.
10
+ #
8
11
  class Malge::ErrorFittedFunction::AExpBX < Malge::ErrorFittedFunction
9
12
 
10
13
  def fit
@@ -13,10 +16,15 @@ class Malge::ErrorFittedFunction::AExpBX < Malge::ErrorFittedFunction
13
16
  y = Math::log(pair[1])
14
17
  [x,y]
15
18
  }
19
+ inv_pairs.delete_if {|pair| ! pair[1].finite?}
16
20
  @coefficients = Malge::LeastSquare.least_square_1st_degree(inv_pairs)
17
21
  @coefficients[0] = Math::exp @coefficients[0]
18
22
  end
19
23
 
24
+ def equation
25
+ sprintf("f(x) = %f \* exp(%f \* x)", * @coefficients)
26
+ end
27
+
20
28
  def expected_error(x)
21
29
  @coefficients[0] * Math::exp( @coefficients[1] * x)
22
30
  end
@@ -30,8 +38,8 @@ class Malge::ErrorFittedFunction::AExpBX < Malge::ErrorFittedFunction
30
38
  return Math::log( y / @coefficients[0])/@coefficients[1]
31
39
  end
32
40
 
33
- def finest_y
34
- @raw_pairs.max_by { |pair| pair[0] }[1]
41
+ def most_strict_pair
42
+ @raw_pairs.max_by{ |pair| pair[0] }
35
43
  end
36
44
 
37
45
  end
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # coding: utf-8
3
3
 
4
- #Assumed y = a[0] * exp(a[1] *x)
4
+ #Assumed y = a[0] * exp(a[1] * (x ^{3/2}))
5
5
  #
6
6
  #NOTE: @coefficients[0] might become negative value.
7
7
  # Need discussion for dealing?
@@ -13,10 +13,15 @@ class Malge::ErrorFittedFunction::AExpBX32 < Malge::ErrorFittedFunction
13
13
  y = Math::log(pair[1])
14
14
  [x,y]
15
15
  }
16
+ inv_pairs.delete_if {|pair| ! pair[1].finite?}
16
17
  @coefficients = Malge::LeastSquare.least_square_1st_degree(inv_pairs)
17
18
  @coefficients[0] = Math::exp @coefficients[0]
18
19
  end
19
20
 
21
+ def equation
22
+ sprintf("f(x) = %f \* exp(%f \* x^{3/2})", * @coefficients)
23
+ end
24
+
20
25
  def expected_error(x)
21
26
  @coefficients[0] * Math::exp( @coefficients[1] * x **(3.0/2.0))
22
27
  end
@@ -31,10 +36,11 @@ class Malge::ErrorFittedFunction::AExpBX32 < Malge::ErrorFittedFunction
31
36
  return (Math::log( y / @coefficients[0])/@coefficients[1]) **(2.0/3.0)
32
37
  end
33
38
 
34
- def finest_y
35
- @raw_pairs.max_by { |pair| pair[0] }[1]
39
+ def most_strict_pair
40
+ @raw_pairs.max_by{ |pair| pair[0] }
36
41
  end
37
42
 
43
+
38
44
  end
39
45
 
40
46
 
@@ -1,17 +1,21 @@
1
1
  #! /usr/bin/env ruby
2
2
  # coding: utf-8
3
3
 
4
- #Assumed y = a[0] + a[1]/x
4
+ #Assumed y = a[0]/x
5
5
  #
6
- #NOTE: @coefficients[0] might become negative value.
7
- # Need discussion for dealing?
8
6
  class Malge::ErrorFittedFunction::AXInv < Malge::ErrorFittedFunction
9
7
 
10
8
  def fit
11
- inv_pairs = @diff_abs_pairs.map {|pair| [1.0/pair[0], pair[1]]}
9
+ inv_pairs = Marshal.load(Marshal.dump(@diff_abs_pairs))
10
+ #inv_pairs.delete([most_strict_x, 0.0])
11
+ inv_pairs.map! {|pair| [1.0/pair[0], pair[1]]}
12
12
  @coefficients = Malge::LeastSquare.least_square_proportional(inv_pairs)
13
13
  end
14
14
 
15
+ def equation
16
+ sprintf("f(x) = %f / x", * @coefficients)
17
+ end
18
+
15
19
  def expected_error(x)
16
20
  @coefficients[0] / x
17
21
  end
@@ -22,9 +26,10 @@ class Malge::ErrorFittedFunction::AXInv < Malge::ErrorFittedFunction
22
26
  return @coefficients[0] / y
23
27
  end
24
28
 
25
- def finest_y
26
- @raw_pairs.max_by { |pair| pair[0] }[1]
29
+ def most_strict_pair
30
+ @raw_pairs.max_by{ |pair| pair[0] }
27
31
  end
28
32
 
33
+
29
34
  end
30
35
 
@@ -0,0 +1,33 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ #Assumed y = a[0] /(x^2)
5
+ #
6
+ class Malge::ErrorFittedFunction::AXInv2 < Malge::ErrorFittedFunction
7
+
8
+ def fit
9
+ inv_pairs = @diff_abs_pairs.map {|pair| [1.0/(pair[0]**2), pair[1]]}
10
+ @coefficients = Malge::LeastSquare.least_square_proportional(inv_pairs)
11
+ end
12
+
13
+ def equation
14
+ sprintf("f(x) = %f / (x^2)", * @coefficients)
15
+ end
16
+
17
+ def expected_error(x)
18
+ @coefficients[0] / (x**2)
19
+ end
20
+
21
+ #y = a/x
22
+ #x = a/y
23
+ def x(y)
24
+ return Math::sqrt(@coefficients[0] / y)
25
+ end
26
+
27
+ def most_strict_pair
28
+ @raw_pairs.max_by{ |pair| pair[0] }
29
+ end
30
+
31
+
32
+ end
33
+
@@ -0,0 +1,33 @@
1
+ #! /usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ #Assumed y = a[0]/(x^3)
5
+ #
6
+ class Malge::ErrorFittedFunction::AXInv3 < Malge::ErrorFittedFunction
7
+
8
+ def fit
9
+ inv_pairs = @diff_abs_pairs.map {|pair| [1.0/(pair[0]**3), pair[1]]}
10
+ @coefficients = Malge::LeastSquare.least_square_proportional(inv_pairs)
11
+ end
12
+
13
+ def equation
14
+ sprintf("f(x) = %f / (x^3)", * @coefficients)
15
+ end
16
+
17
+ def expected_error(x)
18
+ @coefficients[0] / (x**3)
19
+ end
20
+
21
+ #y = a/x
22
+ #x = a/y
23
+ def x(y)
24
+ return (@coefficients[0] / y) ** (1.0/3.0)
25
+ end
26
+
27
+ def most_strict_pair
28
+ @raw_pairs.max_by{ |pair| pair[0] }
29
+ end
30
+
31
+
32
+ end
33
+
@@ -8,11 +8,14 @@
8
8
  class Malge::ErrorFittedFunction::AXInv32 < Malge::ErrorFittedFunction
9
9
 
10
10
  def fit
11
- inv32_pairs =
12
- @diff_abs_pairs.map {|pair| [1.0/(pair[0] ** (3.0/2.0)), pair[1]]}
11
+ inv32_pairs = @diff_abs_pairs.map {|pair| [pair[0] ** ( - 3.0/2.0), pair[1]]}
13
12
  @coefficients = Malge::LeastSquare.least_square_proportional(inv32_pairs)
14
13
  end
15
14
 
15
+ def equation
16
+ sprintf("f(x) = %f / (x^{3/2})", * @coefficients)
17
+ end
18
+
16
19
  def expected_error(x)
17
20
  @coefficients[0] /(x** (3.0/2.0))
18
21
  end
@@ -26,9 +29,10 @@ class Malge::ErrorFittedFunction::AXInv32 < Malge::ErrorFittedFunction
26
29
  return (@coefficients[0] / y ) ** (2.0/3.0)
27
30
  end
28
31
 
29
- def finest_y
30
- @raw_pairs.max_by { |pair| pair[0] }[1]
32
+ def most_strict_pair
33
+ @raw_pairs.max_by{ |pair| pair[0] }
31
34
  end
32
35
 
36
+
33
37
  end
34
38
 
@@ -17,7 +17,6 @@ module Malge::LeastSquare
17
17
  # ]
18
18
  #Note that not [a, b] in y = ax + b.
19
19
  def self.least_square_1st_degree(data_pairs)
20
- #pp data_pairs
21
20
  a = 0.0 #x^2
22
21
  #b = 0.0 #y^2
23
22
  c = 0.0 #x^1
@@ -42,15 +41,12 @@ module Malge::LeastSquare
42
41
  a = 0.0 #x^2
43
42
  d = 0.0 #x*y
44
43
  n = data_pairs.size
45
- #pp data_pairs
46
44
  data_pairs.each do |pairs|
47
45
  x = pairs[0].to_f
48
46
  y = pairs[1].to_f
49
47
  a += x**2
50
- #b += y**2
51
48
  d += x*y
52
49
  end
53
- #raise if d == 0.0
54
50
  [d/a]
55
51
  end
56
52
 
@@ -64,8 +60,6 @@ module Malge::LeastSquare
64
60
  def self.variance_1st_degree(data_pairs)
65
61
  coefficients = self.least_square_1st_degree(data_pairs)
66
62
  data_pairs.inject(0.0) do |sum, pair|
67
- #pp pair
68
- #pp sum
69
63
  x = pair[0]
70
64
  y = pair[1]
71
65
  f_x = coefficients[0] + coefficients[1] * x
@@ -26,7 +26,6 @@ class Malge::SimultaneousEquations
26
26
  n = matrix.column_size
27
27
  n.times do |i|
28
28
  tmp = Marshal.load( Marshal.dump( matrix ) )
29
- #pp tmp
30
29
  n.times do |j|
31
30
  tmp[ j, i ] = values[ j ]
32
31
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "malge"
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ippei94da"]
12
- s.date = "2013-02-16"
12
+ s.date = "2013-03-18"
13
13
  s.description = "Mathematical library to deal with basic problems in algebla.\n "
14
14
  s.email = "ippei94da@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -29,9 +29,9 @@ Gem::Specification.new do |s|
29
29
  "lib/malge/errorfittedfunction/aexpbx.rb",
30
30
  "lib/malge/errorfittedfunction/aexpbx32.rb",
31
31
  "lib/malge/errorfittedfunction/axinv.rb",
32
+ "lib/malge/errorfittedfunction/axinv2.rb",
33
+ "lib/malge/errorfittedfunction/axinv3.rb",
32
34
  "lib/malge/errorfittedfunction/axinv32.rb",
33
- "lib/malge/errorfittedfunction/axinv32plusb.rb",
34
- "lib/malge/errorfittedfunction/axinvplusb.rb",
35
35
  "lib/malge/leastsquare.rb",
36
36
  "lib/malge/matrix.rb",
37
37
  "lib/malge/simultaneousequations.rb",
@@ -42,16 +42,16 @@ Gem::Specification.new do |s|
42
42
  "test/test_errorfittedfunction_aexpbx.rb",
43
43
  "test/test_errorfittedfunction_aexpbx32.rb",
44
44
  "test/test_errorfittedfunction_axinv.rb",
45
+ "test/test_errorfittedfunction_axinv2.rb",
46
+ "test/test_errorfittedfunction_axinv3.rb",
45
47
  "test/test_errorfittedfunction_axinv32.rb",
46
- "test/test_errorfittedfunction_axinv32plusb.rb",
47
- "test/test_errorfittedfunction_axinvplusb.rb",
48
48
  "test/test_leastsquare.rb",
49
49
  "test/test_simultaneousequations.rb"
50
50
  ]
51
51
  s.homepage = "http://github.com/ippei94da/malge"
52
52
  s.licenses = ["MIT"]
53
53
  s.require_paths = ["lib"]
54
- s.rubygems_version = "1.8.23"
54
+ s.rubygems_version = "1.8.11"
55
55
  s.summary = "Math ALGEbra library."
56
56
 
57
57
  if s.respond_to? :specification_version then
@@ -62,20 +62,17 @@ Gem::Specification.new do |s|
62
62
  s.add_development_dependency(%q<bundler>, ["~> 1.2.2"])
63
63
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
64
64
  s.add_development_dependency(%q<simplecov>, [">= 0"])
65
- s.add_development_dependency(%q<psych>, [">= 0"])
66
65
  else
67
66
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
68
67
  s.add_dependency(%q<bundler>, ["~> 1.2.2"])
69
68
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
70
69
  s.add_dependency(%q<simplecov>, [">= 0"])
71
- s.add_dependency(%q<psych>, [">= 0"])
72
70
  end
73
71
  else
74
72
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
75
73
  s.add_dependency(%q<bundler>, ["~> 1.2.2"])
76
74
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
77
75
  s.add_dependency(%q<simplecov>, [">= 0"])
78
- s.add_dependency(%q<psych>, [">= 0"])
79
76
  end
80
77
  end
81
78
 
@@ -1,15 +1,18 @@
1
1
  #! /usr/bin/env ruby
2
2
  # coding: utf-8
3
3
 
4
- require "test/unit"
5
- require "malge.rb"
6
- require "malge/errorfittedfunction.rb"
4
+ require "helper"
5
+ #require "test/unit"
6
+ #require "malge.rb"
7
+ #require "malge/errorfittedfunction.rb"
7
8
 
8
9
  class Malge::ErrorFittedFunction::Dummy00 < Malge::ErrorFittedFunction
9
10
  def fit; end
10
11
  end
11
12
 
12
13
  class Malge::ErrorFittedFunction::Dummy01 < Malge::ErrorFittedFunction
14
+ $tolerance = 1E-10
15
+
13
16
  def expected_error(x)
14
17
  @coefficients[0] + @coefficients[1] * x
15
18
  end
@@ -25,37 +28,61 @@ class Malge::ErrorFittedFunction::Dummy01 < Malge::ErrorFittedFunction
25
28
  @coefficients = [1.0, 2.0]
26
29
  end
27
30
 
28
- def finest_y
29
- #max
30
- finest_pair = @raw_pairs.max_by { |pair| pair[0] }
31
- finest_pair[1]
31
+ def most_strict_pair
32
+ @raw_pairs.max_by{ |pair| pair[0] }
33
+ end
34
+
35
+ end
36
+
37
+ ## Dummy class to check Exception due to NaN.
38
+ class Malge::ErrorFittedFunction::Dummy02 < Malge::ErrorFittedFunction
39
+ def expected_error(x)
40
+ @coefficients[0] + @coefficients[1] * x
41
+ end
42
+
43
+ #Assume: y = 1.0 + 2.0 * x
44
+ #x = 1/2( y - 1.0)
45
+ def x(y)
46
+ return 1.0/2.0 * (y - 1.0)
47
+ end
32
48
 
33
- #@raw_pairs[x][1]
49
+ #Assume: y = 1.0 + 2.0 * x
50
+ def fit
51
+ @coefficients = [0.0/0.0, 1.0]
34
52
  end
35
53
 
54
+ def most_strict_pair
55
+ @raw_pairs.max_by { |pair| pair[0] }
56
+ end
36
57
  end
37
58
 
59
+
38
60
  class TC_ErrorFittedFunction < Test::Unit::TestCase
39
61
  def setup
40
- #@eff00 = Malge::ErrorFittedFunction::Dummy00.new([], [])
41
62
  @eff01 = Malge::ErrorFittedFunction::Dummy01.new(
42
- #2x+1 = 1, -1
43
- #2x+1 = 3, +2
44
- #2x+1 = 5, -1
45
- #[0.0, 1.0, 2.0],
46
- #[0.0, 5.0, 4.0]
47
63
  [
48
64
  [0.0, 0.0],
49
65
  [1.0, 5.0],
50
66
  [2.0, 4.0],
51
67
  ]
52
68
  )
69
+
70
+ # not ordered.
71
+ data = [
72
+ [1000.0, -3.153327],
73
+ [1200.0, -3.150316],
74
+ [1500.0, -3.151397],
75
+ [ 500.0, -3.11294],
76
+ [ 600.0, -3.181593],
77
+ [ 700.0, -3.165176],
78
+ [ 900.0, -3.152733],
79
+ [ 500.0, -3.11294]
80
+ ]
81
+ @eff02 = Malge::ErrorFittedFunction::Dummy01.new(data)
53
82
  end
54
83
 
55
84
  def test_variance
56
- assert_equal(13.0, @eff01.variance)
57
- #diff_abs = [4,1]
58
- #expected = [1,3]
85
+ assert_equal(38.0, @eff01.variance)
59
86
  end
60
87
 
61
88
  def test_expected_error
@@ -64,7 +91,47 @@ class TC_ErrorFittedFunction < Test::Unit::TestCase
64
91
  assert_equal(5.0, @eff01.expected_error(2.0))
65
92
  end
66
93
 
94
+ def test_equation
95
+ assert_raise(Malge::ErrorFittedFunction::NotImplementedError){
96
+ @eff01.equation
97
+ }
98
+ end
99
+
100
+ def test_initialize_diff_abs_pairs
101
+
102
+ assert_equal(1000.0, @eff02.diff_abs_pairs[0][0])
103
+ assert_equal(1200.0, @eff02.diff_abs_pairs[1][0])
104
+ assert_equal(1500.0, @eff02.diff_abs_pairs[2][0])
105
+ assert_equal( 500.0, @eff02.diff_abs_pairs[3][0])
106
+ assert_equal( 600.0, @eff02.diff_abs_pairs[4][0])
107
+ assert_equal( 700.0, @eff02.diff_abs_pairs[5][0])
108
+ assert_equal( 900.0, @eff02.diff_abs_pairs[6][0])
109
+ assert_equal( 500.0, @eff02.diff_abs_pairs[7][0])
110
+
111
+ assert_in_delta(0.001930, @eff02.diff_abs_pairs[0][1], $tolerance)
112
+ assert_in_delta(0.001081, @eff02.diff_abs_pairs[1][1], $tolerance)
113
+ assert_in_delta(0.0 , @eff02.diff_abs_pairs[2][1], $tolerance)
114
+ assert_in_delta(0.038457, @eff02.diff_abs_pairs[3][1], $tolerance)
115
+ assert_in_delta(0.030196, @eff02.diff_abs_pairs[4][1], $tolerance)
116
+ assert_in_delta(0.013779, @eff02.diff_abs_pairs[5][1], $tolerance)
117
+ assert_in_delta(0.001336, @eff02.diff_abs_pairs[6][1], $tolerance)
118
+ assert_in_delta(0.038457, @eff02.diff_abs_pairs[7][1], $tolerance)
119
+ end
120
+
121
+ def test_most_strict_pair
122
+ assert_equal(2.0, @eff01.most_strict_pair[0])
123
+ assert_equal(4.0, @eff01.most_strict_pair[1])
124
+
125
+ assert_equal(1500.0 , @eff02.most_strict_pair[0])
126
+ assert_equal(-3.151397, @eff02.most_strict_pair[1])
127
+ end
128
+
129
+
67
130
  def test_initialize
131
+ assert_raise(Malge::ErrorFittedFunction::NotImplementedError){
132
+ Malge::ErrorFittedFunction::Dummy00.new([[0.0, 1.0]])
133
+ }
134
+
68
135
  assert_raise(Malge::ErrorFittedFunction::NotImplementedError){
69
136
  Malge::ErrorFittedFunction.new([])
70
137
  }
@@ -77,10 +144,10 @@ class TC_ErrorFittedFunction < Test::Unit::TestCase
77
144
  assert_raise(Malge::ErrorFittedFunction::TypeError){
78
145
  Malge::ErrorFittedFunction.new([[1,2], 1])
79
146
  }
80
- end
81
147
 
82
- def test_finest_y
83
- assert_equal(4.0, @eff01.finest_y)
148
+ assert_raise(Malge::ErrorFittedFunction::UnableCalculationError){
149
+ Malge::ErrorFittedFunction::Dummy02.new([[1,2]])
150
+ }
84
151
  end
85
152
 
86
153
  end