Class: Math::SetTheory::ComplexNumbers

Inherits:
NumberSet show all
Includes:
Singleton
Defined in:
lib/ruuuby/math/set_theory/discrete/complex_numbers.rb

Overview

“the complex-numbers are the ‘algebraic completion` of the real-numbers

Instance Attribute Summary

Attributes inherited from NumberSet

#name, #symbol, #𝔠

Attributes inherited from Closure

#axioms

Instance Method Summary collapse

Methods inherited from NumberSet

#countable?, #countably_infinite?, #finite?, #uncountable?, #∋?, #∌?, #⊂?, #⊃?, #⊄?, #⊅?, #⊆?, #⊇?

Constructor Details

#initializeComplexNumbers

Returns a new instance of ComplexNumbers.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ruuuby/math/set_theory/discrete/complex_numbers.rb', line 11

def initialize
  super(:ℂ, ::Math::SetTheory::NumberSet::AlephNumbers::ONE, {
      closed_under_addition: true,
      closed_under_multiplication: true,
      closed_under_subtraction: true,
      closed_under_division: true,
      dense: true,
      continuous: true,
      algebraically_closed: true
  })
  @superset_of = [:𝕀, :𝔸ᵣ, :𝔸, :ℚ, :ℤ, :𝕎, :ℕ, :𝔹, :ℝ]
  @subset_of   = [:𝕌]
end

Instance Method Details

#_∋?(n) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ruuuby/math/set_theory/discrete/complex_numbers.rb', line 26

def _∋?(n)
  case(n)
  when ::Integer
    true
    #when Float
    #if ℝ.∋?(n)
    #  if ℤ.∋?(n)
    #    return true
    #  else
    #    if 𝕀.∋?(n)
    #      return false
    #    else
    #      return nil
    #    end
    #  end
    #else
    #  return false
    #end
  when ::BigDecimal, ::Complex, ::Float
    n.finite?
    #return false unless n.finite?
    #return true if ℤ.∋?(n)
    #nil
    #when Complex
    #  n.imaginary == 0 && ℚ.∋?(n.real)
  when ::Rational
    .∋?(n.numerator) && .∋?(n.denominator)
    #if ℤ.∋?(n.numerator) && ℤ.∋?(n.denominator)
    #  true
    #else
    #  nil
    #end
  else
    false
  end
end