Class: Math::SetTheory::RealAlgebraicNumbers

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

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

#initializeRealAlgebraicNumbers

Returns a new instance of RealAlgebraicNumbers.



10
11
12
13
14
# File 'lib/ruuuby/math/set_theory/discrete/real_algebraic_numbers.rb', line 10

def initialize
  super(:𝔸ᡣ, ::Math::SetTheory::NumberSet::AlephNumbers::ZERO, {dense: true})
  @subset_of   = [:π•Œ, :β„‚, :ℝ, :𝔸]
  @superset_of = [:𝔹, :β„•, :π•Ž, :β„€, :β„š]
end

Instance Method Details

#_βˆ‹?(n) ⇒ Boolean

⚠️, coverage missing

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ruuuby/math/set_theory/discrete/real_algebraic_numbers.rb', line 19

def _βˆ‹?(n)
  case(n)
  when ::Integer
    true
  when ::Float
    if ℝ.βˆ‹?(n)
      if β„€.βˆ‹?(n)
        true
      else
        nil
      end
    else
      false
    end
  when ::BigDecimal
    return false unless n.finite?
    return true if β„€.βˆ‹?(n)
    nil
  when ::Complex
    n.imaginary == 0 && β„š.βˆ‹?(n.real)
  when ::Rational
    (β„€.βˆ‹?(n.numerator) && β„€.βˆ‹?(n.denominator)) ? true : nil
  else
    false
  end
end