com.phasmidsoftware.number.algebra.eager

Members list

Type members

Classlikes

object Algebraic

Represents a mathematical solution, which can be either linear or quadratic in nature. This object provides factory methods for creating instances of Algebraic.

Represents a mathematical solution, which can be either linear or quadratic in nature. This object provides factory methods for creating instances of Algebraic.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Algebraic.type
sealed trait Algebraic extends Solution, Unitary, Scalable[Algebraic]

Trait to model the behavior of a solution to an equation. All such solutions are exact. Typically, however, such solutions cannot be represented exactly as pure numbers. The four parameters of a Algebraic are: base, offset, coefficient, and factor. Solutions are subject to various operations such as addition, scaling, and number conversions. Extends the NumberLike trait, inheriting behavior common to number-like entities.

Trait to model the behavior of a solution to an equation. All such solutions are exact. Typically, however, such solutions cannot be represented exactly as pure numbers. The four parameters of a Algebraic are: base, offset, coefficient, and factor. Solutions are subject to various operations such as addition, scaling, and number conversions. Extends the NumberLike trait, inheriting behavior common to number-like entities.

CONSIDER why is there so much dependence on the core module here? We shouldn't need that at all!

Attributes

Companion
object
Supertypes
trait Solution
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes

A case class representing an angle in radians. This class implements the Additive and Radians traits, allowing operations such as addition, subtraction, and various type conversions. Angle represents the "circle group," which is a compact Abelian (commutative) group under angle addition, where the addition wraps around the circle. It is compact in that it is bounded by -𝛑 and 𝛑 (-180° and 180°). It is also commutative in that the order of addition is irrelevant. The circle group is a subset of the real numbers. The degrees attribute of an Angle is only of interest in the following situations:

A case class representing an angle in radians. This class implements the Additive and Radians traits, allowing operations such as addition, subtraction, and various type conversions. Angle represents the "circle group," which is a compact Abelian (commutative) group under angle addition, where the addition wraps around the circle. It is compact in that it is bounded by -𝛑 and 𝛑 (-180° and 180°). It is also commutative in that the order of addition is irrelevant. The circle group is a subset of the real numbers. The degrees attribute of an Angle is only of interest in the following situations:

  • when the Angle is parsed from a String, the degrees attribute is set according to whether the degree symbol is present.
  • when the Angle is converted to a String, the degrees attribute is used to determine whether to use degrees or radians.

Angle does not support ordering or (general) comparison.

Value parameters

degrees

whether the angle is in radians or degrees. In the latter case, the number attribute is unchanged (1 is still half of a full circle).

number

the value of the angle in radians

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait CanAdd[Angle, Angle]
trait Can[Angle]
trait Scalable[Angle]
trait Circle
trait R
trait Radians
trait Functional
trait Ordered[Functional]
trait Comparable[Functional]
trait MaybeFuzzy
trait Scalar
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
object Angle

The Angle companion object contains utility methods, predefined constants, and typeclass instances for working with angles. Angles are represented using rational numbers and comply with the algebraic structure of a commutative group.

The Angle companion object contains utility methods, predefined constants, and typeclass instances for working with angles. Angles are represented using rational numbers and comply with the algebraic structure of a commutative group.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Angle.type
case class BinaryExponential(exponent: Number)(maybeName: Option[String] = ...) extends Exponential

Represents a binary exponential number structure, extending the Exponential class with operations and transformations specifically relevant to base-2 exponential numbers.

Represents a binary exponential number structure, extending the Exponential class with operations and transformations specifically relevant to base-2 exponential numbers.

This class provides methods to manipulate and interact with the exponential representation, including rendering, comparison, construction of new instances, and providing structural properties.

Value parameters

exponent

the exponent value for the binary exponential

maybeName

an optional name or label for the instance

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Exponential
trait Can[Exponential]
trait Transformed
trait Functional
trait Ordered[Functional]
trait Comparable[Functional]
trait MaybeFuzzy
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all

Represents a binary exponential number structure, which provides specialized operations and transformations for exponential numbers.

Represents a binary exponential number structure, which provides specialized operations and transformations for exponential numbers.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class Complex(complex: Complex)(maybeName: Option[String] = ...) extends Solution

This is a wrapper for a Complex number to demonstrate where it should appear in the type hierarchy (it should extend Solution).

