Class: Sequence

Inherits:
Object
  • Object
show all
Defined in:
lib/M500_containers.rb

Overview

end

Instance Method Summary collapse

Constructor Details

#initializeSequence

Returns a new instance of Sequence.



418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/M500_containers.rb', line 418

def initialize
  @index0 = 0
  @indexn = 50
  @func = proc{|k|
    @a_n_minus1 = @a_n
    @a_n *= (Quotient(1) + Quotient(Zahlen(1),Natural(k+1)))
  }
  @a_n_minus1 = Quotient(1)
  @a_n = Quotient(1)
  @sequence = List.new!#([])
  (@index0..@indexn).to_a.each{|n|
    @sequence << @func.call(n)}
end

Instance Method Details

#to_colsObject



433
434
435
436
437
438
# File 'lib/M500_containers.rb', line 433

def to_cols
  result = [[],[]]
  (@index0..@indexn).to_a.each{|n|
    result.at(0)<< n
    result.at(1)<< @func.call(n)}
end

#to_hObject



431
432
# File 'lib/M500_containers.rb', line 431

def to_h
end

#to_SeriesObject



442
443
444
445
446
447
# File 'lib/M500_containers.rb', line 442

def to_Series
  a = Sigma(@sequence.inject(:+).to_Q) {@func}
  a.k0 = @index0
  a.k = @indexn
  a
end

#to_SetObject



439
440
441
# File 'lib/M500_containers.rb', line 439

def to_Set
  Set(@sequence)
end