The Eager object provides factory methods to create instances of Valuable entities that are evaluated eagerly. These entities can represent numerical values parsed from strings, long integers, or specific types of mathematical fields.
Attributes
Members list
Type members
Classlikes
Provides an implicit conversion from an Int to an imaginary number representation.
Provides an implicit conversion from an Int to an imaginary number representation.
This class allows integers to be interpreted as imaginary numbers by appending .i to an integer. The imaginary number is constructed using the square of the integer negated, combined with the square root notation.
Value parameters
- x
-
the integer to be converted into an imaginary number
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Parses the given string into a Valuable representation. If the string cannot be parsed into a valid Number, an exception is thrown.
Parses the given string into a Valuable representation. If the string cannot be parsed into a valid Number, an exception is thrown.
NOTE this deprecation is OK--there is no alternative NumberParser
Value parameters
- str
-
the input string representing a numerical value.
Attributes
- Returns
-
a
Valuablerepresentation of the parsedNumber. - Note
-
Throws CoreExceptionWithCause if parsing the string fails.
Creates an Eager instance representing the given double value.
Creates an Eager instance representing the given double value.
Value parameters
- x
-
the input value of type
Doubleto be wrapped in anEagerrepresentation.
Attributes
- Returns
-
an
Eagerinstance corresponding to the input value.
Creates a Valuable instance representing the given long value.
Creates a Valuable instance representing the given long value.
Value parameters
- x
-
the input value of type
Longto be wrapped in aValuablerepresentation.
Attributes
- Returns
-
a
Valuableobject corresponding to the input value.
Creates a Valuable instance based on the given Field. If the Field is a Real object, it converts it into a Scalar representation. Otherwise, it throws an IllegalArgumentException.
Creates a Valuable instance based on the given Field. If the Field is a Real object, it converts it into a Scalar representation. Otherwise, it throws an IllegalArgumentException.
Value parameters
- field
-
the input field to be converted into a
Valuable. It is expected to be of typecom.phasmidsoftware.number.core.Real.
Attributes
- Returns
-
a
Valuablerepresentation of the inputFieldas aScalar. - Note
-
Throws com.phasmidsoftware.number.algebra.util.AlgebraException if the provided
Fieldis not of typeReal.
Converts an Eager instance into a Field representation. If the conversion fails, it recovers by throwing a AlgebraException with an appropriate error message indicating the failure.
Converts an Eager instance into a Field representation. If the conversion fails, it recovers by throwing a AlgebraException with an appropriate error message indicating the failure.
CONSIDER making this an instance method of Eager.
Value parameters
- eager
-
the
Eagerinstance to be converted into aField. This is expected to represent a numerical value.
Attributes
- Returns
-
the
Fieldrepresentation of the inputValuable. - Note
-
Throws com.phasmidsoftware.number.algebra.util.AlgebraException If conversion is not possible.
Computes the imaginary representation of the given number by squaring it, negating the result, and attempting to convert it into a valid imaginary number. It cannot be used for negative imaginary numbers or any multiple of i𝛑.
Computes the imaginary representation of the given number by squaring it, negating the result, and attempting to convert it into a valid imaginary number. It cannot be used for negative imaginary numbers or any multiple of i𝛑.
The purpose of this method is to provide a convenient way to construct a simple imaginary number.
Value parameters
- x
-
the input value of type
Numberto be transformed into an imaginary representation. It is expected to be a valid numerical value.
Attributes
- Returns
-
an
Eagerinstance representing the imaginary conversion of the input number. - Throws
-
AlgebraException
if the conversion fails or the resulting value cannot be represented as an imaginary number.
Concrete fields
A lazily initialized constant e in an Eager representation.
A lazily initialized constant e in an Eager representation.
The value of e is imported from the NaturalExponential object, which defines the mathematical constant e (approximately 2.71828...) to arbitrary precision.
As a lazy value, the computation or retrieval of e is deferred until it is accessed for the first time.
Attributes
A lazily initialized constant one-half, wrapped as a RationalNumber instance constructed from Rational.half.
A lazily initialized constant one-half, wrapped as a RationalNumber instance constructed from Rational.half.
This value is of type Eager and is calculated lazily, meaning it is initialized only when accessed. The half constant provides a convenient representation of the fractional value 1/2 in the Eager context.
Attributes
Represents the imaginary unit i as an Eager instance.
Represents the imaginary unit i as an Eager instance.
This specific value corresponds to the mathematical constant √(-1), which is represented internally as the result of applying the InversePower constructor with a base of 2 and an exponent of -1.
The value is lazily initialized, meaning it is computed only when accessed.
Attributes
A lazily initialized constant for infinity: an Eager instance that encapsulates a RationalNumber with an infinite value.
A lazily initialized constant for infinity: an Eager instance that encapsulates a RationalNumber with an infinite value.
This property is provided as a convenient representation of positive infinity in the context of Eager computations. It utilizes the Rational.infinity to initialize the encapsulated value.
Attributes
A lazily initialized constant -1 as a lazily evaluated Eager instance.
A lazily initialized constant -1 as a lazily evaluated Eager instance.
This value is initialized by accessing a pre-defined minusOne instance from the Number class and is shared across all uses of the containing class.
The value is immutable and can be used wherever an Eager representation of the constant -1 is required.
Attributes
Represents the mathematical concept of negative infinity as an Eager instance.
Represents the mathematical concept of negative infinity as an Eager instance.
This value is constructed using the Rational.negInfinity, which signifies negative infinity in the rational number system, wrapped within the RationalNumber representation.
It can be used in computations where negative infinity needs to be explicitly modeled.
Attributes
Represents an eagerly evaluated lazy value corresponding to the negative half of π (-π/2).
Represents an eagerly evaluated lazy value corresponding to the negative half of π (-π/2).
This value is initialized using the Angle.negPiBy2 constant from the Angle object, conveniently making it available within the Eager type system.
Attributes
A lazily initialized constant value one within the Eager class. This value corresponds to the numerical representation of one.
A lazily initialized constant value one within the Eager class. This value corresponds to the numerical representation of one.
Attributes
- Returns
-
an
Eagerinstance representing the value1.
Represents the golden ratio, commonly denoted as φ (phi), in the Eager context.
Represents the golden ratio, commonly denoted as φ (phi), in the Eager context.
The golden ratio is a mathematical constant approximately equal to 1.6180339887, and is defined as the positive solution to the quadratic equation x^2 - x - 1 = 0.
This lazy value retrieves its definition from the QuadraticSolution.phi.
Attributes
A lazily initialized constant π (pi) as an Eager instance.
A lazily initialized constant π (pi) as an Eager instance.
This value is precomputed and corresponds to the mathematical constant π, providing precise representation through the Eager type.
Attributes
A lazily initialized constant π/2 (pi divided by 2), expressed as an instance of Eager. This value corresponds to half of the constant π, which is commonly used in trigonometry and other mathematical computations involving angles.
A lazily initialized constant π/2 (pi divided by 2), expressed as an instance of Eager. This value corresponds to half of the constant π, which is commonly used in trigonometry and other mathematical computations involving angles.
Attributes
A lazily initialized constant π/4 (pi divided by 4) as an instance of the Eager type.
A lazily initialized constant π/4 (pi divided by 4) as an instance of the Eager type.
This value is predefined and corresponds to a quarter of π, commonly used in trigonometric calculations and other mathematical contexts.
It is lazily initialized using the Angle.piBy4 definition and provides an efficient representation of this angle.
Attributes
- Returns
-
A constant
Eagerrepresentation of π/4.
A lazily initialized constant of type Eager representing one of the roots of the quadratic equation. The value is initialized based on the definition provided by QuadraticSolution.psi.
A lazily initialized constant of type Eager representing one of the roots of the quadratic equation. The value is initialized based on the definition provided by QuadraticSolution.psi.
This property is part of the Eager class, which represents mathematical expressions and constants.
The lazy initialization ensures that the computation is deferred until the first access, optimizing resource usage and preventing unnecessary calculations during object instantiation.
Attributes
Represents the square root of 2 (√2) as an instance of Eager.
Represents the square root of 2 (√2) as an instance of Eager.
root2 is lazily initialized as an InversePower instance with a numerator of 2 and a denominator of 2. It includes an optional descriptive label "√2".
The Eager type supports numerical representations and operations, enabling mathematical expressions and computations involving this constant.
Attributes
Represents the square root of 3 as a lazy initialization of an Eager type.
Represents the square root of 3 as a lazy initialization of an Eager type.
Internally implemented as an InversePower instance with base 2 and exponent 3, providing an efficient representation of √3. Optionally tagged with a string descriptor "√3" for identification.
Attributes
Represents the square root of 1/2, lazily initialized.
Represents the square root of 1/2, lazily initialized.
This value is an instance of Eager, constructed using the InversePower class with a base of 2 and an exponent of Eager.half. It models the mathematical constant √½ and is labeled with its LaTeX representation for display purposes.
The creation of this value demonstrates the use of lazy initialization to defer computation until it is first accessed.
Attributes
A lazily initialized constant value of 10 within the Eager context.
A lazily initialized constant value of 10 within the Eager context.
This value is encapsulated as an instance of the Scalar type in the Eager framework. The ten lazy value is pre-computed and serves as a reusable numeric constant within operations or evaluations involving the Eager type.
The lazy evaluation ensures that the value is computed only when accessed, thus optimizing performance and memory usage in contexts where ten is unused.
Attributes
A lazily initialized constant value of 2 within the Eager type system.
A lazily initialized constant value of 2 within the Eager type system.
This value is instantiated as a Scalar(2), which is a specific subtype of Eager. It signifies the literal value 2 and can be used in computations or comparisons involving Eager instances.
Attributes
A lazily initialized constant representing the number zero, encapsulated in an Eager object. This value is pre-defined and serves as the canonical representation of zero within the Eager type.
A lazily initialized constant representing the number zero, encapsulated in an Eager object. This value is pre-defined and serves as the canonical representation of zero within the Eager type.
Delegates its value to Number.zero, a predefined numerical constant.
Attributes
Represents the zero value for an angle, lazily evaluated.
Represents the zero value for an angle, lazily evaluated.
This lazy value provides an Eager instance corresponding to the Angle.zero constant. It is part of the predefined constants within the Eager type for convenient mathematical operations.
Attributes
Givens
Givens
Provides an implementation of the DyadicOperator trait for the Eager type, enabling dyadic operations to be performed on Eager operands or their subtypes.
Provides an implementation of the DyadicOperator trait for the Eager type, enabling dyadic operations to be performed on Eager operands or their subtypes.
The implementation supports both same-type and cross-type operations. It delegates processing to specialized DyadicOperator instances where applicable, or falls back to a more generic operation using the given function f.
NOTE currently, this is not used because the Eq and FuzzyEq instances go directly to the instance methods of Eager.
Attributes
- Returns
-
An instance of
DyadicOperator[Eager]that defines the behavior for performing dyadic operations onEagervalues.
Provides an instance of Eq for the Eager type, which defines equality comparison behavior for Eager values. The comparison is performed using the eqv method of Eager. If the eqv method returns Some(true), the values are considered equal. Otherwise, they are considered not equal, defaulting to false if no result is specified.
Provides an instance of Eq for the Eager type, which defines equality comparison behavior for Eager values. The comparison is performed using the eqv method of Eager. If the eqv method returns Some(true), the values are considered equal. Otherwise, they are considered not equal, defaulting to false if no result is specified.
Attributes
- Returns
-
An instance of
Eq[Eager]for equality comparison.
Provides an instance of the FuzzyEq type class for the Eager type.
Provides an instance of the FuzzyEq type class for the Eager type.
This implementation determines whether two Eager instances are approximately equal based on one of the following conditions:
- The two instances are strictly equal (
===). - They are approximately equal according to the fuzzy equality comparison defined by the
fuzzyEqvmethod of theEagertype, using the specified probabilityp.
Attributes
- Returns
-
An instance of
FuzzyEq[Eager]that evaluates fuzzy equality between twoEagervalues.
Implicits
Implicits
Provides an implicit conversion from an Int to an imaginary number representation.
Provides an implicit conversion from an Int to an imaginary number representation.
This class allows integers to be interpreted as imaginary numbers by appending .i to an integer. The imaginary number is constructed using the square of the integer negated, combined with the square root notation.
Value parameters
- x
-
the integer to be converted into an imaginary number
Attributes
Implicitly converts an integer value into an Eager representation. This conversion wraps the integer as a WholeNumber within the Eager type.
Implicitly converts an integer value into an Eager representation. This conversion wraps the integer as a WholeNumber within the Eager type.
Value parameters
- x
-
the integer value to be converted into an
Eagerinstance.
Attributes
- Returns
-
an
Eagerinstance representing the input integer as aWholeNumber.
Implicitly converts a Rational value into an Eager representation. This conversion wraps the Rational as a RationalNumber within the Eager type.
Implicitly converts a Rational value into an Eager representation. This conversion wraps the Rational as a RationalNumber within the Eager type.
Value parameters
- x
-
the
Rationalvalue to be converted into anEagerinstance.
Attributes
- Returns
-
an
Eagerinstance representing the inputRationalas aRationalNumber.
LatexRenderer for Eager (general case).
LatexRenderer for Eager (general case).
Attempts to render based on the concrete type.