This is a wrapper for a Complex number to demonstrate where it should appear in the type hierarchy (it should extend Solution).

Attributes

See also

com.phasmidsoftware.number.core.numerical.Complex

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Solution
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
object Complex

Companion object for the Complex class.

Companion object for the Complex class.

Provides utility methods and typeclass instances related to Complex, including factory methods, equality checks, and operator support.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Complex.type
object Eager

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.

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

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Eager.type

A trait representing Eager computations or values, which are eagerly evaluated and have a canonical form. The Eager trait provides mechanisms for operations such as normalization, comparisons, and arithmetic operations on values. It also includes methods to handle approximate values (fuzzy operations) and exact ones.

A trait representing Eager computations or values, which are eagerly evaluated and have a canonical form. The Eager trait provides mechanisms for operations such as normalization, comparisons, and arithmetic operations on values. It also includes methods to handle approximate values (fuzzy operations) and exact ones.

Attributes

Companion
object
Supertypes
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Nat
object NatZero
class Succ
trait Solution
trait Algebraic
class Complex
trait Structure
trait Functional
trait Radians
class Angle
trait Transformed
class Exponential
class InversePower
trait Scalar
object NoScalar
trait Number
trait ExactNumber
class WholeNumber
class Real
Show all
object Exact

Companion object for the Exact type, providing utility methods and typeclass instances.

Companion object for the Exact type, providing utility methods and typeclass instances.

The Exact object contains a strictly defined FuzzyEq instance that enforces exact equality. This implementation does not consider any probability thresholds or fuzziness levels, ensuring comparisons are deterministic and precise.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Exact.type
trait Exact extends WithFuzziness

The Exact trait represents an extension of the WithFuzziness trait, providing functionality to describe and manage fuzziness for instances requiring precise control.

The Exact trait represents an extension of the WithFuzziness trait, providing functionality to describe and manage fuzziness for instances requiring precise control.

This trait serves as a specialized version of WithFuzziness, with a default implementation overriding the fuzz method to provide a None value by default, indicating no fuzziness. It is particularly useful in cases where fuzziness is not applicable or is explicitly excluded.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait ExactNumber
class WholeNumber
object NoScalar

Represents a number that can be expressed and operated on with exactitude.

Represents a number that can be expressed and operated on with exactitude.

Subtypes of ExactNumber include WholeNumber and RationalNumber. Although some instances of Real are exact, the type in general cannot be assumed to represent an exact value.

Attributes

Supertypes
trait CanPower[Eager]
trait Q
trait R
trait Exact
trait Number
trait Ordered[Scalar]
trait Comparable[Scalar]
trait Scalar
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
abstract class Exponential(val number: Number) extends Transformed, CanAdd[Exponential, Exponential]

Represents an abstract exponential number.

Represents an abstract exponential number.

For example, for an Exponential object whose effective value is e (2.718...), then the member: number should be 1, that's to say ln(e).

The Exponential class defines properties and operations related to values that are represented internally as logarithmic values.

There are subtypes: NaturalExponential and BinaryExponential. We probably don't need DecimalExponential because we have BigDecimal as an alternative.

Value parameters

number

the numerical value defined as the logarithm of this.

Attributes

Constructor

Creates a new instance of Exponential with the specified value.

Companion
object
Supertypes
trait Can[Exponential]
trait Transformed
trait Functional
trait Ordered[Functional]
trait Comparable[Functional]
trait MaybeFuzzy
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
object Exponential

The Exponential companion object contains utility methods, predefined constants, and typeclass instances for working with Logarithms. Logarithms are represented using rational numbers and comply with the algebraic structure of a commutative group.

The Exponential companion object contains utility methods, predefined constants, and typeclass instances for working with Logarithms. Logarithms are represented using rational numbers and comply with the algebraic structure of a commutative group.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
object Extractors

The Extractors object provides utility methods and patterns for extracting or parsing data from complex structures. It is designed to streamline the process of retrieving specific information by encapsulating common extraction logic.

The Extractors object provides utility methods and patterns for extracting or parsing data from complex structures. It is designed to streamline the process of retrieving specific information by encapsulating common extraction logic.

