Class: SyMath::Definition::Number
- Inherits:
-
SyMath::Definition
- Object
- Value
- SyMath::Definition
- SyMath::Definition::Number
- Defined in:
- lib/symath/definition/number.rb
Instance Attribute Summary
Attributes inherited from SyMath::Definition
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(name) ⇒ Number
constructor
A new instance of Number.
- #is_finite? ⇒ Boolean
- #is_nan? ⇒ Boolean
- #is_number? ⇒ Boolean
- #is_positive? ⇒ Boolean
- #is_zero? ⇒ Boolean
- #type ⇒ Object
- #value ⇒ Object
Methods inherited from SyMath::Definition
#<=>, #==, #arity, define, defined?, definitions, get, #hash, init_builtin, #inspect, #is_constant?, #is_function?, #is_operator?, #reduce_call, #replace, #to_latex, #to_s, undefine, #variables
Methods inherited from Value
#*, #**, #+, #-, #-@, #/, #<, #<=, #<=>, #>, #>=, #^, #add, #base, compose_with_simplify, create, #deep_clone, #div, #dump, #evaluate, #exponent, #factors, #inspect, #inv, #is_divisor_factor?, #is_negative?, #is_negative_number?, #is_prod_exp?, #is_sum_exp?, #is_unit_quaternion?, #mul, #neg, #power, #reduce, #reduce_modulo_sign, #sign, #sub, #terms, #to_m, #wedge
Methods included from Operation::Exterior
Methods included from Operation::Integration
#anti_derivative, #get_linear_constants, initialize, #int_constant, #int_failure, #int_function, #int_inv, #int_pattern, #int_power, #int_product, #int_sum, #integral_bounds
Methods included from Operation::Differential
#_d_wedge, #d, #d_failure, #d_fraction, #d_function, #d_function_def, #d_power, #d_product, initialize
Methods included from Operation
Methods included from Operation::DistributiveLaw
#combfrac_add_term, #combfrac_sum, #combine_fractions, #expand, #expand_product, #expand_single_pass, #factorize, #factorize_integer_poly, #factorize_simple, #has_fractional_terms?
Methods included from Operation::Normalization
#combine_factors, #compare_factors_and_swap, #normalize, #normalize_matrix, #normalize_power, #normalize_product, #normalize_single_pass, #normalize_sum, #order_product, #product_on_fraction_form, #reduce_constant_factors, #replace_combined_factors, #swap_factors
Methods included from Operation::Match
#build_assoc_op, #match, #match_assoc, #match_replace
Constructor Details
#initialize(name) ⇒ Number
Returns a new instance of Number.
5 6 7 |
# File 'lib/symath/definition/number.rb', line 5 def initialize(name) super(name.to_s, define_symbol: false) end |
Instance Method Details
#description ⇒ Object
9 10 11 |
# File 'lib/symath/definition/number.rb', line 9 def description() return "#{name} - natural number" end |
#is_finite? ⇒ Boolean
21 22 23 |
# File 'lib/symath/definition/number.rb', line 21 def is_finite?() return true end |
#is_nan? ⇒ Boolean
17 18 19 |
# File 'lib/symath/definition/number.rb', line 17 def is_nan?() return false end |
#is_number? ⇒ Boolean
29 30 31 |
# File 'lib/symath/definition/number.rb', line 29 def is_number?() return true end |
#is_positive? ⇒ Boolean
25 26 27 |
# File 'lib/symath/definition/number.rb', line 25 def is_positive?() return value() > 0 end |
#is_zero? ⇒ Boolean
33 34 35 |
# File 'lib/symath/definition/number.rb', line 33 def is_zero?() return value() == 0 end |
#type ⇒ Object
37 38 39 |
# File 'lib/symath/definition/number.rb', line 37 def type() return :natural.to_t end |
#value ⇒ Object
13 14 15 |
# File 'lib/symath/definition/number.rb', line 13 def value() return self.name.to_s.to_i end |