com.phasmidsoftware.number.core.inner
Members list
Type members
Classlikes
The AnyContext object represents a special Context that qualifies all factors without exception.
The AnyContext object represents a special Context that qualifies all factors without exception.
This context essentially overrides all filtering or conditional logic by always returning true for any given factor. It is useful as a catch-all context where no restrictions are applied.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait CoreContextclass Objecttrait Matchableclass AnyShow all
- Self type
-
AnyContext.type
This object represents a general inverse power factor.
This object represents a general inverse power factor.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait InversePowertrait Factorclass Objecttrait Matchableclass AnyShow all
Typeclass that defines boundary behavior for a type when normalizing to a range. This captures the intrinsic properties of how a type handles range boundaries.
Typeclass that defines boundary behavior for a type when normalizing to a range. This captures the intrinsic properties of how a type handles range boundaries.
Type parameters
- X
-
the numeric type
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object given_BoundaryBehavior_Int
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BoundaryBehavior.type
The Composite object represents a composite factor which cannot be reduced to a unique factor. It is used essentially as a placeholder for Eager values such as Algebraics.
The Composite object represents a composite factor which cannot be reduced to a unique factor. It is used essentially as a placeholder for Eager values such as Algebraics.
Attributes
Represents a trait for specifying in which evaluation-contexts a particular expression may be evaluated.
Represents a trait for specifying in which evaluation-contexts a particular expression may be evaluated.
The Context trait provides an abstraction for determining whether a particular factor or field qualifies within the scope of a specific context. It supports logical operations (or, and, not) to compose complex contexts from simpler ones.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait Contextobject AnyContextobject ImpossibleContextclass RestrictedContextobject AnyContextobject ImpossibleContextclass RestrictedContextShow all
Companion object for the Context class.
Companion object for the Context class.
Provides predefined contexts for evaluating and qualifying factors or fields under specific mathematical or functional conditions. This includes contexts for scalars, logarithms, and roots, along with utility functions for determining qualification.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CoreContext.type
This object represents the cube root factor.
This object represents the cube root factor.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass NthRoottrait InversePowertrait Factorclass Objecttrait Matchableclass AnyShow all
- Self type
-
CubeRoot.type
Case object representing the Degree unit, which is a scalar factor for angle measurements. It provides functionality to convert, manipulate, and perform mathematical operations associated with the degree unit.
Case object representing the Degree unit, which is a scalar factor for angle measurements. It provides functionality to convert, manipulate, and perform mathematical operations associated with the degree unit.
Attributes
- Supertypes
- Self type
-
Degree.type
Trait to define a dyadic operation.
Trait to define a dyadic operation.
Attributes
- Supertypes
- Known subtypes
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait DyadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
-
DyadicOperationPlus.type
Represents a dyadic operation that performs power computations.
Represents a dyadic operation that performs power computations.
This operation supports the power function for various numerical types including integers, rational numbers, and double-precision floating-point numbers.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait DyadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
-
DyadicOperationPower.type
Represents the dyadic multiplication operation, where the operation is performed for various numeric types (Int, Rational, Double) using predefined functions.
Represents the dyadic multiplication operation, where the operation is performed for various numeric types (Int, Rational, Double) using predefined functions.
This object provides the implementation of the multiplication operation specific to each numeric type, with safeguards to handle exceptions and ensure safety through Try.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait DyadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
-
DyadicOperationTimes.type
This factor allows the representation of quantities of the form e power ix.
This factor allows the representation of quantities of the form e power ix.
NOTE: A number in factor Euler will evaluate as e raised to (i times that power). So, the value is the natural log of the evaluation.
We call this Euler because it is used in Euler's formula https://en.wikipedia.org/wiki/Euler's_formula. However, let the record state that Roger Cotes, an English mathematician, used this quantity before Euler https://en.wikipedia.org/wiki/Euler's_formula#History.
Thus the range of such values is subject to the same modulation as Radian.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Logarithmictrait Factorclass Objecttrait Matchableclass AnyShow all
- Self type
-
Euler.type
Represents a factor type used for evaluations, conversions, and rendering in a specific context.
Represents a factor type used for evaluations, conversions, and rendering in a specific context.
CONSIDER defining an imaginary (or Complex) subclass of Factor. CONSIDER renaming this trait as Domain.
This trait serves as a foundation for different kinds of factors and provides functionality such as:
- Determining whether the factor is additive.
- Checking if the factor meets certain conditions within a specific context.
- Performing conversions of values between compatible factors.
- Rendering values in the context of the factor.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object Compositetrait InversePowerclass AnyRootclass NthRootobject CubeRootobject SquareRoottrait Logarithmicobject Eulerobject Log10object Log2object NatLogtrait Scalarobject Degreeobject Percentobject PureNumberobject RadianShow all
An object that provides a mechanism to map input strings to specific factors such as Radian, NatLog, or PureNumber. It acts as a factory for creating instances of the Factor sealed trait.
An object that provides a mechanism to map input strings to specific factors such as Radian, NatLog, or PureNumber. It acts as a factory for creating instances of the Factor sealed trait.
The object includes predefined constants representing symbols or keywords associated with certain factors. These constants include mathematical symbols like 'ℯ' and 'π', as well as their textual alternatives.
The apply method takes a string input and matches it to one of the predefined constants to return an appropriate Factor instance.
Matching logic:
- Strings representing π (like "π", "pi", "Radian", "PI") will return the
Radianfactor. - The symbol 'ℯ' will return the
NatLogfactor. - All other strings default to the
PureNumberfactor.
Attributes
A Context that rejects all Factor instances without exception.
A Context that rejects all Factor instances without exception.
ImpossibleContext is a specific instance of the Context trait that always returns false for any factor, indicating that no factor qualifies within this context.
This context acts as the logical negation of all other possible contexts, prohibiting any factor from being considered qualifying.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait CoreContextclass Objecttrait Matchableclass AnyShow all
- Self type
-
ImpossibleContext.type
An object providing an extractor method for converting a Rational number into a pair of integers representing its numerator and denominator.
An object providing an extractor method for converting a Rational number into a pair of integers representing its numerator and denominator.
The IntRational object simplifies working with Rational numbers when you need to decompose them into integers for further processing or pattern matching.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IntRational.type
Provides functionality to determine if a given Rational represents the inverse of an integer. This object serves as an extractor for such instances of Rational.
Provides functionality to determine if a given Rational represents the inverse of an integer. This object serves as an extractor for such instances of Rational.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Inverse.type
A sealed trait extending the Factor trait, representing a mathematical root-based factorization.
A sealed trait extending the Factor trait, representing a mathematical root-based factorization.
This trait provides mechanisms to convert values associated with one root-based factor to another, when such conversions are mathematically possible.
Attributes
- Companion
- object
- Supertypes
- Known subtypes
Companion object for the NthRoot trait, providing utility methods for working with NthRoot instances.
Companion object for the NthRoot trait, providing utility methods for working with NthRoot instances.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
InversePower.type
Represents the logarithm with base 10.
Represents the logarithm with base 10.
This object extends the Logarithmic trait and provides functionality for representing and rendering logarithms of base 10.
Attributes
- Constructor
-
Creates an instance of
Log10. - Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Logarithmictrait Factorclass Objecttrait Matchableclass AnyShow all
- Self type
-
Log10.type
Object representing the logarithm to base 2.
Object representing the logarithm to base 2.
This object extends the Logarithmic trait and provides specific functionality for dealing with logarithms to the base 2. It defines the base as "2" and computes the logarithmic value (math.log(2)).
Methods include:
toString: Returns "log2" as the string representation.render(x: Value): Converts the input value to a string representation based on the power notation specific to the base 2.
Attributes
- See also
-
Logarithmic
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Logarithmictrait Factorclass Objecttrait Matchableclass AnyShow all
- Self type
-
Log2.type
Trait to define a Factor which indicates that the true value of a Number with this Factor is the base raised to the power of the (nominal) Value.
Trait to define a Factor which indicates that the true value of a Number with this Factor is the base raised to the power of the (nominal) Value.
Attributes
- Companion
- object
- Supertypes
- Known subtypes
Companion object for the Logarithmic class.
Companion object for the Logarithmic class.
This object provides utilities associated with the Logarithmic class, including operations for pattern matching and internal functionality for string manipulation.
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
Logarithmic.type
Typeclass for types that support modular arithmetic. This provides operations needed to normalize values into a range using modulo.
Typeclass for types that support modular arithmetic. This provides operations needed to normalize values into a range using modulo.
Type parameters
- X
-
the numeric type
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object given_Modulo_BigDecimalobject given_Modulo_Doubleobject given_Modulo_Intobject given_Modulo_Rational
Definitions of MonadicOperations. This module relates primarily to operations on Value.
Definitions of MonadicOperations. This module relates primarily to operations on Value.
Attributes
- Supertypes
- Known subtypes
-
class MonadicOperationAtanobject MonadicOperationExpclass MonadicOperationFuncobject MonadicOperationInvertobject MonadicOperationLogclass MonadicOperationModulateobject MonadicOperationNegateclass MonadicOperationScaleobject MonadicOperationSinobject MonadicOperationSqrtShow all
MonadicOperation to yield the arctangent of a Number.
MonadicOperation to yield the arctangent of a Number.
Value parameters
- sign
-
an Int which will distinguish between results in the four quadrants.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
MonadicOperation to raise e (Euler's number) to the power of a Number.
MonadicOperation to raise e (Euler's number) to the power of a Number.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
-
MonadicOperationExp.type
MonadicOperation to apply a generic function to a Number.
MonadicOperation to apply a generic function to a Number.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
MonadicOperation to invert a Number.
MonadicOperation to invert a Number.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
MonadicOperation to yield the natural logarithm of a Number. CONSIDER Renaming as MonadicOperationLn
MonadicOperation to yield the natural logarithm of a Number. CONSIDER Renaming as MonadicOperationLn
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
-
MonadicOperationLog.type
This class represents a monadic operation that modulates a numeric input into a specified range using modular arithmetic. It allows defining a flexible boundary behavior, which can either model standard numeric ranges or angular (circular) ranges, with the ability to make the range inclusive.
This class represents a monadic operation that modulates a numeric input into a specified range using modular arithmetic. It allows defining a flexible boundary behavior, which can either model standard numeric ranges or angular (circular) ranges, with the ability to make the range inclusive.
Value parameters
- angularBoundaryBehavior
-
when true, treats the boundary as circular (e.g., for angles), otherwise treats it as standard numeric behavior
- inclusive
-
if true, both min and max are valid; if false, max is excluded, unless boundaryBehavior specifies otherwise.
- max
-
the upper bound of the modulation range
- min
-
the lower bound of the modulation range
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
MonadicOperation to negate a Number.
MonadicOperation to negate a Number.
NOTE: not valid on NatLog-scaled values.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
This monadic operation is used to scale a Value by a Rational. CONSIDER eliminating this unused operation.
This monadic operation is used to scale a Value by a Rational. CONSIDER eliminating this unused operation.
Value parameters
- r
-
the scale factor (a Rational).
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
MonadicOperation to calculate the sine of a Number. The number is a factor of pi, i.e. it is in radians.
MonadicOperation to calculate the sine of a Number. The number is a factor of pi, i.e. it is in radians.
NOTE that this evaluator for sine is not as useful as the evaluator in the Number class. That's because this type of operation does not change the factor.
CONSIDER allow Monadic operations to change factor.
See https://en.wikipedia.org/wiki/List_of_trigonometric_identities
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
-
MonadicOperationSin.type
MonadicOperation to yield the square root of a Number.
MonadicOperation to yield the square root of a Number.
CONSIDER eliminating this and using power only.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MonadicOperationtrait Operationclass Objecttrait Matchableclass AnyShow all
- Self type
-
MonadicOperationSqrt.type
This factor essentially provides log/exponent arithmetic.
This factor essentially provides log/exponent arithmetic.
NOTE: A number in factor NatLog will evaluate as e raised to that power. So, the value is the natural log of the evaluation.
Thus the range of such values is any positive number.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Logarithmictrait Factorclass Objecttrait Matchableclass AnyShow all
- Self type
-
NatLog.type
Represents an abstract base class for mathematical root operations by extending InversePower.
Represents an abstract base class for mathematical root operations by extending InversePower.
A number with value x and factor InversePower(n) represents the nth root of x where n is a Rational. For example, ExactNumber(5, SquareRoot) is the square root of 5, where SquareRoot is an alias for NthRoot(2).
The NthRoot class encapsulates the concept of a mathematical nth root and provides methods to retrieve the degree of the root. It is intended to be extended by concrete implementations that define specific behaviors for inverse power computation.
Value parameters
- n
-
the integer value representing the nth root degree.
Attributes
- Constructor
-
Creates a new instance of the
NthRootclass with the specified root degree. - Companion
- object
- Supertypes
- Known subtypes
-
object CubeRootobject SquareRoot
Represents the companion object for the NthRoot class.
Represents an operation in a system. This trait serves as a base for different types of operations that can be implemented. Being sealed, all implementations must be defined in the same file, ensuring exhaustive pattern matching.
Represents an operation in a system. This trait serves as a base for different types of operations that can be implemented. Being sealed, all implementations must be defined in the same file, ensuring exhaustive pattern matching.
Use this trait to model behaviors or actions that can be carried out, ensuring type safety and enabling pattern matching on specific operations.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait DyadicOperationobject DyadicOperationPlusobject DyadicOperationPowerobject DyadicOperationTimestrait MonadicOperationclass MonadicOperationAtanobject MonadicOperationExpclass MonadicOperationFuncobject MonadicOperationInvertobject MonadicOperationLogclass MonadicOperationModulateobject MonadicOperationNegateclass MonadicOperationScaleobject MonadicOperationSinobject MonadicOperationSqrtShow all
Object providing operations to evaluate dyadic and monadic functions on values, as well as query transformations.
Object providing operations to evaluate dyadic and monadic functions on values, as well as query transformations.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Operations.type
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
The Percent object represents the percentage scalar. It serves as a factor for scaling values, interpreting them as percentages.
The Percent object represents the percentage scalar. It serves as a factor for scaling values, interpreting them as percentages.
Attributes
- Supertypes
- Self type
-
Percent.type
A case object representing the pure number 1. PureNumber extends the Scalar trait and behaves as a unit scalar factor.
A case object representing the pure number 1. PureNumber extends the Scalar trait and behaves as a unit scalar factor.
CONSIDER expanding to include a DecimalNumber as well as a PureNumber (which logically should be represented in binary). Just because we can represent something exactly in binary doesn't mean we can represent it in decimal (and vice versa).
This object encapsulates the value of 1, providing a representation of a pure scalar. It includes functionality to render a string representation of a value.
Attributes
- Supertypes
- Self type
-
PureNumber.type
Trait for the query functions: three functions, corresponding to the functions for Int, Rational and Double representations.
Trait for the query functions: three functions, corresponding to the functions for Int, Rational and Double representations.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Definitions of QueryOperations.
Definitions of QueryOperations.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
A query operation that determines whether a given value is infinite. This object extends QueryOperation[Boolean] and provides a set of query functions, implemented in BooleanQueryFunctions, to handle Int, Rational, and Double input types.
A query operation that determines whether a given value is infinite. This object extends QueryOperation[Boolean] and provides a set of query functions, implemented in BooleanQueryFunctions, to handle Int, Rational, and Double input types.
Specifically:
- For
Intinputs, this operation always returnsfalsesince integers cannot be infinite. - For
Rationalinputs, it checks whether the rational number represents infinity. - For
Doubleinputs, it checks for positive or negative infinity.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait QueryOperation[Boolean]class Objecttrait Matchableclass AnyShow all
- Self type
QueryOperationIsZero is a specific implementation of the QueryOperation trait for operations that check whether a given numeric value is equal to zero.
QueryOperationIsZero is a specific implementation of the QueryOperation trait for operations that check whether a given numeric value is equal to zero.
This case object provides functions for Int, Rational, and Double inputs, determining if the numeric value is zero. The results of these functions are encapsulated in a Try to capture potential exceptions during the operation.
The behavior of the functions is defined as follows:
- For
Int, it checks if the value is equal to 0. - For
Rational, it checks if the signum of the value is 0. - For
Double, it checks if the sign is 0 or -0, accounting for floating-point representation.
This implementation ensures consistent behavior across different numeric types while providing failure handling through the Try wrapper.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait QueryOperation[Boolean]class Objecttrait Matchableclass AnyShow all
- Self type
-
QueryOperationIsZero.type
QueryOperationSignum is a concrete implementation of QueryOperation for integer results. It provides functionality to compute the signum of a numeric value (positive, negative, or zero) for various numeric types: Int, Rational, and Double.
QueryOperationSignum is a concrete implementation of QueryOperation for integer results. It provides functionality to compute the signum of a numeric value (positive, negative, or zero) for various numeric types: Int, Rational, and Double.
The class defines a set of query functions encapsulated in an IntQueryFunctions instance. These functions leverage the math.signum operation for Int and Double, and the .signum method for Rational, with error handling provided through Try.
Specifically:
- For
Intinputs, it usesmath.signumdirectly. - For
Rationalinputs, it computes the signum using thesignummethod ofRational. - For
Doubleinputs, it usesmath.signumand converts the result to an integer.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait QueryOperation[Int]class Objecttrait Matchableclass AnyShow all
- Self type
-
QueryOperationSignum.type
This factor is primarily used for rotation by an angle.
This factor is primarily used for rotation by an angle.
A number x with factor Radian (theoretically) evaluates to e raised to the power ix. So, you could think of it as essentially a shorthand for writing both cosine and sine. NOTE however that, unlike, with the factor NatLog, we currently do not treat Radian values in quite this way in the code.
CONSIDER implementing the Radian factor conversions in a manner similar to that of NatLog. This would entail conversion from a single number to a pair of Doubles when going from Radian to PureNumber. We could do that using a Complex number but I'd rather do it as a 2-tuple of Doubles. Perhaps the whole idea of our Complex implementation is misguided (although it does allow us to represent complex numbers in Polar form since, in that case, the real part is a PureNumber number, and the imaginary part is coded in with factor Radian).
The range of these values is 0 thru 2, which represents the radian values of 0 thru 2pi.
Attributes
- Supertypes
- Self type
-
Radian.type
Companion object to Rational. Represents a Rational number, with various methods for conversion, approximation, and utility. Provides a rich set of operations and utilities to handle rational numbers, convert data types, and manage normalization. Rational numbers are represented as fractions with BigInt numerator and denominator.
Companion object to Rational. Represents a Rational number, with various methods for conversion, approximation, and utility. Provides a rich set of operations and utilities to handle rational numbers, convert data types, and manage normalization. Rational numbers are represented as fractions with BigInt numerator and denominator.
Fields:
- bigZero: Commonly used representation for Rational zero.
- bigOne: Commonly used representation for Rational one.
- bigTwo: Commonly used representation for Rational two.
- bigThree: Commonly used representation for Rational three.
- bigFour: Commonly used representation for Rational four.
- bigFive: Commonly used representation for Rational five.
- bigSeven: Commonly used representation for Rational seven.
- bigNegOne: Commonly used representation for Rational negative one.
- bigTen: Commonly used representation for Rational ten.
- zero: Rational representation for zero.
- infinity: Positive infinity in Rational form.
- negInfinity: Negative infinity in Rational form.
- one: Rational representation for one.
- ten: Rational representation for ten.
- two: Rational representation for two.
- half: Rational representation for one-half.
- NaN: Represents "Not a Number" in Rational form.
- negZero: Represents negative zero in Rational form.
- negZeroDouble: Represents negative zero as a Double in Rational form.
- pi_5000: Predefined Rational representation of π/5000.
- squareRoots: A collection of predefined square root values in Rational form.
Attributes
Rational: a case class that represents rational numbers by a BigInt numerator and a BigInt denominator. The numerator (n) and the denominator (d) may not share a common factor: if you try to construct a Rational with new where there is a common factor, then an exception will be thrown. However, all the apply methods ensure valid Rational instances by factoring out any common factors. Similarly, the denominator may not be negative: again, the apply methods will take care of this situation. This is the reason that the constructor of Rational is marked package-private.
Rational: a case class that represents rational numbers by a BigInt numerator and a BigInt denominator. The numerator (n) and the denominator (d) may not share a common factor: if you try to construct a Rational with new where there is a common factor, then an exception will be thrown. However, all the apply methods ensure valid Rational instances by factoring out any common factors. Similarly, the denominator may not be negative: again, the apply methods will take care of this situation. This is the reason that the constructor of Rational is marked package-private.
The domain of Rational includes values with a zero value in the denominator and any numerator (either -ve or +ve infinity) as well as the value with 0 as both the numerator and denominator (NaN).
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait NumberLikeclass Objecttrait Matchableclass AnyShow all
Exception class for Rationals.
Exception class for Rationals.
Value parameters
- s
-
the cause as a String.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Extension methods for Rational to support floor and ceiling operations.
Extension methods for Rational to support floor and ceiling operations.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RationalFloor.type
The Render object provides functionality to render various value types as a formatted string, along with a flag indicating whether the value could be rendered exactly or approximately.
The Render object provides functionality to render various value types as a formatted string, along with a flag indicating whether the value could be rendered exactly or approximately.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Render.type
A case class that represents a restricted evaluation context for a specific Factor.
A case class that represents a restricted evaluation context for a specific Factor.
The RestrictedContext is a specialized Context implementation that confines its qualifications to a single Factor. It determines whether a given factor matches the specific factor (context) it was instantiated with. This ensures that only evaluations respecting this restricted context are allowed.
Value parameters
- context
-
the specific factor that defines the restrictive context. Only factors matching this will qualify.
Attributes
- Constructor
-
Creates a
RestrictedContextwith a predefinedFactorto enforce context-based restrictions. - Supertypes
-
trait Serializabletrait Producttrait Equalstrait CoreContextclass Objecttrait Matchableclass AnyShow all
Trait to define a Factor which is a scalar (something that can be scaled by a pure number).
Companion object for the Scalar trait, providing utility methods.
This object represents the square root factor.
This object represents the square root factor.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass NthRoottrait InversePowertrait Factorclass Objecttrait Matchableclass AnyShow all
- Self type
-
SquareRoot.type
Value class to define Tolerance.
Value class to define Tolerance.
Value parameters
- maxDenom
-
used in the approximation of an irrational number -- whereby the denominator is limited to approximately this value.
- x
-
the tolerance (epsilon) value.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
This object provides methods related to the type Value.
This object provides methods related to the type Value.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Value.type
The VulgarFraction object provides a mapping of common fractional values to their corresponding Unicode vulgar fraction characters. It also includes functionality to extract a Unicode representation of a vulgar fraction from a given Rational number.
The VulgarFraction object provides a mapping of common fractional values to their corresponding Unicode vulgar fraction characters. It also includes functionality to extract a Unicode representation of a vulgar fraction from a given Rational number.
This object uses a predefined Map of numerator and denominator pairs to their Unicode character equivalents.
The primary use case for this object is working with Rational numbers and converting them to their Unicode vulgar fraction representation when applicable.
Functionality:
- Provides the mapping of common fractions to Unicode vulgar fraction characters.
- Extracts a Unicode vulgar fraction character from a
Rationalnumber when possible.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
VulgarFraction.type
Types
Type alias for the Boolean query functions.
Type alias for the Boolean query functions.
Attributes
Type alias for the dyadic functions, a tuple of three functions, corresponding to the functions for Int, Rational and Double representations.
Type alias for the dyadic functions, a tuple of three functions, corresponding to the functions for Int, Rational and Double representations.
Attributes
Type alias for the Int query functions.
Type alias for the Int query functions.
Attributes
Type alias for the monadic functions, a tuple of three functions, corresponding to the functions for Int, Rational and Double representations.
Type alias for the monadic functions, a tuple of three functions, corresponding to the functions for Int, Rational and Double representations.
Attributes
Represents an intermediate numerical form, consisting of:
Represents an intermediate numerical form, consisting of:
- A
Value, representing the numerical component. - A
Factor, providing the contextual framework for interpretation (e.g., units, dimensions, basis of representation). - An optional
Fuzziness[Double], describing any associated uncertainty or imprecision.
This type is used throughout various computations and transformations to encapsulate numeric quantities, their interpretive factors, and any associated tolerance or fuzziness.
Attributes
This is the type of the nominalValue parameter of a GeneralNumber. CONSIDER redefining this as a class rather than as a type alias.
This is the type of the nominalValue parameter of a GeneralNumber. CONSIDER redefining this as a class rather than as a type alias.
There is a companion object to this type in module Value.scala.