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.
-
.type ⇒ Class<Types::Float>
Return the type returned from #call.
Instance Method Summary collapse
-
#inverse ⇒ Exponentiation
Return the inverse function.
-
#type ⇒ Class<Types::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 |
.type ⇒ Class<Types::Float>
Return the type returned from #call
36 37 38 |
# File 'lib/axiom/function/numeric/square_root.rb', line 36 def self.type Types::Float end |
Instance Method Details
#inverse ⇒ Exponentiation
Return the inverse function
48 49 50 |
# File 'lib/axiom/function/numeric/square_root.rb', line 48 def inverse Exponentiation.new(operand, 2).memoize(inverse: self) end |
#type ⇒ Class<Types::Float>
Return the type returned from #call
60 61 62 |
# File 'lib/axiom/function/numeric/square_root.rb', line 60 def type self.class.type end |