Module: Math
- Defined in:
- lib/math.rb
Class Method Summary collapse
- .exp(n) ⇒ Object
- .log(n) ⇒ Object
- .sqrt(n) ⇒ Object
- .uncertain_exp ⇒ Object
- .uncertain_log ⇒ Object
- .uncertain_sqrt ⇒ Object
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_exp ⇒ Object
2 |
# File 'lib/math.rb', line 2 alias uncertain_exp exp |
.uncertain_log ⇒ Object
12 |
# File 'lib/math.rb', line 12 alias uncertain_log log |
.uncertain_sqrt ⇒ Object
21 |
# File 'lib/math.rb', line 21 alias uncertain_sqrt sqrt |