class Mathmas::Number

Internal use only Instantiated by Symbol#coerce or Expression#coerce

@example

5*(x + y)

x + y is calcurated first and an instance of Expression is created. Then Fixnum#* has no rule when its argument is an instance of Expression so Expression#coerce is called. At last Expression#coerce calls Number#new.

Multiply(Number(5), Plus(Symbol(x), Symbol(y))

Attributes

num[RW]

Public Class Methods

new(num) click to toggle source
# File lib/mathmas/core/number.rb, line 18
def initialize(num)
  @num = num
end

Public Instance Methods

to_s() click to toggle source
# File lib/mathmas/core/number.rb, line 22
def to_s
  @num.to_s
end
to_tex() click to toggle source
# File lib/mathmas/core/number.rb, line 26
def to_tex
  @num.to_s
end