continued_fractions 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.1.11 / 2010-03-16
2
+
3
+ * Changed names of some variable to provide better in-code documentation.
4
+
1
5
  === 0.1.10 / 2010-03-16
2
6
 
3
7
  * Improved documentation and formatting.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('continued_fractions', '0.1.10') do |config|
5
+ Echoe.new('continued_fractions', '0.1.11') do |config|
6
6
  config.summary = 'Generate continued fractions.'
7
7
  config.author = 'Jose Hales-Garcia'
8
8
  config.url = 'http://bitbucket.org/jolohaga/continued_fractions/'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{continued_fractions}
5
- s.version = "0.1.10"
5
+ s.version = "0.1.11"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jose Hales-Garcia"]
@@ -13,10 +13,9 @@ module ContinuedFractions
13
13
  attr_accessor :number, :quotients, :limit
14
14
  attr_writer :convergents
15
15
 
16
- # For a given number, n, calculate its continued fraction quotients and convergents.
16
+ # For a given number calculate its continued fraction quotients and convergents up to limit.
17
17
  #
18
- # The quotients and convergents arrays are length 5, by default. Pass an integer for
19
- # the second parameter to change the default.
18
+ # The limit is 5 by default. Pass an integer in the second parameter to change it.
20
19
  #
21
20
  # Example:
22
21
  # cf = ContinuedFraction.new(Math::PI,10)
@@ -25,9 +24,9 @@ module ContinuedFractions
25
24
  # @convergents=[[0, 1], [1, 0], [3, 1], [22, 7], [333, 106],
26
25
  # [355, 113], [103993, 33102], [104348, 33215], [208341, 66317], [312689, 99532], [833719, 265381], [1146408, 364913]]>
27
26
  #
28
- def initialize(n,l=5)
29
- @number = n
30
- @limit = l
27
+ def initialize(number,limit=5)
28
+ @number = number
29
+ @limit = limit
31
30
  @quotients = calculate_quotients
32
31
  @convergents = calculate_convergents
33
32
  end
@@ -76,11 +75,11 @@ module ContinuedFractions
76
75
  end
77
76
  end
78
77
 
79
- class << self #:nodoc:
80
- def convergence_matrix(n,m,fill=nil)
78
+ class << self
79
+ def convergence_matrix(n,m,fill=nil) #:nodoc:
81
80
  conv_mat = Array.new(n).map!{Array.new(m,fill)}
82
81
  conv_mat[0][0],conv_mat[1][1] = 0,0
83
82
  conv_mat
84
83
  end
85
84
  end
86
- end
85
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 10
9
- version: 0.1.10
8
+ - 11
9
+ version: 0.1.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jose Hales-Garcia