Class: Axiom::Function::Numeric::SquareRoot
- Inherits:
-
Axiom::Function::Numeric
- Object
- Axiom::Function
- Axiom::Function::Numeric
- Axiom::Function::Numeric::SquareRoot
- Includes:
- Unary, Unary::Invertible
- Defined in:
- lib/axiom/function/numeric/square_root.rb
Overview
A class representing a square root function
Defined Under Namespace
Modules: Methods
Instance Attribute Summary
Attributes included from Operation::Unary
Class Method Summary collapse
-
.call(value) ⇒ Numeric
Return the square root of the value.
Instance Method Summary collapse
-
#inverse ⇒ Exponentiation
Return the inverse function.
-
#type ⇒ Class<Attribute::Float>
Return the type returned from #call.
Methods included from Unary
Methods included from Unary::Callable
Methods included from Operation::Unary
Methods inherited from Axiom::Function
extract_value, rename_attributes
Methods included from Visitable
Class Method Details
.call(value) ⇒ Numeric
Return the square root of the value
23 24 25 |
# File 'lib/axiom/function/numeric/square_root.rb', line 23 def self.call(value) Math.sqrt(value) end |
Instance Method Details
#inverse ⇒ Exponentiation
Return the inverse function
35 36 37 |
# File 'lib/axiom/function/numeric/square_root.rb', line 35 def inverse Exponentiation.new(operand, 2).memoize(:inverse, self) end |
#type ⇒ Class<Attribute::Float>
Return the type returned from #call
44 45 46 |
# File 'lib/axiom/function/numeric/square_root.rb', line 44 def type Attribute::Float end |