Module: Math

Defined in:
lib/math.rb

Class Method Summary collapse

Class Method Details

.exp(n) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/math.rb', line 3

def exp(n)
  if Uncertain === n
    x = uncertain_exp(n.value)
    Uncertain.new(x,n.uncertainty*x)
  else
    uncertain_exp(n)
  end
end

.log(n) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/math.rb', line 13

def log(n)
  if Uncertain == n
    Uncertain.new(uncertain_log(n.value),n.uncertainty/n.value)
  else
    uncertain_log(n)
  end
end

.sqrt(n) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/math.rb', line 22

def sqrt(n)
  if Uncertain === n
    n**(0.5)
  else
    uncertain_sqrt(n)
  end
end

.uncertain_expObject



2
# File 'lib/math.rb', line 2

alias uncertain_exp exp

.uncertain_logObject



12
# File 'lib/math.rb', line 12

alias uncertain_log log

.uncertain_sqrtObject



21
# File 'lib/math.rb', line 21

alias uncertain_sqrt sqrt