Class: Sigma

Inherits:
Numeric show all
Defined in:
lib/m500.rb,
lib/M500_containers.rb

Constant Summary collapse

@@epsilon =
Quotient(1,100000000000)
@@upsilon =
"a very large number ceiling to signal change to scientific format"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Numeric

#coerce, #irrational?, #sgml_id, #to_Frac, #to_K, #to_N, #to_N0, #to_R, #to_Sig, #to_Z, #to_sgml

Methods included from SGML

#sgml_id, #tog_sgml_id

Instance Attribute Details

#kObject

Returns the value of attribute k.



372
373
374
# File 'lib/M500_containers.rb', line 372

def k
  @k
end

#k0Object

Returns the value of attribute k0.



372
373
374
# File 'lib/M500_containers.rb', line 372

def k0
  @k0
end

#update_procObject

Returns the value of attribute update_proc.



407
408
409
# File 'lib/M500_containers.rb', line 407

def update_proc
  @update_proc
end

Class Method Details

.epsilon(e) ⇒ Object



361
362
363
# File 'lib/M500_containers.rb', line 361

def Sigma::epsilon(e)
#on epsilon change flag for dirty and recalculate
end

.new!(a, b) ⇒ Object



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/M500_containers.rb', line 343

def Sigma.new!(a,b)
  if a.kind_of?(Sigma)
    a 
  elsif a.kind_of?(Quotient)
    new(a,b)
  elsif a.kind_of?(Natural) or a.kind_of?(Counting) or a.kind_of?(Zahlen) or a.kind_of?(Fraction) or a.kind_of?(Decimal)
  elsif
    new(a.to_Q,b)
  elsif a.kind_of?(NaughtClass) or a.kind_of?(EmptyListClass) or a.kind_of?(NilClass)
    a unless b
    new(Quotinet(0,1),b) if b
  elsif a.kind_of?(NANClass) or a.kind_of?(InfinityClass)
    a
  end
end

Instance Method Details

#convergentsObject



373
374
375
# File 'lib/M500_containers.rb', line 373

def convergents
  []
end

#irrationalObject



376
377
378
# File 'lib/M500_containers.rb', line 376

def irrational
  true ? false : true
end

#nextObject

instance_eval(@update_eval.call)



397
398
399
400
401
402
403
404
405
# File 'lib/M500_containers.rb', line 397

def next
  t = @k
  @k0 = t
  @k += 1
  @rat += @update_proc.call
  t = @k
  @k0 = t
  @k += 1
end

#rational?Boolean

Returns:

  • (Boolean)


379
380
381
# File 'lib/M500_containers.rb', line 379

def rational?
  true ? true : false
end

#to_aObject



382
383
384
# File 'lib/M500_containers.rb', line 382

def to_a
  convergents
end

#to_DecObject



411
412
413
# File 'lib/M500_containers.rb', line 411

def to_Dec
  @rat.to_Dec
end

#to_QObject



408
409
410
# File 'lib/M500_containers.rb', line 408

def to_Q
  @rat
end

#to_sObject



385
386
387
388
389
# File 'lib/M500_containers.rb', line 385

def to_s
  e = ""
  e = "-" if @absolute == -1
  # @update_proc
end

#updateApprox(&block) ⇒ Object



390
391
392
# File 'lib/M500_containers.rb', line 390

def updateApprox(&block)
  instance_exec(&block)
end

#updateApprox1Object



393
394
395
396
# File 'lib/M500_containers.rb', line 393

def updateApprox1
  @rat += @update_proc.call
  #    instance_eval(@update_eval.call)
end