This object is typically used when working with pattern matching, enabling concise and readable code for deconstructing data structures.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Extractors.type
trait Functional extends Structure, MaybeFuzzy, Ordered[Functional]

The Functional trait serves as an abstraction for entities that wrap Number, such as Angle, NaturalExponential, etc. These are the types that can potentially have fuzz.

The Functional trait serves as an abstraction for entities that wrap Number, such as Angle, NaturalExponential, etc. These are the types that can potentially have fuzz.

Classes or traits that extend Functional encapsulate a Number instance, providing a consistent interface to access and work with numerical values. It is particularly useful in scenarios where mathematical operations or transformations are required on numbers.

Attributes

Companion
object
Supertypes
trait Ordered[Functional]
trait Comparable[Functional]
trait MaybeFuzzy
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Radians
class Angle
trait Transformed
class Exponential
class InversePower
Show all
object Functional

Companion object for the Functional trait. It provides a FuzzyEq instance to enable fuzzy equality comparisons for instances of Functional or its subclasses.

Companion object for the Functional trait. It provides a FuzzyEq instance to enable fuzzy equality comparisons for instances of Functional or its subclasses.

Fuzzy equality allows approximate comparisons based on a specified probability threshold. This is particularly useful for entities that encapsulate numeric values and may require imprecise equivalence checks.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Functional.type
object HasImaginary

The HasImaginary object provides utilities for working with complex mathematical objects, particularly for extracting and transforming specific patterns in Eager instances.

The HasImaginary object provides utilities for working with complex mathematical objects, particularly for extracting and transforming specific patterns in Eager instances.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Represents an eager mathematical root, parameterized with an integral root degree and a base number.

Represents an eager mathematical root, parameterized with an integral root degree and a base number.

NOTE do not invoke the constructor directory: all construction should go via the apply method(s) which will normalize as appropriate.

TODO there are problems with multiplication (class cast exception, for example). Therefore, we should remove the CanMultiplyAndDivide mixin.

CONSIDER making this an (abstract?) class and having subclasses for square root and cube root.

Value parameters

n

the degree of the root, specified as an integer

number

the base Number value on which the root operation is defined

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait CanPower[Number]
trait Transformed
trait Functional
trait Ordered[Functional]
trait Comparable[Functional]
trait MaybeFuzzy
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
object InversePower

The Root companion object contains utility methods, predefined constants, and typeclass instances for working with roots. Angles are represented using rational numbers and comply with the algebraic structure of a commutative group.

The Root companion object contains utility methods, predefined constants, and typeclass instances for working with roots. Angles are represented using rational numbers and comply with the algebraic structure of a commutative group.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
object IsFinite

An object providing a custom extractor to check if a given Eager instance represents a finite value.

An object providing a custom extractor to check if a given Eager instance represents a finite value.

The IsFinite object can be used for pattern matching and extracting instances of Eager that are determined to be finite values, as determined by the absence of conditions that make it infinite.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
IsFinite.type
object IsFuzzy

Provides an extractor for identifying whether an Eager instance satisfies the isZero condition.

Provides an extractor for identifying whether an Eager instance satisfies the isZero condition.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
IsFuzzy.type
object IsImaginary

An extractor object used for pattern matching to identify and extract Eager instances that satisfy specific conditions related to imaginary or irrational numbers.

An extractor object used for pattern matching to identify and extract Eager instances that satisfy specific conditions related to imaginary or irrational numbers.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object IsInfinite

Provides a utility for extracting infinite values from an Eager instance.

Provides a utility for extracting infinite values from an Eager instance.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
IsInfinite.type
object IsInteger

Object containing utility methods for working with integers in the context of the Eager type, including a pattern matcher to extract integer values.

Object containing utility methods for working with integers in the context of the Eager type, including a pattern matcher to extract integer values.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
IsInteger.type
object IsSquareRoot

A utility object for pattern matching operations involving positive square roots. The main purpose of this object is to identify whether a given number or expression can be represented as the square root of another number.

A utility object for pattern matching operations involving positive square roots. The main purpose of this object is to identify whether a given number or expression can be represented as the square root of another number.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object IsUnity

Companion object containing a custom extractor for identifying instances of the Eager class that satisfy a specific condition defined by the isUnity method.

Companion object containing a custom extractor for identifying instances of the Eager class that satisfy a specific condition defined by the isUnity method.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
IsUnity.type
object IsZero

