integration 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/{spec/spec.opts → .rspec} +0 -1
- data/.travis.yml +15 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +38 -0
- data/History.txt +2 -0
- data/{README.txt → README.md} +8 -8
- data/Rakefile +38 -16
- data/benchmark/accuracy.rb +24 -0
- data/benchmark/speed.rb +20 -0
- data/integration.gemspec +22 -0
- data/lib/integration.rb +144 -83
- data/lib/symbolic.rb +55 -0
- data/spec/integration_spec.rb +31 -14
- data/spec/spec_helper.rb +17 -0
- metadata +104 -96
- data.tar.gz.sig +0 -0
- data/.gemtest +0 -0
- metadata.gz.sig +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7ad161dae6d8cd737f33db6844ab3f345c95fb82
|
4
|
+
data.tar.gz: d098810e0c476442e1495586d229251fffd37d9c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e2ad2678eb811bf5ae28f81e1d7e59fa118b4bef2ba995155f9ac3be109ee9caca9ea54479f86924e49edbf5fcacbf2c8831f6cf64d53b562df7e8af2b75791c
|
7
|
+
data.tar.gz: d258396d5f21736dd665afc554b2b086cb39ab4126f996fd77ddf7bd54c1c0b11e62cb02a02b5457d8e765cac9e1311e5d6d629ce8145aacebfd066dcca56280
|
data/.gitignore
ADDED
data/{spec/spec.opts → .rspec}
RENAMED
data/.travis.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- '1.9.3'
|
4
|
+
- '2.0.0'
|
5
|
+
- '2.1.1'
|
6
|
+
# - jruby-19mode # JRuby in 1.9 mode -> Problems with bigint
|
7
|
+
# - rbx-19mode
|
8
|
+
# script: bundle exec rspec spec
|
9
|
+
|
10
|
+
script:
|
11
|
+
bundle exec rspec
|
12
|
+
|
13
|
+
before_install:
|
14
|
+
- sudo apt-get update -qq
|
15
|
+
- sudo apt-get install -y libgsl0-dev
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
integration (0.1.1)
|
5
|
+
rb-gsl (~> 1.2)
|
6
|
+
text-table (~> 1.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://www.rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
narray (0.6.0.9)
|
13
|
+
rake (10.3.2)
|
14
|
+
rb-gsl (1.16.0.2)
|
15
|
+
narray (>= 0.5.9)
|
16
|
+
rspec (3.0.0)
|
17
|
+
rspec-core (~> 3.0.0)
|
18
|
+
rspec-expectations (~> 3.0.0)
|
19
|
+
rspec-mocks (~> 3.0.0)
|
20
|
+
rspec-core (3.0.3)
|
21
|
+
rspec-support (~> 3.0.0)
|
22
|
+
rspec-expectations (3.0.3)
|
23
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
+
rspec-support (~> 3.0.0)
|
25
|
+
rspec-mocks (3.0.3)
|
26
|
+
rspec-support (~> 3.0.0)
|
27
|
+
rspec-support (3.0.3)
|
28
|
+
text-table (1.2.3)
|
29
|
+
|
30
|
+
PLATFORMS
|
31
|
+
ruby
|
32
|
+
|
33
|
+
DEPENDENCIES
|
34
|
+
bundler (~> 1.3)
|
35
|
+
integration!
|
36
|
+
rake (~> 10)
|
37
|
+
rb-gsl
|
38
|
+
rspec (~> 3.0)
|
data/History.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
=== 0.2.0 / 2014-08-09
|
2
|
+
* New version, with methods ruby methods: rectangle,:trapezoid,:simpson, :adaptive_quadrature , :gauss, :romberg, :monte_carlo, :gauss_kronrod, :simpson3by8, :boole, :open_trapezoid, :milne
|
1
3
|
=== 0.1.0 / 2011-08-23
|
2
4
|
|
3
5
|
* Get code from http://rubyforge.org/projects/integral/ and converted to a gem.
|
data/{README.txt → README.md}
RENAMED
@@ -1,19 +1,19 @@
|
|
1
|
-
|
1
|
+
# integration
|
2
2
|
|
3
3
|
* http://github.com/clbustos/integration
|
4
4
|
|
5
|
-
|
5
|
+
## DESCRIPTION:
|
6
6
|
|
7
7
|
Numerical integration for Ruby, with a simple interface
|
8
8
|
|
9
|
-
|
9
|
+
## FEATURES/PROBLEMS:
|
10
10
|
|
11
11
|
* Use only one method: Integration.integrate
|
12
12
|
* Rectangular, Trapezoidal, Simpson, Adaptive quadrature, Monte Carlo and Romberg integration methods available on pure Ruby.
|
13
13
|
* If available, uses Ruby/GSL QNG non-adaptive Gauss-Kronrod integration and QAG adaptive integration, with support for Infinity+ and Infinity-
|
14
14
|
|
15
15
|
|
16
|
-
|
16
|
+
## SYNOPSIS:
|
17
17
|
|
18
18
|
Integration.integrate(1,2,{:tolerance=>1e-10,:method=>:simpson}) {|x| x**2} => 2.333333
|
19
19
|
|
@@ -23,18 +23,18 @@ Numerical integration for Ruby, with a simple interface
|
|
23
23
|
Integration.integrate(Integration::MInfinity, 0 , {:tolerance=>1e-10}, &normal_pdf) => 0.5
|
24
24
|
Integration.integrate(0, Integration::Infinity , {:tolerance=>1e-10}, &normal_pdf) => 0.5
|
25
25
|
|
26
|
-
|
26
|
+
## REQUIREMENTS:
|
27
27
|
|
28
28
|
* Ruby/GSL, for better performance and support for infinite bounds
|
29
29
|
|
30
|
-
|
30
|
+
## INSTALL:
|
31
31
|
|
32
32
|
gem install integration
|
33
33
|
|
34
|
-
|
34
|
+
## LICENSE:
|
35
35
|
|
36
36
|
Copyright (c) 2005 Beng
|
37
|
-
2011 clbustos
|
37
|
+
2011.2014 clbustos
|
38
38
|
|
39
39
|
Permission is hereby granted, free of charge, to any person obtaining a
|
40
40
|
copy of this software and associated documentation files (the "Software"),
|
data/Rakefile
CHANGED
@@ -1,23 +1,45 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
$:.unshift(File.expand_path(File.dirname(__FILE__)+"/lib/"))
|
3
3
|
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
4
|
require 'integration'
|
6
|
-
require '
|
7
|
-
# Hoe.plugin :compiler
|
8
|
-
# Hoe.plugin :gem_prelude_sucks
|
9
|
-
Hoe.plugin :git
|
10
|
-
# Hoe.plugin :inline
|
11
|
-
# Hoe.plugin :racc
|
12
|
-
# Hoe.plugin :rubyforge
|
13
|
-
|
14
|
-
Hoe.spec 'integration' do
|
15
|
-
self.developer('Ben Gimpert', 'NO_EMAIL')
|
16
|
-
self.developer('Claudio Bustos', 'clbustos_at_gmail.com')
|
17
|
-
self.version=Integration::VERSION
|
18
|
-
self.extra_dev_deps << ["rspec",">=2.0"] << ["rubyforge",">=0"]
|
5
|
+
require 'bundler'
|
19
6
|
|
7
|
+
Bundler::GemHelper.install_tasks
|
8
|
+
|
9
|
+
|
10
|
+
gemspec = eval(IO.read("integration.gemspec"))
|
11
|
+
|
12
|
+
|
13
|
+
begin
|
14
|
+
Bundler.setup(:default, :development)
|
15
|
+
rescue Bundler::BundlerError => e
|
16
|
+
$stderr.puts e.message
|
17
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
18
|
+
exit e.status_code
|
20
19
|
end
|
21
|
-
# git log --pretty=format:"*%s[%cn]" v0.5.0..HEAD >> History.txt
|
22
|
-
# vim: syntax=ruby
|
23
20
|
|
21
|
+
|
22
|
+
|
23
|
+
require "rubygems/package_task"
|
24
|
+
Gem::PackageTask.new(gemspec).define
|
25
|
+
|
26
|
+
desc "install the gem locally"
|
27
|
+
task :install => [:package] do
|
28
|
+
sh %{gem install pkg/integration-#{Integration::VERSION}.gem}
|
29
|
+
end
|
30
|
+
|
31
|
+
require 'rspec/core/rake_task'
|
32
|
+
require 'rspec/core'
|
33
|
+
require 'rspec/core/rake_task'
|
34
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
35
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
desc "Open an irb session preloaded with integration"
|
40
|
+
task :console do
|
41
|
+
sh "irb -rubygems -I lib -r integration.rb"
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => :spec
|
45
|
+
# vim: syntax=ruby
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Comparing the accuracy of different integraiton methods
|
2
|
+
# text table is required to display the results in a nice table
|
3
|
+
require 'integration'
|
4
|
+
require 'text-table'
|
5
|
+
|
6
|
+
# put the funtion you want to benchmark here
|
7
|
+
func = lambda{|x| x}
|
8
|
+
#put the actual result of the integration here
|
9
|
+
actual_result = 5/2.0 + 2* Math::sin(1)
|
10
|
+
|
11
|
+
table = Text::Table.new
|
12
|
+
table.head = ['Method','Result','Actual Result','Error','Accuracy']
|
13
|
+
|
14
|
+
for method in [:rectangle,:trapezoid,:simpson,:romberg,:adaptive_quadrature, :gauss, :gauss_kronrod, :simpson3by8, :boole, :open_trapezoid, :milne,:qng, :qag]
|
15
|
+
result = Integration.integrate(0,1,{:method=>method},&func)
|
16
|
+
if result == nil
|
17
|
+
puts method
|
18
|
+
else
|
19
|
+
error = (actual_result-result).abs
|
20
|
+
table.rows << [method,result,actual_result,error,100*(1-error/actual_result.to_f)]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
puts table.to_s
|
24
|
+
|
data/benchmark/speed.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Checking the speed of different integraiton methods
|
2
|
+
|
3
|
+
require 'benchmark'
|
4
|
+
require 'integration'
|
5
|
+
|
6
|
+
# set the number of iterations
|
7
|
+
iterations = 100
|
8
|
+
puts "Benchmarking with #{iterations} iterations"
|
9
|
+
|
10
|
+
# put the function to be benchmarked here
|
11
|
+
func = lambda{|x| x}
|
12
|
+
for method in [:rectangle,:trapezoid,:simpson,:romberg, :adaptive_quadrature, :gauss, :gauss_kronrod, :simpson3by8, :boole, :open_trapezoid, :milne, :qng, :qag]
|
13
|
+
Benchmark.bm(25) do |bm|
|
14
|
+
bm.report(method.to_s) do
|
15
|
+
iterations.times do
|
16
|
+
Integration.integrate(0,1,{:method=>method},&func)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/integration.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib/', __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "integration"
|
8
|
+
s.version = "0.1.1"
|
9
|
+
s.authors = ["Claudio Bustos","Ben Gimpert"]
|
10
|
+
s.description = "Numerical integration for Ruby, with a simple interface"
|
11
|
+
s.email = ["clbustos@gmail.com", "No Email"]
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features,benchmark}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
s.summary = "A suite for integration in Ruby"
|
17
|
+
s.add_runtime_dependency 'text-table', '~>1.2'
|
18
|
+
s.add_runtime_dependency 'rb-gsl', '~>1.2'
|
19
|
+
s.add_development_dependency 'rake', '~>10'
|
20
|
+
s.add_development_dependency 'bundler', '~>1.3'
|
21
|
+
s.add_development_dependency 'rspec', '~>2.0'
|
22
|
+
end
|
data/lib/integration.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (c) 2005 Beng (original code)
|
2
|
-
# 2011
|
3
|
-
#
|
2
|
+
# 2011 Claudio Bustos
|
3
|
+
# XXXX -> Add new developers
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
5
5
|
# copy of this software and associated documentation files (the "Software"),
|
6
6
|
# to deal in the Software without restriction, including without limitation
|
@@ -30,7 +30,7 @@
|
|
30
30
|
#
|
31
31
|
|
32
32
|
class Integration
|
33
|
-
VERSION = '0.
|
33
|
+
VERSION = '0.2.0'
|
34
34
|
# Minus Infinity
|
35
35
|
MInfinity=:minfinity
|
36
36
|
# Infinity
|
@@ -54,65 +54,80 @@ class Integration
|
|
54
54
|
class_variable_get(cv)
|
55
55
|
end
|
56
56
|
end
|
57
|
-
|
58
57
|
# Rectangle method
|
59
58
|
# +n+ implies number of subdivisions
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
height = yield(t + dt_half)
|
68
|
-
area = dt * height
|
69
|
-
total_area += area
|
70
|
-
t += dt
|
71
|
-
end
|
72
|
-
return total_area
|
73
|
-
|
59
|
+
# Source:
|
60
|
+
# * Ayres : Outline of calculus
|
61
|
+
def rectangle(t1, t2, n, &f)
|
62
|
+
d=(t2-t1) / n.to_f
|
63
|
+
n.times.inject(0) {|ac,i|
|
64
|
+
ac+f[t1+d*(i+0.5)]
|
65
|
+
}*d
|
74
66
|
end
|
75
67
|
alias_method :midpoint, :rectangle
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
height1 = prev_height
|
87
|
-
end
|
88
|
-
height2 = yield(t + dt)
|
89
|
-
area = dt * ((height1 + height2) / 2)
|
90
|
-
total_area += area
|
91
|
-
t += dt
|
92
|
-
prev_height = height2
|
93
|
-
end
|
94
|
-
return total_area
|
68
|
+
# Trapezoid method
|
69
|
+
# +n+ implies number of subdivisions
|
70
|
+
# Source:
|
71
|
+
# * Ayres : Outline of calculus
|
72
|
+
def trapezoid(t1, t2, n, &f)
|
73
|
+
d=(t2-t1) / n.to_f
|
74
|
+
(d/2.0)*(f[t1]+
|
75
|
+
2*(1..(n-1)).inject(0){|ac,i|
|
76
|
+
ac+f[t1+d*i]
|
77
|
+
}+f[t2])
|
95
78
|
end
|
96
|
-
|
97
|
-
|
79
|
+
# Simpson's rule
|
80
|
+
# +n+ implies number of subdivisions
|
81
|
+
# Source:
|
82
|
+
# * Ayres : Outline of calculus
|
83
|
+
def simpson(t1, t2, n, &f)
|
98
84
|
n += 1 unless n % 2 == 0
|
99
|
-
|
100
|
-
|
101
|
-
(
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
85
|
+
d=(t2-t1) / n.to_f
|
86
|
+
out= (d / 3.0)*(f[t1.to_f].to_f+
|
87
|
+
((1..(n-1)).inject(0) {|ac,i|
|
88
|
+
ac+((i%2==0) ? 2 : 4)*f[t1+d*i]
|
89
|
+
})+f[t2.to_f].to_f)
|
90
|
+
out
|
91
|
+
end
|
92
|
+
# TODO: Document method
|
93
|
+
def simpson3by8(t1, t2, n, &f)
|
94
|
+
d = (t2-t1) / n.to_f
|
95
|
+
ac = 0
|
96
|
+
(0..n-1).each do |i|
|
97
|
+
ac+=(d/8.0)*(f[t1+i*d]+3*f[t1+i*d+d/3]+3*f[t1+i*d+2*d/3]+f[t1+(i+1)*d])
|
98
|
+
end
|
99
|
+
ac
|
100
|
+
end
|
101
|
+
# TODO: Document method
|
102
|
+
def boole(t1, t2, n, &f)
|
103
|
+
d = (t2-t1) / n.to_f
|
104
|
+
ac = 0
|
105
|
+
(0..n-1).each do |i|
|
106
|
+
ac+=(d/90.0)*(7*f[t1+i*d]+32*f[t1+i*d+d/4]+12*f[t1+i*d+d/2]+32*f[t1+i*d+3*d/4]+7*f[t1+(i+1)*d])
|
107
|
+
end
|
108
|
+
ac
|
109
|
+
end
|
110
|
+
|
111
|
+
# TODO: Document method
|
112
|
+
def open_trapezoid(t1, t2, n, &f)
|
113
|
+
d = (t2-t1) / n.to_f
|
114
|
+
ac = 0
|
115
|
+
(0..n-1).each do |i|
|
116
|
+
ac+=(d/2.0)*(f[t1+i*d+d/3]+f[t1+i*d+2*d/3])
|
110
117
|
end
|
111
|
-
|
112
|
-
return total_area
|
118
|
+
ac
|
113
119
|
end
|
114
|
-
|
115
|
-
def
|
120
|
+
# TODO: Document method
|
121
|
+
def milne(t1, t2, n, &f)
|
122
|
+
d = (t2-t1) / n.to_f
|
123
|
+
ac = 0
|
124
|
+
(0..n-1).each do |i|
|
125
|
+
ac+=(d/3.0)*(2*f[t1+i*d+d/4]-f[t1+i*d+d/2]+2*f[t1+i*d+3*d/4])
|
126
|
+
end
|
127
|
+
ac
|
128
|
+
end
|
129
|
+
# TODO: Document method
|
130
|
+
def adaptive_quadrature(a, b, tolerance)
|
116
131
|
h = (b.to_f - a) / 2
|
117
132
|
fa = yield(a)
|
118
133
|
fc = yield(a + h)
|
@@ -136,7 +151,7 @@ class Integration
|
|
136
151
|
}
|
137
152
|
return helper.call(a, b, fa, fb, fc, h, s, 1)
|
138
153
|
end
|
139
|
-
|
154
|
+
# TODO: Document method
|
140
155
|
def gauss(t1, t2, n)
|
141
156
|
case n
|
142
157
|
when 1
|
@@ -172,41 +187,72 @@ class Integration
|
|
172
187
|
else
|
173
188
|
raise "Invalid number of spaced abscissas #{n}, should be 1-10"
|
174
189
|
end
|
190
|
+
|
175
191
|
sum = 0
|
176
192
|
(0...n).each do |i|
|
177
|
-
t = ((t1.to_f + t2) / 2) + (((t2 - t1) / 2) * z[i])
|
193
|
+
t = ((t1.to_f + t2) / 2.0) + (((t2 - t1) / 2.0) * z[i])
|
178
194
|
sum += w[i] * yield(t)
|
179
195
|
end
|
180
196
|
return ((t2 - t1) / 2.0) * sum
|
181
197
|
end
|
182
|
-
|
183
|
-
def
|
198
|
+
# TODO: Document method
|
199
|
+
def gauss_kronrod(t1,t2,n,points)
|
200
|
+
#g7k15
|
201
|
+
case points
|
202
|
+
when 15
|
203
|
+
z = [-0.9914553711208126, -0.9491079123427585, -0.8648644233597691, -0.7415311855993945, -0.5860872354676911, -0.4058451513773972, -0.20778495500789848, 0.0, 0.20778495500789848, 0.4058451513773972, 0.5860872354676911, 0.7415311855993945, 0.8648644233597691, 0.9491079123427585, 0.9914553711208126]
|
204
|
+
w = [0.022935322010529224, 0.06309209262997856, 0.10479001032225019, 0.14065325971552592, 0.1690047266392679, 0.19035057806478542, 0.20443294007529889, 0.20948214108472782, 0.20443294007529889, 0.19035057806478542, 0.1690047266392679, 0.14065325971552592, 0.10479001032225019, 0.06309209262997856, 0.022935322010529224]
|
205
|
+
when 21
|
206
|
+
#g10k21
|
207
|
+
z = [-0.9956571630258081, -0.9739065285171717, -0.9301574913557082, -0.8650633666889845, -0.7808177265864169, -0.6794095682990244, -0.5627571346686047, -0.4333953941292472, -0.2943928627014602, -0.14887433898163122, 0.0, 0.14887433898163122, 0.2943928627014602, 0.4333953941292472, 0.5627571346686047, 0.6794095682990244, 0.7808177265864169, 0.8650633666889845, 0.9301574913557082, 0.9739065285171717, 0.9956571630258081]
|
208
|
+
w = [0.011694638867371874, 0.032558162307964725, 0.054755896574351995, 0.07503967481091996, 0.0931254545836976, 0.10938715880229764, 0.12349197626206584, 0.13470921731147334, 0.14277593857706009, 0.14773910490133849, 0.1494455540029169, 0.14773910490133849, 0.14277593857706009, 0.13470921731147334, 0.12349197626206584, 0.10938715880229764, 0.0931254545836976, 0.07503967481091996, 0.054755896574351995, 0.032558162307964725, 0.011694638867371874]
|
209
|
+
when 31
|
210
|
+
#g15k31
|
211
|
+
z = [-0.9980022986933971, -0.9879925180204854, -0.9677390756791391, -0.937273392400706, -0.8972645323440819, -0.8482065834104272, -0.790418501442466, -0.7244177313601701, -0.650996741297417, -0.5709721726085388, -0.4850818636402397, -0.3941513470775634, -0.29918000715316884, -0.20119409399743451, -0.1011420669187175, 0.0, 0.1011420669187175, 0.20119409399743451, 0.29918000715316884, 0.3941513470775634, 0.4850818636402397, 0.5709721726085388, 0.650996741297417, 0.7244177313601701, 0.790418501442466, 0.8482065834104272, 0.8972645323440819, 0.937273392400706, 0.9677390756791391, 0.9879925180204854, 0.9980022986933971]
|
212
|
+
w = [0.005377479872923349, 0.015007947329316122, 0.02546084732671532, 0.03534636079137585, 0.04458975132476488, 0.05348152469092809, 0.06200956780067064, 0.06985412131872826, 0.07684968075772038, 0.08308050282313302, 0.08856444305621176, 0.09312659817082532, 0.09664272698362368, 0.09917359872179196, 0.10076984552387559, 0.10133000701479154, 0.10076984552387559, 0.09917359872179196, 0.09664272698362368, 0.09312659817082532, 0.08856444305621176, 0.08308050282313302, 0.07684968075772038, 0.06985412131872826, 0.06200956780067064, 0.05348152469092809, 0.04458975132476488, 0.03534636079137585, 0.02546084732671532, 0.015007947329316122, 0.005377479872923349]
|
213
|
+
when 41
|
214
|
+
#g20k41
|
215
|
+
z = [-0.9988590315882777, -0.9931285991850949, -0.9815078774502503, -0.9639719272779138, -0.9408226338317548, -0.912234428251326, -0.878276811252282, -0.8391169718222188, -0.7950414288375512, -0.7463319064601508, -0.6932376563347514, -0.636053680726515, -0.5751404468197103, -0.5108670019508271, -0.4435931752387251, -0.37370608871541955, -0.301627868114913, -0.22778585114164507, -0.15260546524092267, -0.07652652113349734, 0.0, 0.07652652113349734, 0.15260546524092267, 0.22778585114164507, 0.301627868114913, 0.37370608871541955, 0.4435931752387251, 0.5108670019508271, 0.5751404468197103, 0.636053680726515, 0.6932376563347514, 0.7463319064601508, 0.7950414288375512, 0.8391169718222188, 0.878276811252282, 0.912234428251326, 0.9408226338317548, 0.9639719272779138, 0.9815078774502503, 0.9931285991850949, 0.9988590315882777]
|
216
|
+
w = [0.0030735837185205317, 0.008600269855642943, 0.014626169256971253, 0.020388373461266523, 0.02588213360495116, 0.0312873067770328, 0.036600169758200796, 0.041668873327973685, 0.04643482186749767, 0.05094457392372869, 0.05519510534828599, 0.05911140088063957, 0.06265323755478117, 0.06583459713361842, 0.06864867292852161, 0.07105442355344407, 0.07303069033278667, 0.07458287540049918, 0.07570449768455667, 0.07637786767208074, 0.07660071191799965, 0.07637786767208074, 0.07570449768455667, 0.07458287540049918, 0.07303069033278667, 0.07105442355344407, 0.06864867292852161, 0.06583459713361842, 0.06265323755478117, 0.05911140088063957, 0.05519510534828599, 0.05094457392372869, 0.04643482186749767, 0.041668873327973685, 0.036600169758200796, 0.0312873067770328, 0.02588213360495116, 0.020388373461266523, 0.014626169256971253, 0.008600269855642943, 0.0030735837185205317]
|
217
|
+
when 61
|
218
|
+
#g30k61
|
219
|
+
z = [-0.9994844100504906, -0.9968934840746495, -0.9916309968704046, -0.9836681232797472, -0.9731163225011262, -0.9600218649683075, -0.94437444474856, -0.9262000474292743, -0.9055733076999078, -0.8825605357920527, -0.8572052335460612, -0.8295657623827684, -0.799727835821839, -0.7677774321048262, -0.7337900624532268, -0.6978504947933158, -0.6600610641266269, -0.6205261829892429, -0.5793452358263617, -0.5366241481420199, -0.49248046786177857, -0.44703376953808915, -0.4004012548303944, -0.3527047255308781, -0.30407320227362505, -0.25463692616788985, -0.20452511668230988, -0.15386991360858354, -0.10280693796673702, -0.0514718425553177, 0.0, 0.0514718425553177, 0.10280693796673702, 0.15386991360858354, 0.20452511668230988, 0.25463692616788985, 0.30407320227362505, 0.3527047255308781, 0.4004012548303944, 0.44703376953808915, 0.49248046786177857, 0.5366241481420199, 0.5793452358263617, 0.6205261829892429, 0.6600610641266269, 0.6978504947933158, 0.7337900624532268, 0.7677774321048262, 0.799727835821839, 0.8295657623827684, 0.8572052335460612, 0.8825605357920527, 0.9055733076999078, 0.9262000474292743, 0.94437444474856, 0.9600218649683075, 0.9731163225011262, 0.9836681232797472, 0.9916309968704046, 0.9968934840746495, 0.9994844100504906]
|
220
|
+
w = [0.0013890136986770077, 0.003890461127099884, 0.0066307039159312926, 0.009273279659517764, 0.011823015253496341, 0.014369729507045804, 0.01692088918905327, 0.019414141193942382, 0.021828035821609193, 0.0241911620780806, 0.0265099548823331, 0.02875404876504129, 0.030907257562387762, 0.03298144705748372, 0.034979338028060025, 0.03688236465182123, 0.038678945624727595, 0.040374538951535956, 0.041969810215164244, 0.04345253970135607, 0.04481480013316266, 0.04605923827100699, 0.04718554656929915, 0.04818586175708713, 0.04905543455502978, 0.04979568342707421, 0.05040592140278235, 0.05088179589874961, 0.051221547849258774, 0.05142612853745902, 0.05149472942945157, 0.05142612853745902, 0.051221547849258774, 0.05088179589874961, 0.05040592140278235, 0.04979568342707421, 0.04905543455502978, 0.04818586175708713, 0.04718554656929915, 0.04605923827100699, 0.04481480013316266, 0.04345253970135607, 0.041969810215164244, 0.040374538951535956, 0.038678945624727595, 0.03688236465182123, 0.034979338028060025, 0.03298144705748372, 0.030907257562387762, 0.02875404876504129, 0.0265099548823331, 0.0241911620780806, 0.021828035821609193, 0.019414141193942382, 0.01692088918905327, 0.014369729507045804, 0.011823015253496341, 0.009273279659517764, 0.0066307039159312926, 0.003890461127099884, 0.0013890136986770077]
|
221
|
+
else # using 15 point quadrature
|
222
|
+
n = 15
|
223
|
+
z = [-0.9914553711208126, -0.9491079123427585, -0.8648644233597691, -0.7415311855993945, -0.5860872354676911, -0.4058451513773972, -0.20778495500789848, 0.0, 0.20778495500789848, 0.4058451513773972, 0.5860872354676911, 0.7415311855993945, 0.8648644233597691, 0.9491079123427585, 0.9914553711208126]
|
224
|
+
w = [0.022935322010529224, 0.06309209262997856, 0.10479001032225019, 0.14065325971552592, 0.1690047266392679, 0.19035057806478542, 0.20443294007529889, 0.20948214108472782, 0.20443294007529889, 0.19035057806478542, 0.1690047266392679, 0.14065325971552592, 0.10479001032225019, 0.06309209262997856, 0.022935322010529224]
|
225
|
+
end
|
226
|
+
sum = 0
|
227
|
+
(0...n).each do |i|
|
228
|
+
t = ((t1.to_f + t2) / 2.0) + (((t2 - t1) / 2.0) * z[i])
|
229
|
+
sum += w[i] * yield(t)
|
230
|
+
end
|
231
|
+
return ((t2 - t1) / 2.0) * sum
|
232
|
+
end
|
233
|
+
# TODO: Document method
|
234
|
+
def romberg(a, b, tolerance,max_iter=20)
|
184
235
|
# NOTE one-based arrays are used for convenience
|
185
|
-
|
186
236
|
h = b.to_f - a
|
187
237
|
m = 1
|
188
238
|
close = 1
|
189
|
-
r = [[
|
190
|
-
|
191
|
-
|
192
|
-
while j <=
|
193
|
-
j
|
194
|
-
r
|
195
|
-
|
196
|
-
|
197
|
-
(1..
|
198
|
-
|
199
|
-
end
|
200
|
-
m *= 2
|
201
|
-
r[j][1] = r[j-1][1] / 2 + (h * sum)
|
202
|
-
(1..j-1).each do |k|
|
203
|
-
r[j][k+1] = r[j][k] + ((r[j][k] - r[j-1][k]) / ((4 ** k) - 1))
|
239
|
+
r = [[(h / 2) * (yield(a) + yield(b))]]
|
240
|
+
j = 0
|
241
|
+
hn=lambda {|n| h/(2**n)}
|
242
|
+
while j <= max_iter && tolerance < close
|
243
|
+
j+=1
|
244
|
+
r.push((j+1).times.map{[]})
|
245
|
+
ul=2**(j-1)
|
246
|
+
r[j][0]=r[j-1][0] / 2.0 + hn[j] * (1..ul).inject(0) {|ac,k| ac+yield(a + (2*k-1)* hn[j])}
|
247
|
+
(1..j).each do |k|
|
248
|
+
r[j][k] = ( (4**k) * r[j][k-1] - r[j-1][k-1]) / ((4**k)-1)
|
204
249
|
end
|
205
250
|
close = (r[j][j] - r[j-1][j-1])
|
206
251
|
end
|
207
|
-
|
252
|
+
r[j][j]
|
208
253
|
end
|
209
|
-
|
254
|
+
|
255
|
+
# TODO: Document method
|
210
256
|
def monte_carlo(t1, t2, n)
|
211
257
|
width = (t2 - t1).to_f
|
212
258
|
height = nil
|
@@ -227,7 +273,7 @@ class Integration
|
|
227
273
|
v==Infinity or v==MInfinity
|
228
274
|
end
|
229
275
|
# Methods available on pure ruby
|
230
|
-
RUBY_METHOD=[:rectangle,:trapezoid,:simpson, :adaptive_quadrature , :gauss, :romberg, :monte_carlo]
|
276
|
+
RUBY_METHOD=[:rectangle,:trapezoid,:simpson, :adaptive_quadrature , :gauss, :romberg, :monte_carlo, :gauss_kronrod, :simpson3by8, :boole, :open_trapezoid, :milne]
|
231
277
|
# Methods available with Ruby/GSL library
|
232
278
|
GSL_METHOD=[:qng, :qag]
|
233
279
|
# Get the integral for a function +f+, with bounds +t1+ and
|
@@ -263,7 +309,7 @@ class Integration
|
|
263
309
|
upper_bound = [t1, t2].max
|
264
310
|
end
|
265
311
|
def_method=(has_gsl?) ? :qag : :simpson
|
266
|
-
default_opts={:tolerance=>1e-10, :initial_step=>16
|
312
|
+
default_opts={:tolerance=>1e-10, :initial_step=>16, :step=>16, :method=>def_method}
|
267
313
|
options=default_opts.merge(options)
|
268
314
|
if RUBY_METHOD.include? options[:method]
|
269
315
|
raise "Ruby methods doesn't support infinity bounds" if inf_bounds
|
@@ -274,6 +320,7 @@ class Integration
|
|
274
320
|
raise "Unknown integration method \"#{options[:method]}\""
|
275
321
|
end
|
276
322
|
end
|
323
|
+
# TODO: Document method
|
277
324
|
def integrate_gsl(lower_bound,upper_bound,options,&f)
|
278
325
|
|
279
326
|
f = GSL::Function.alloc(&f)
|
@@ -307,7 +354,7 @@ class Integration
|
|
307
354
|
tolerance=options[:tolerance]
|
308
355
|
initial_step=options[:initial_step]
|
309
356
|
step=options[:step]
|
310
|
-
|
357
|
+
points = options[:points]
|
311
358
|
begin
|
312
359
|
method_obj = Integration.method(method.to_s.downcase)
|
313
360
|
rescue
|
@@ -315,23 +362,37 @@ class Integration
|
|
315
362
|
end
|
316
363
|
current_step=initial_step
|
317
364
|
|
318
|
-
if(method==:adaptive_quadrature or method==:romberg
|
319
|
-
if(method==:gauss)
|
365
|
+
if(method==:adaptive_quadrature or method==:romberg or method==:gauss or method== :gauss_kronrod)
|
366
|
+
if(method==:gauss )
|
367
|
+
initial_step=10 if initial_step>10
|
368
|
+
tolerance = initial_step
|
369
|
+
method_obj.call(lower_bound, upper_bound, tolerance, &f)
|
370
|
+
elsif (method==:gauss_kronrod)
|
320
371
|
initial_step=10 if initial_step>10
|
321
372
|
tolerance=initial_step
|
373
|
+
points = points if points != nil
|
374
|
+
method_obj.call(lower_bound, upper_bound, tolerance, points, &f)
|
375
|
+
else
|
376
|
+
method_obj.call(lower_bound, upper_bound, tolerance, &f)
|
322
377
|
end
|
323
|
-
method_obj.call(lower_bound, upper_bound, tolerance, &f)
|
324
378
|
else
|
325
379
|
#puts "iniciando"
|
326
380
|
value=method_obj.call(lower_bound, upper_bound, current_step, &f)
|
327
381
|
previous=value+(tolerance*2)
|
382
|
+
diffs=[]
|
328
383
|
while((previous-value).abs > tolerance) do
|
329
|
-
#puts(value)
|
384
|
+
#puts("Valor:#{value}, paso:#{current_step}")
|
330
385
|
#puts(current_step)
|
386
|
+
diffs.push((previous-value).abs)
|
387
|
+
#diffs.push value
|
331
388
|
current_step+=step
|
332
389
|
previous=value
|
390
|
+
#puts "Llamando al metodo"
|
391
|
+
|
333
392
|
value=method_obj.call(lower_bound, upper_bound, current_step, &f)
|
334
393
|
end
|
394
|
+
#p diffs
|
395
|
+
|
335
396
|
value
|
336
397
|
end
|
337
398
|
end
|
data/lib/symbolic.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
$LOAD_PATH<<'.'
|
2
|
+
require 'java'
|
3
|
+
require '/home/rajat/jscience.jar'
|
4
|
+
java_import Java::OrgJscienceMathematicsFunction.Variable
|
5
|
+
java_import Java::OrgJscienceMathematicsFunction.Polynomial
|
6
|
+
import 'org.jscience.mathematics.number.Real'
|
7
|
+
|
8
|
+
|
9
|
+
class Var #variable and symbol are already class in ruby
|
10
|
+
def initialize(sym)
|
11
|
+
@sym = sym
|
12
|
+
@var = Variable::Local.new(@sym)
|
13
|
+
end
|
14
|
+
|
15
|
+
def show_symbol
|
16
|
+
puts @sym
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Polynomial
|
21
|
+
def initialize(poly, vars)
|
22
|
+
@poly = poly # Write parser? or ask the user to write full poly?
|
23
|
+
|
24
|
+
|
25
|
+
end
|
26
|
+
#java_import Java::OrgJscienceMathematicsFunction.Variable
|
27
|
+
#java_import Java::OrgJscienceMathematicsFunction.Polynomial
|
28
|
+
#import 'org.jscience.mathematics.number.Real'
|
29
|
+
|
30
|
+
##declaring 'x' and 'y' as symbols
|
31
|
+
#varX = Variable::Local.new('x')
|
32
|
+
#varY = Variable::Local.new('y')
|
33
|
+
|
34
|
+
#creating a polynomial x
|
35
|
+
# x = Polynomial.valueOf(Real::ONE,varX)
|
36
|
+
#creating a polynomial fx = 1(x^5) + 6(x^2)
|
37
|
+
#fx = x.pow(5).plus(x.pow(2).times(Real.valueOf(6)))
|
38
|
+
|
39
|
+
#integrating with respect to variable 'x'
|
40
|
+
#puts fx.integrate(varX)
|
41
|
+
#integrating with respect to variable 'y'
|
42
|
+
#puts fx.integrate(varY)
|
43
|
+
|
44
|
+
#def polynomial(&block)
|
45
|
+
# varX = Variable::Local.new('x')
|
46
|
+
# x = Polynomial.valueOf(Real::ONE,varX)
|
47
|
+
yield x
|
48
|
+
#end
|
49
|
+
|
50
|
+
# Creating a polynomial fx = 1(x^5) + 6(x^2).
|
51
|
+
#fx = polynomial do |x|
|
52
|
+
# x.pow(5).plus(x.pow(2).times(Real.valueOf(6)))
|
53
|
+
# end
|
54
|
+
# Integrating with respect to variable 'x'.
|
55
|
+
#puts fx.integrate(varX)
|
data/spec/integration_spec.rb
CHANGED
@@ -1,25 +1,42 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
|
2
2
|
describe Integration do
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
a=lambda {|x| x**2}
|
4
|
+
b=lambda {|x| Math.log(x)/x**2}
|
5
|
+
b2=lambda {|x| -(Math.log(x)+1)/x}
|
6
|
+
# Integration over [1,2]=x^3/3=7/3
|
7
|
+
methods=[:rectangle,:trapezoid, :simpson, :adaptive_quadrature, :romberg, :gauss, :gauss_kronrod, :simpson3by8, :boole, :open_trapezoid, :milne]
|
8
|
+
methods.each do |m|
|
9
|
+
it "should integrate int_{1}^2{2} x^2 correctly with ruby method #{m}" do
|
10
|
+
Integration.integrate(1,2,{:method=>m,:tolerance=>1e-8},&a).should be_within(1e-6).of(7.0 / 3 )
|
11
|
+
end
|
12
|
+
it "should integrate int_{1}^2{2} log(x)/x^2 correctly with ruby method #{m}" do
|
13
|
+
Integration.integrate(1,2,{:method=>m,:tolerance=>1e-8},&b).should be_within(1e-6).of(
|
14
|
+
b2[2]-b2[1]
|
15
|
+
)
|
10
16
|
end
|
11
17
|
|
12
18
|
end
|
13
|
-
|
19
|
+
|
20
|
+
|
21
|
+
it "should return correct for trapezoid" do
|
22
|
+
a=rand()
|
23
|
+
b=rand()*10
|
24
|
+
f=lambda {|x| x*a}
|
25
|
+
Integration.trapezoid(0,b,2,&f).should be_within(1e-14).of((a*b**2) / 2.0)
|
26
|
+
end
|
14
27
|
it "should return a correct value for a complex integration with ruby methods" do
|
15
28
|
normal_pdf=lambda {|x| (1/Math.sqrt(2*Math::PI))*Math.exp(-(x**2/2))}
|
16
29
|
Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:simpson},&normal_pdf).should be_within(1e-11).of(0.341344746068)
|
17
30
|
Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:adaptive_quadrature},&normal_pdf).should be_within(1e-11).of(0.341344746068)
|
18
31
|
end
|
19
32
|
it "should return a correct value for a complex integration with gsl methods" do
|
20
|
-
|
21
|
-
|
22
|
-
|
33
|
+
if Integration.has_gsl?
|
34
|
+
normal_pdf=lambda {|x| (1/Math.sqrt(2*Math::PI))*Math.exp(-(x**2/2))}
|
35
|
+
Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:qng},&normal_pdf).should be_within(1e-11).of(0.341344746068)
|
36
|
+
Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:qag},&normal_pdf).should be_within(1e-11).of(0.341344746068)
|
37
|
+
else
|
38
|
+
skip("GSL not available")
|
39
|
+
end
|
23
40
|
end
|
24
41
|
|
25
42
|
|
@@ -29,7 +46,7 @@ describe Integration do
|
|
29
46
|
|
30
47
|
Integration.integrate(Integration::MInfinity, Integration::Infinity,{:tolerance=>1e-10}, &normal_pdf).should be_within(1e-09).of(1)
|
31
48
|
else
|
32
|
-
|
49
|
+
skip("GSL not available")
|
33
50
|
end
|
34
51
|
end
|
35
52
|
it "should return correct integration for infinity lower bound" do
|
@@ -39,7 +56,7 @@ describe Integration do
|
|
39
56
|
Integration.integrate(Integration::MInfinity, 0 , {:tolerance=>1e-10}, &normal_pdf).should be_within(1e-09).of(0.5)
|
40
57
|
|
41
58
|
else
|
42
|
-
|
59
|
+
skip("GSL not available")
|
43
60
|
end
|
44
61
|
end
|
45
62
|
it "should return correct integration for infinity upper bound" do
|
@@ -49,7 +66,7 @@ describe Integration do
|
|
49
66
|
Integration.integrate(0,Integration::Infinity,{:tolerance=>1e-10}, &normal_pdf).should be_within(1e-09).of(0.5)
|
50
67
|
|
51
68
|
else
|
52
|
-
|
69
|
+
skip("GSL not available")
|
53
70
|
end
|
54
71
|
end
|
55
72
|
it "should raise an error if a ruby methods is called with infinite bounds" do
|
data/spec/spec_helper.rb
CHANGED
@@ -9,3 +9,20 @@ rescue LoadError
|
|
9
9
|
end
|
10
10
|
require 'rspec'
|
11
11
|
require 'integration'
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.expect_with :rspec do |c|
|
17
|
+
c.syntax = [:should, :expect]
|
18
|
+
end
|
19
|
+
|
20
|
+
# Use color in STDOUT
|
21
|
+
config.color = true
|
22
|
+
|
23
|
+
# Use color not only in STDOUT but also in pagers and files
|
24
|
+
config.tty = true
|
25
|
+
|
26
|
+
# Use the specified formatter
|
27
|
+
config.formatter = :documentation # :progress, :html, :textmate
|
28
|
+
end
|
metadata
CHANGED
@@ -1,124 +1,132 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: integration
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Ben Gimpert
|
6
|
+
authors:
|
9
7
|
- Claudio Bustos
|
8
|
+
- Ben Gimpert
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
|
-
cert_chain:
|
13
|
-
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
/
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
dependencies:
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rspec
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-08-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: text-table
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.2'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.2'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rb-gsl
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.2'
|
35
|
+
type: :runtime
|
40
36
|
prerelease: false
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10'
|
47
49
|
type: :development
|
48
|
-
version_requirements: *id001
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rubyforge
|
51
50
|
prerelease: false
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: bundler
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.3'
|
58
63
|
type: :development
|
59
|
-
version_requirements: *id002
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: hoe
|
62
64
|
prerelease: false
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.3'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.0'
|
69
77
|
type: :development
|
70
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.0'
|
71
84
|
description: Numerical integration for Ruby, with a simple interface
|
72
|
-
email:
|
73
|
-
-
|
74
|
-
-
|
85
|
+
email:
|
86
|
+
- clbustos@gmail.com
|
87
|
+
- No Email
|
75
88
|
executables: []
|
76
|
-
|
77
89
|
extensions: []
|
78
|
-
|
79
|
-
|
80
|
-
-
|
81
|
-
-
|
82
|
-
-
|
83
|
-
|
84
|
-
-
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".autotest"
|
93
|
+
- ".gitignore"
|
94
|
+
- ".rspec"
|
95
|
+
- ".travis.yml"
|
96
|
+
- Gemfile
|
97
|
+
- Gemfile.lock
|
85
98
|
- History.txt
|
86
99
|
- Manifest.txt
|
87
|
-
- README.
|
100
|
+
- README.md
|
88
101
|
- Rakefile
|
102
|
+
- benchmark/accuracy.rb
|
103
|
+
- benchmark/speed.rb
|
104
|
+
- integration.gemspec
|
89
105
|
- lib/integration.rb
|
106
|
+
- lib/symbolic.rb
|
90
107
|
- spec/integration_spec.rb
|
91
|
-
- spec/spec.opts
|
92
108
|
- spec/spec_helper.rb
|
93
|
-
|
94
|
-
has_rdoc: true
|
95
|
-
homepage: http://github.com/clbustos/integration
|
109
|
+
homepage:
|
96
110
|
licenses: []
|
97
|
-
|
111
|
+
metadata: {}
|
98
112
|
post_install_message:
|
99
|
-
rdoc_options:
|
100
|
-
|
101
|
-
- README.txt
|
102
|
-
require_paths:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
103
115
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
|
106
|
-
requirements:
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
107
118
|
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version:
|
110
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
-
|
112
|
-
requirements:
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
113
123
|
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version:
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
116
126
|
requirements: []
|
117
|
-
|
118
|
-
|
119
|
-
rubygems_version: 1.6.0
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.2.2
|
120
129
|
signing_key:
|
121
|
-
specification_version:
|
122
|
-
summary:
|
130
|
+
specification_version: 4
|
131
|
+
summary: A suite for integration in Ruby
|
123
132
|
test_files: []
|
124
|
-
|
data.tar.gz.sig
DELETED
Binary file
|
data/.gemtest
DELETED
File without changes
|
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
�mV݈5�H�Ȗ�279s�Z�Q�eY�ڇ&����9CKy��*�p�����z�"��m�<����/��_��[!�6��a$mzj6`��Z���0��6��S
|