Provides an extractor for identifying whether an Eager instance satisfies the isZero condition.

Provides an extractor for identifying whether an Eager instance satisfies the isZero condition.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
IsZero.type

The LinearSolution object provides utility functions for creating and manipulating instances of LinearSolution. It includes methods and typeclass instances for operations such as equality comparison and fuzzy equality checks.

The LinearSolution object provides utility functions for creating and manipulating instances of LinearSolution. It includes methods and typeclass instances for operations such as equality comparison and fuzzy equality checks.

The object also initializes the logger and defines givens for specific typeclass operations such as DyadicOperator, Eq, and FuzzyEq, allowing more advanced handling of LinearSolution instances.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class LinearSolution(value: Structure)(maybeName: Option[String] = ...) extends Algebraic

Represents a linear solution characterized by a single value. Implements the Algebraic trait where the base is equal to the value, the offset is Value.zero, and the factor is PureNumber. CONSIDER we should not have to deal with offset, factor, negative attributes here.

Represents a linear solution characterized by a single value. Implements the Algebraic trait where the base is equal to the value, the offset is Value.zero, and the factor is PureNumber. CONSIDER we should not have to deal with offset, factor, negative attributes here.

Value parameters

value

the base value of the solution

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Algebraic
trait Solution
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
sealed trait Nat extends Eager, N

Represents natural numbers using Peano arithmetic.

Represents natural numbers using Peano arithmetic.

The Nat trait has two possible subtypes:

  • NatZero, representing the number 0.
  • Succ, representing the successor of another Nat (e.g., Succ(NatZero) represents 1, Succ(Succ(NatZero)) represents 2, and so on).

This encoding provides a type-level representation of natural numbers that can be used in functional programming constructs.

Operations on natural numbers, such as addition and multiplication, can be defined recursively via pattern matching.

CONSIDER increasing the use of the asInt value for better performance. But note that doing that destroys the Peano aspect of this class (keep in mind that we also have WholeNumber).

Attributes

Companion
object
Supertypes
trait N
trait Z
trait Q
trait R
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
object NatZero
class Succ
object Nat

Provides a companion object for the sealed trait Nat, incorporating utility methods and type class instances for handling natural numbers defined via Peano arithmetic.

Provides a companion object for the sealed trait Nat, incorporating utility methods and type class instances for handling natural numbers defined via Peano arithmetic.

The object includes an implicit implementation of the Semiring type class, which introduces algebraic operations such as addition and multiplication specifically tailored for natural numbers (Nat).

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Nat.type
case object NatZero extends Nat

Represents the natural number 0 in Peano arithmetic.

Represents the natural number 0 in Peano arithmetic.

NatZero is the base case of the Nat type, signifying the absence of any successors. It serves as the foundation for constructing all other natural numbers through the Succ type.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Nat
trait N
trait Z
trait Q
trait R
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Self type
NatZero.type
case class NaturalExponential(exponent: Number)(maybeName: Option[String] = ...) extends Exponential

A case class representing a Exponential. This class implements the Additive and Radians traits, allowing operations such as addition, subtraction, and various type conversions.

A case class representing a Exponential. This class implements the Additive and Radians traits, allowing operations such as addition, subtraction, and various type conversions.

Exponential does not support ordering or comparison.

An example of the use of this class is as in this definition of Euler's number:

 val e: Eager = NaturalExponential(WholeNumber.one)

Value parameters

x

the value of the Exponential of this instance.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Exponential
trait Can[Exponential]
trait Transformed
trait Functional
trait Ordered[Functional]
trait Comparable[Functional]
trait MaybeFuzzy
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all

Companion object for the NaturalExponential class, providing predefined constants and utility methods.

Companion object for the NaturalExponential class, providing predefined constants and utility methods.

The object contains common values associated with natural logarithmic operations and other relevant constants that can be used with Exponential instances.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case object NoScalar extends Scalar, Exact

NoScalar is a singleton object representing a special case of a Scalar that does not conform to standard scalar operations. It serves as a placeholder or non-standard entity in the scalar hierarchy, and most of its operations are unsupported or return default values.

NoScalar is a singleton object representing a special case of a Scalar that does not conform to standard scalar operations. It serves as a placeholder or non-standard entity in the scalar hierarchy, and most of its operations are unsupported or return default values.

This object extends both the Scalar and Exact traits, adhering to their respective contracts while providing specific overrides and limitations.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Exact
trait Scalar
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Self type
NoScalar.type
trait Number extends Scalar, Unitary, Ordered[Scalar]

Represents a pure number that can be compared, approximated, and converted to other types.

Represents a pure number that can be compared, approximated, and converted to other types.

Number is a trait that extends the Scalar trait, adding functionality for ordered comparison.

CONSIDER why does it not extend Ordered[Number]?

Attributes

Companion
object
Supertypes
trait Ordered[Scalar]
trait Comparable[Scalar]
trait Scalar
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
trait ExactNumber
class WholeNumber
class Real
object Number

The Number object provides predefined constants and implicit conversions related to numerical operations. It includes representations of common numbers and utilities to work with the Number type.

The Number object provides predefined constants and implicit conversions related to numerical operations. It includes representations of common numbers and utilities to work with the Number type.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Number.type
case class QuadraticSolution(base: Structure, offset: Structure, coefficient: Int, imaginary: Boolean = ...)(maybeName: Option[String] = ...) extends Algebraic

Represents a solution to a quadratic equation in the context of a specific Factor.

Represents a solution to a quadratic equation in the context of a specific Factor.

Value parameters

base

The base Value component of the solution.

offset

The offset Value component of the solution, usually derived from the discriminant. QuadraticSolution models the structure of solutions to equations of the form: x^2 + px + q = 0. It encapsulates components necessary for representing and interpreting the result in terms of its base, the offset typically arising from the quadratic formula's discriminant, and any contextual modifications by a factor. Instances of this class are designed to interact with the Factor type in performing various operations such as evaluating, converting, or rendering the solution accurately in diverse contexts.

Attributes

Constructor

Creates a new instance of QuadraticSolution.

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Algebraic
trait Solution
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all

Object containing predefined solutions to a quadratic equation and utilities.

Object containing predefined solutions to a quadratic equation and utilities.

The object includes two specific solutions (phi and psi) that are parametrized using the QuadraticSolution class, demonstrating the representation of roots of a quadratic equation. These roots are computed using predefined rational coefficients and specified root indices.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
object Radians

The Radians object provides utilities and type class instances for the Radians type. It defines operators and equality mechanisms to enable operations and comparisons for instances of Radians and its related subtypes.

The Radians object provides utilities and type class instances for the Radians type. It defines operators and equality mechanisms to enable operations and comparisons for instances of Radians and its related subtypes.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Radians.type
trait Radians extends Scalar, Functional

The Radians trait represents a scalar quantity expressed in radians, a unit of angular measure. It extends the Scalar trait, inheriting its properties and behaviors for numerical operations and comparison, while specifically associating the scalar with a conversion factor defined by Pi.

The Radians trait represents a scalar quantity expressed in radians, a unit of angular measure. It extends the Scalar trait, inheriting its properties and behaviors for numerical operations and comparison, while specifically associating the scalar with a conversion factor defined by Pi.

Attributes

Companion
object
Supertypes
trait Functional
trait Ordered[Functional]
trait Comparable[Functional]
trait MaybeFuzzy
trait Scalar
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Angle
case class RationalNumber(r: Rational, percentage: Boolean = ...)(maybeName: Option[String] = ...) extends ExactNumber, Q, CanAddAndSubtract[RationalNumber], CanMultiplyAndDivide[RationalNumber], Scalable[ExactNumber]

Represents a rational number based on the Rational type, providing various mathematical operations and utilities applicable to rational numbers.

Represents a rational number based on the Rational type, providing various mathematical operations and utilities applicable to rational numbers.

This class extends several traits to enable arithmetic operations such as addition, subtraction, multiplication, and division. It also supports comparisons, conversions, scaling, and power operations.

The class is designed to work seamlessly with precise and exact number representations, ensuring that operations maintain a high level of numeric fidelity.

CONSIDER adding a percentage flag to Real. CONSIDER merging the Rational class into this class (there's no compelling reason to have two separate classes).

Value parameters

percentage

whether this is a percentage value or not. Similarly to the degrees attribute of Angle, this is a flag that is primarily cosmetic.

r

The Rational value represented by this RationalNumber.

Attributes

Constructor

Creates a RationalNumber with the given Rational value.

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait ExactNumber
trait CanPower[Eager]
trait Q
trait R
trait Exact
trait Number
trait Ordered[Scalar]
trait Comparable[Scalar]
trait Scalar
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all

Represents a rational number with basic arithmetic operations and field properties. This class provides methods and implicit instances for managing rational numbers and their integration with mathematical abstractions such as the Field typeclass.

Represents a rational number with basic arithmetic operations and field properties. This class provides methods and implicit instances for managing rational numbers and their integration with mathematical abstractions such as the Field typeclass.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
object Real

Represents a fuzzy number, combining a numeric value with a level of fuzziness.

Represents a fuzzy number, combining a numeric value with a level of fuzziness.

A fuzzy number encapsulates imprecision or uncertainty alongside its value, and supports arithmetic operations and algebraic structure integration. Fuzzy numbers are useful in computational scenarios involving uncertainty, approximate calculations, or tolerances. This object provides factory methods, constants, and implicit type class instances for working with fuzzy numbers.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Real.type
case class Real(value: Double, fuzz: Option[Fuzziness[Double]])(maybeName: Option[String] = ...) extends Number, R, CanAddAndSubtract[Real], Scalable[Real], CanMultiplyAndDivide[Real], CanPower[Number], MaybeFuzzy

Represents a (usually) fuzzy real number, which combines a numerical value with an associated fuzziness attribute. A fuzzy number expresses imprecision or uncertainty around a central numeric value, enabling computations that consider tolerances or relative inaccuracies in mathematical operations.

Represents a (usually) fuzzy real number, which combines a numerical value with an associated fuzziness attribute. A fuzzy number expresses imprecision or uncertainty around a central numeric value, enabling computations that consider tolerances or relative inaccuracies in mathematical operations.

This class extends additive and multiplicative algebraic structures (Additive and Multiplicative traits) while implementing Number as a base trait to encapsulate numeric-like behavior.

NOTE that a Real with empty fuzz is considered to be exact.

Value parameters

fuzz

the optional fuzziness associated with the numeric value

value

the central numeric value of the fuzzy number

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait MaybeFuzzy
trait CanPower[Number]
trait Scalable[Real]
trait CanNegate[Real]
trait CanAdd[Real, Real]
trait Can[Real]
trait R
trait Number
trait Ordered[Scalar]
trait Comparable[Scalar]
trait Scalar
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
trait Scalar extends Structure

Represents a Scalar, which is a Structure that is linear with other scalar quantities and thus has a scale factor defined. Supports various mathematical operations and properties. Scalars include both exact and approximate numerical entities.

Represents a Scalar, which is a Structure that is linear with other scalar quantities and thus has a scale factor defined. Supports various mathematical operations and properties. Scalars include both exact and approximate numerical entities.

Scalar does not support ordering because not all scalars are comparable.

Multidimensional mathematical quantities such as Complex cannot be represented by a Scalar object.

Attributes

Companion
object
Supertypes
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
object NoScalar
trait Number
trait ExactNumber
class WholeNumber
class Real
trait Radians
class Angle
Show all
object Scalar

The Scalar object is a utility for creating and representing scalar values with dimensional factors, exact or approximate numerical precision, and optional fuzziness (uncertainty or imprecision).

The Scalar object is a utility for creating and representing scalar values with dimensional factors, exact or approximate numerical precision, and optional fuzziness (uncertainty or imprecision).

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Scalar.type
trait Solution extends Eager, Negatable[Solution]

Represents a Solution that is Eager, negatable, and branched with monotonic properties. This trait combines the characteristics of eagerly evaluated values, negatable structures, and entities with multiple branches (or solutions) represented by Structure.

Represents a Solution that is Eager, negatable, and branched with monotonic properties. This trait combines the characteristics of eagerly evaluated values, negatable structures, and entities with multiple branches (or solutions) represented by Structure.

Attributes

Companion
object
Supertypes
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
object Solution

Object containing functionality related to Solution, including mathematical computations and rendering solutions as LaTeX.

Object containing functionality related to Solution, including mathematical computations and rendering solutions as LaTeX.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Solution.type

Represents a Structure, which is one-dimensional Structure that supports various mathematical operations and properties. Structures include both exact and approximate numerical entities.

Represents a Structure, which is one-dimensional Structure that supports various mathematical operations and properties. Structures include both exact and approximate numerical entities.

Structure does not support ordering because not all Structures are comparable.

Multidimensional mathematical quantities like Solution cannot be represented by a Structure object.

Attributes

Companion
object
Supertypes
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Functional
trait Radians
class Angle
trait Transformed
class Exponential
class InversePower
trait Scalar
object NoScalar
trait Number
trait ExactNumber
class WholeNumber
class Real
Show all
object Structure

The Structure object serves as a companion object for the Structure class, providing common operations, typeclass instances, and supplementary functionality.

The Structure object serves as a companion object for the Structure class, providing common operations, typeclass instances, and supplementary functionality.

Key responsibilities of this object include:

  • Defining typeclass instances for equality (Eq) and fuzzy equality (FuzzyEq) for Structure types.
  • Implementing a DyadicOperator instance that provides a mechanism for combining two Structure objects, supporting both same-type and cross-type operations.
  • Logging and error handling during certain cross-type comparisons.

The Structure class represents a hierarchy of mathematical structures, including scalars, functional values, and other specific instances, and this companion object facilitates their interoperation.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Structure.type
case class Succ(pred: Nat) extends Nat

Represents the successor of a natural number in Peano arithmetic.

Represents the successor of a natural number in Peano arithmetic.

The Succ class is a case class that extends the Nat trait and signifies the successor of another natural number.

Value parameters

pred

The predecessor of this natural number, which is also a Nat.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Nat
trait N
trait Z
trait Q
trait R
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
trait Transformed extends Functional

Represents a Structure, which is a one-dimensional Structure that can be ordered and supports various mathematical operations and properties. Structures include both exact and approximate numerical entities.

Represents a Structure, which is a one-dimensional Structure that can be ordered and supports various mathematical operations and properties. Structures include both exact and approximate numerical entities.

Structure does not support ordering because not all Structures are comparable.

Multidimensional mathematical quantities such as Complex cannot be represented by a Structure object.

Attributes

Companion
object
Supertypes
trait Functional
trait Ordered[Functional]
trait Comparable[Functional]
trait MaybeFuzzy
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
object Transformed

The Transformed object provides utility methods and type class instances for working with entities of type Transformed. It includes implementations of type-safe equality and fuzzy equality, as well as the ability to handle dyadic operations between instances of Transformed or its subtypes.

The Transformed object provides utility methods and type class instances for working with entities of type Transformed. It includes implementations of type-safe equality and fuzzy equality, as well as the ability to handle dyadic operations between instances of Transformed or its subtypes.

This object defines functionality for:

  • Performing dyadic operations using contextual DyadicOperator instances.
  • Providing type class instances for equality (Eq) and fuzzy equality (FuzzyEq).
  • Handling edge cases and unsupported cross-type operations between subtypes.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
case class WholeNumber(x: BigInt)(maybeName: Option[String] = ...) extends ExactNumber, Z, CanAddAndSubtract[WholeNumber], CanMultiply[WholeNumber, WholeNumber]

A case class representing a whole number.

A case class representing a whole number.

The WholeNumber class models any integer in the Z domain and its associated operations, enabling addition, inversion, comparison, and rendering.

Value parameters

x

a BigInt value representing the whole number

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Can[WholeNumber]
trait Z
trait ExactNumber
trait CanPower[Eager]
trait Q
trait R
trait Exact
trait Number
trait Ordered[Scalar]
trait Comparable[Scalar]
trait Scalar
trait Structure
trait Eager
trait DyadicOps
trait Approximate
trait Valuable
trait TypeSafe
trait Exactitude
trait Unitary
trait Zeroable
trait Numeric
trait Renderable
class Object
trait Matchable
class Any
Show all
object WholeNumber

The WholeNumber companion object contains utility methods, predefined constants, and typeclass instances for working with WholeNumbers. WholeNumbers are represented using rational numbers and comply with the algebraic structure of a commutative group.

The WholeNumber companion object contains utility methods, predefined constants, and typeclass instances for working with WholeNumbers. WholeNumbers are represented using rational numbers and comply with the algebraic structure of a commutative group.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type