com.phasmidsoftware.number.core.numerical
Members list
Type members
Classlikes
The AbsoluteFuzz companion object provides utility methods and values related to absolute fuzziness.
The AbsoluteFuzz companion object provides utility methods and values related to absolute fuzziness.
This object includes a private regular expression pattern, numberR, which is used for identifying and matching numbers in scientific notation (e.g., "-1.23E+3").
The AbsoluteFuzz object serves as a utility companion to the AbsoluteFuzz class, enabling various operations involving fuzziness and numerical representation, typically in the context of scientific computation and numerical analysis.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
AbsoluteFuzz.type
Absolute Fuzziness.
Absolute Fuzziness.
Type parameters
- T
-
the underlying type of the fuzziness. Usually Double for fuzzy numerics.
Value parameters
- magnitude
-
the magnitude of the fuzz.
- shape
-
the shape of the fuzz.
Attributes
Represents an abstract mathematical series, inheriting from the Series trait. Provides methods for evaluating the series and accessing individual terms. This class facilitates the representation and evaluation of a series where terms are of type X and are subject to numerical operations.
Represents an abstract mathematical series, inheriting from the Series trait. Provides methods for evaluating the series and accessing individual terms. This class facilitates the representation and evaluation of a series where terms are of type X and are subject to numerical operations.
Type parameters
- X
-
The type of elements in the series, which must have a
Numerictype-class instance.
Value parameters
- terms
-
A sequence representing the terms of the mathematical series.
Attributes
- Supertypes
- Known subtypes
-
class InfiniteSeries[X]
Represents an abstract mathematical series, inheriting from the Series trait. Provides methods for evaluating the series and accessing individual terms. This class facilitates the representation and evaluation of a series where terms are of type X and are subject to numerical operations.
Represents an abstract mathematical series, inheriting from the Series trait. Provides methods for evaluating the series and accessing individual terms. This class facilitates the representation and evaluation of a series where terms are of type X and are subject to numerical operations.
Type parameters
- X
-
The type of elements in the series, which must have a
Numerictype-class instance.
Value parameters
- terms
-
A sequence representing the terms of the mathematical series.
Attributes
- Supertypes
- Known subtypes
-
class FiniteSeries[X]
The Approximatable trait provides a mechanism to compute an approximate numerical value of a numerical entity. It is intended for cases where the magnitude is required, but it doesn't need to be exact.
The Approximatable trait provides a mechanism to compute an approximate numerical value of a numerical entity. It is intended for cases where the magnitude is required, but it doesn't need to be exact.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait Fieldtrait Multivariatetrait Complexclass BaseComplexclass ComplexCartesianclass ComplexPolarclass Realobject NaNShow all
Companion object to BaseComplex.
Companion object to BaseComplex.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BaseComplex.type
Abstract base class which implements Complex.
Abstract base class which implements Complex.
Value parameters
- imag
-
the imaginary component.
- real
-
the real component.
Attributes
- Companion
- object
- Supertypes
-
trait Complextrait Multivariatetrait Fieldtrait Ordered[Field]trait Comparable[Field]trait Approximatabletrait Numericaltrait NumberLikeclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class ComplexCartesianclass ComplexPolar
Uniform probability density over a specific range, otherwise zero. CONSIDER making this a case class with a member corresponding to the l value of wiggle.
Uniform probability density over a specific range, otherwise zero. CONSIDER making this a case class with a member corresponding to the l value of wiggle.
Attributes
Trait which defines the behavior of a type of Field called a Complex. A Complex is a Field and also supports the various methods defined below.
Trait which defines the behavior of a type of Field called a Complex. A Complex is a Field and also supports the various methods defined below.
Attributes
- Companion
- object
- Supertypes
-
trait Multivariatetrait Fieldtrait Ordered[Field]trait Comparable[Field]trait Approximatabletrait Numericaltrait NumberLikeclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Case class to represent a Cartesian complex object.
Case class to represent a Cartesian complex object.
Value parameters
- x
-
the real part.
- y
-
the imaginary part.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass BaseComplextrait Complextrait Multivariatetrait Fieldtrait Ordered[Field]trait Comparable[Field]trait Approximatabletrait Numericaltrait NumberLikeclass Objecttrait Matchableclass AnyShow all
Companion object to ComplexCartesian.
Companion object to ComplexCartesian.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ComplexCartesian.type
A case class representing a custom exception type called ComplexException.
A case class representing a custom exception type called ComplexException.
This exception is initialized with a string message that describes the error.
Value parameters
- str
-
The message associated with this exception.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Companion object for the ComplexPolar class. Provides factory methods for creating instances of ComplexPolar with various parameters.
Companion object for the ComplexPolar class. Provides factory methods for creating instances of ComplexPolar with various parameters.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ComplexPolar.type
Class to represent a family of Complex numbers in polar form. An instance of this class actually represents n different complex numbers.
Class to represent a family of Complex numbers in polar form. An instance of this class actually represents n different complex numbers.
Value parameters
- n
-
the number of "branches" in this set of complex numbers.
- r
-
the real part (the magnitude) of the number(s).
- theta
-
the imaginary part (the angle) of the 0th branch of the number.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass BaseComplextrait Complextrait Multivariatetrait Fieldtrait Ordered[Field]trait Comparable[Field]trait Approximatabletrait Numericaltrait NumberLikeclass Objecttrait Matchableclass AnyShow all
Definitions of constant fields.
Definitions of constant fields.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Constants.type
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Object containing an implicit class which can be used to determine factorization.
Object containing an implicit class which can be used to determine factorization.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Divides.type
This class is designed to model an exact Numeral. See GeneralNumber for more details on the actual representation.
This class is designed to model an exact Numeral. See GeneralNumber for more details on the actual representation.
TODO implement scientific notation by having factors such os 10∧3, 10∧6, etc. (alternatively, add a separate parameter)
Value parameters
- factor
-
the scale factor of the Number: valid scales are: PureNumber, Radian, and NatLog.
- nominalValue
-
the nominalValue of the Number, expressed as a nested Either type.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass GeneralNumbertrait Numbertrait Numericaltrait NumberLiketrait Ordered[Number]trait Comparable[Number]trait Fuzz[Double]trait WithFuzzinessclass Objecttrait Matchableclass AnyShow all
Companion object for the ExactNumber class.
Companion object for the ExactNumber class.
Provides factory methods for creating instances of ExactNumber. These methods allow creation with a given Factor or default to the PureNumber factor. This object encapsulates logic to initialize ExactNumber instances with consistent internal representations and initializes the required values.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ExactNumber.type
Companion object Field provides utility methods and implicit conversions for the Field type. It also acts as a container for implicit definitions and helpers relating to the Field type.
Trait which describes the behavior of all Numbers and Complex instances. See https://en.wikipedia.org/wiki/Field_(mathematics).
Trait which describes the behavior of all Numbers and Complex instances. See https://en.wikipedia.org/wiki/Field_(mathematics).
The operations supported are addition, subtraction, multiplication and division. By inference, we should be able to raise an instance of Field to a numeric power.
TODO it is inappropriate to extend Ordered here since complex numbers do not have an intrinsic order.
Attributes
- Companion
- object
- Supertypes
-
trait Ordered[Field]trait Comparable[Field]trait Approximatabletrait Numericaltrait NumberLikeclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait Multivariatetrait Complexclass BaseComplexclass ComplexCartesianclass ComplexPolarclass Realobject NaNShow all
Represents a finite power series, a mathematical series with a finite number of terms, where each term is a power of a variable multiplied by a coefficient.
Represents a finite power series, a mathematical series with a finite number of terms, where each term is a power of a variable multiplied by a coefficient.
Type parameters
- X
-
the type of the variable used in the series
- Y
-
the type of the coefficients and the resulting terms of the series
Value parameters
- coefficients
-
the coefficients of the power series, corresponding to each term
- f
-
a function applied to the powers of the variable, which modifies each term in the series
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents a finite mathematical series with a fixed number of terms.
Represents a finite mathematical series with a fixed number of terms.
This case class models a series consisting of a finite number of terms, which are stored in a list. Each term in the series is of type X, constrained by an implicit Numeric type-class for numerical operations.
Type parameters
- X
-
The type of the elements (terms) in the series, which must have an associated
Numerictype-class.
Value parameters
- terms
-
A list of terms that make up the series.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass AbstractSeries[X]trait Series[X]class Objecttrait Matchableclass AnyShow all
Trait which models the behavior of something with (maybe) fuzziness.
Trait which models the behavior of something with (maybe) fuzziness.
See also related trait Fuzzy[X] but note that there, the parametric type X corresponds to the quantity itself, not its fuzziness.
Type parameters
- T
-
the type of fuzziness.
Attributes
- Supertypes
- Known subtypes
This trait models the behavior of fuzziness.
This trait models the behavior of fuzziness.
See also related trait Fuzzy[X].
Type parameters
- T
-
the underlying type of the fuzziness. Usually Double for fuzzy numerics.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class AbsoluteFuzz[T]class RelativeFuzz[T]
A companion object to Fuzziness providing methods to manage and manipulate fuzziness in calculations and numeric operations. Fuzziness represents a level of uncertainty or imprecision associated with a value.
A companion object to Fuzziness providing methods to manage and manipulate fuzziness in calculations and numeric operations. Fuzziness represents a level of uncertainty or imprecision associated with a value.
Attributes
Type class which adds fuzzy behavior to a type X.
Type class which adds fuzzy behavior to a type X.
Type parameters
- X
-
the type to be made fuzzy.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object FieldIsFuzzyobject NumberIsFuzzy
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
FuzzyDouble.type
Represents a numeric value with an optional level of fuzziness or uncertainty. Fuzziness quantifies the margin of error or uncertainty associated with the value. NOTE that this class has no obvious "raison d'etre." It is structurally the same as Real in the algebra module, but missing a lot of functionality. CONSIDER eliminating this class.
Represents a numeric value with an optional level of fuzziness or uncertainty. Fuzziness quantifies the margin of error or uncertainty associated with the value. NOTE that this class has no obvious "raison d'etre." It is structurally the same as Real in the algebra module, but missing a lot of functionality. CONSIDER eliminating this class.
Value parameters
- fuzz
-
An optional fuzziness object that describes the level and type of uncertainty.
- x
-
The numeric value represented by this instance.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Fuzz[Double]trait WithFuzzinessclass Objecttrait Matchableclass AnyShow all
The FuzzyNumber companion object provides operations and utilities for working with fuzzy numbers, enabling probabilistic and inexact computations. It includes methods for comparison, arithmetic, and adding fuzziness to numbers.
The FuzzyNumber companion object provides operations and utilities for working with fuzzy numbers, enabling probabilistic and inexact computations. It includes methods for comparison, arithmetic, and adding fuzziness to numbers.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
FuzzyNumber.type
This class is designed to model a fuzzy Number. See GeneralNumber for more details on the actual representation.
This class is designed to model a fuzzy Number. See GeneralNumber for more details on the actual representation.
CONSIDER FuzzyNumber should be the "norm." ExactNumber is just a fuzzy number with None for fuzz. I suspect that this inversion of logic might be the cause of some stack overflows that occur for some ignored tests.
TODO ensure that every Double calculation contributes fuzziness.
NOTE it is not necessary to override compareTo because the operative method is signum for all Number comparisons, and that is overridden here.
CONSIDER implementing equals (but be careful!). Don't implement it in terms of compare(...)==0 or Same.
Value parameters
- factor
-
the scale factor of the Number: valid scales are: PureNumber, Radian, and NatLog.
- fuzz
-
the fuzziness of this Number.
- nominalValue
-
the (nominal) value of the Number, expressed as a nested Either type.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass GeneralNumbertrait Numbertrait Numericaltrait NumberLiketrait Ordered[Number]trait Comparable[Number]trait Fuzz[Double]trait WithFuzzinessclass Objecttrait Matchableclass AnyShow all
A specific type of exception that is thrown to indicate an error related to fuzzy number operations or validations.
A specific type of exception that is thrown to indicate an error related to fuzzy number operations or validations.
Value parameters
- str
-
The error message that provides details about the exception.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
A "normal" probability distribution function. CONSIDER making this a case class with a member corresponding to the l value of wiggle.
A "normal" probability distribution function. CONSIDER making this a case class with a member corresponding to the l value of wiggle.
Attributes
The GeneralNumber object provides utility methods for performing various operations on numbers with particular emphasis on exact, fuzzy, and generalized numeric types. It aims to handle operations in a flexible way based on the types and factors associated with numbers.
The GeneralNumber object provides utility methods for performing various operations on numbers with particular emphasis on exact, fuzzy, and generalized numeric types. It aims to handle operations in a flexible way based on the types and factors associated with numbers.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
GeneralNumber.type
This class is designed to model a Numerical value of various possible different types and of various possible factors. The types are: Int, BigInt, Rational, Double. The factors are: Scalar, Logarithmic, and NthRoot (with various subtypes).
This class is designed to model a Numerical value of various possible different types and of various possible factors. The types are: Int, BigInt, Rational, Double. The factors are: Scalar, Logarithmic, and NthRoot (with various subtypes).
TODO continue refactoring to merge similar methods, particularly in GeneralNumber and FuzzyNumber.
Value parameters
- factor
-
the scale factor of the Number: valid scales are: PureNumber, Radian, and NatLog.
- fuzz
-
the (optional) fuzziness of this Number.
- nominalValue
-
the nominalValue of the Number, expressed as a nested Either type.
Attributes
- Companion
- object
- Supertypes
-
trait Numbertrait Numericaltrait NumberLiketrait Ordered[Number]trait Comparable[Number]trait Fuzz[Double]trait WithFuzzinessclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class ExactNumberclass FuzzyNumber
- Self type
Object providing utility methods related to Goldbach's conjecture.
Object providing utility methods related to Goldbach's conjecture.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Goldbach.type
Type class trait HasValue[T].
Type class trait HasValue[T].
This is used to represent quantities of different underlying units/dimensions.
Type parameters
- T
-
the underlying type of this HasValue.
Attributes
- Companion
- object
- Supertypes
-
trait Fractional[T]trait Numeric[T]trait Ordering[T]trait PartialOrdering[T]trait Equiv[T]trait Serializabletrait Comparator[T]class Objecttrait Matchableclass AnyShow all
- Known subtypes
Companion object for the HasValue type class.
Companion object for the HasValue type class.
This object provides an implicit implementation of the HasValue type class for Double values through the HasValueDouble trait.
The HasValue type class is designed to represent a type that can interoperate with fractional operations, scaling, normalization, and rendering to a string.
Attributes
Trait HasValueDouble provides functionality for manipulating Double values within the context of the HasValue type class. It extends the behavior of HasValue[Double], DoubleIsFractional, and Ordering.Double.IeeeOrdering to work specifically with Double-typed quantities, offering operations like rendering, scaling, and normalizing Double values.
Trait HasValueDouble provides functionality for manipulating Double values within the context of the HasValue type class. It extends the behavior of HasValue[Double], DoubleIsFractional, and Ordering.Double.IeeeOrdering to work specifically with Double-typed quantities, offering operations like rendering, scaling, and normalizing Double values.
The default implementation of render provides a convenient string representation of a Double, either in fixed-point or scientific notation depending on the value.
Attributes
- Supertypes
-
trait IeeeOrderingtrait DoubleIsFractionaltrait HasValue[Double]trait Fractional[Double]trait Numeric[Double]trait Ordering[Double]trait PartialOrdering[Double]trait Equiv[Double]trait Serializabletrait Comparator[Double]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object HasValueDouble$
Trait HasValueNumber. Not used at present.
Trait HasValueNumber. Not used at present.
Extends the HasValue trait for values of type Number and provides additional operations specific to handling numeric values.
Attributes
- Supertypes
-
trait NumberIsFractionaltrait NumberIsNumerictrait NumberIsOrderingtrait Fractional[Number]trait Numeric[Number]trait Ordering[Number]trait PartialOrdering[Number]trait Equiv[Number]trait Serializabletrait Comparator[Number]class Objecttrait Matchableclass AnyShow all
Represents an infinite mathematical series where the terms are lazily evaluated. This class extends the AbstractSeries class and serves as a concrete implementation for series that are infinite in nature.
Represents an infinite mathematical series where the terms are lazily evaluated. This class extends the AbstractSeries class and serves as a concrete implementation for series that are infinite in nature.
Type parameters
- X
-
The type of elements in the series, which must have a
Numerictype-class instance.
Value parameters
- terms
-
A lazy sequence representing the terms of the infinite series.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass AbstractInfiniteSeries[X]trait Series[X]class Objecttrait Matchableclass AnyShow all
Represents a lazy power series that is computed on demand, using a sequence of pre-specified coefficients and a transformation function for powers of the input variable.
Represents a lazy power series that is computed on demand, using a sequence of pre-specified coefficients and a transformation function for powers of the input variable.
TESTME (not currently used)
This class allows defining power series where the terms are calculated as required, combining both the provided coefficients and a transformation of the powers of the input.
Type parameters
- X
-
the type of the input variable to the power series
- Y
-
the type of the coefficients and resulting series terms
Value parameters
- coefficients
-
a lazy, infinite list representing the coefficients of the power series
- f
-
a function used to transform the powers of the input variable
Attributes
- Supertypes
This code is attributed to: https://www.literateprograms.org/miller-rabin_primality_test__scala_.html
This code is attributed to: https://www.literateprograms.org/miller-rabin_primality_test__scala_.html
It's not idiomatic Scala but I will clean it up as we go forward.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MillerRabin.type
Represents a trait for multivariate algebraic fields. CONSIDER renaming this Algebraic.
Represents a trait for multivariate algebraic fields. CONSIDER renaming this Algebraic.
A multivariate field is characterized by being algebraic, where algebraic fields can be expressed as the root of non-zero polynomials with rational coefficients. This trait extends the behavior of a Field with additional multivariate-specific characteristics and operations.
Attributes
- Supertypes
-
trait Fieldtrait Ordered[Field]trait Comparable[Field]trait Approximatabletrait Numericaltrait NumberLikeclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Trait to model numbers as a sub-class of Field and such that we can order Numbers. That's to say that Numbers have linear domain and all belong, directly or indirectly, to the set R (real numbers).
Trait to model numbers as a sub-class of Field and such that we can order Numbers. That's to say that Numbers have linear domain and all belong, directly or indirectly, to the set R (real numbers).
Every number has three properties:
- nominalValue: Value
- factor: Factor
- fuzz: (from extending Fuzz[Double]).
Attributes
- Companion
- object
- Supertypes
-
trait Numericaltrait NumberLiketrait Ordered[Number]trait Comparable[Number]trait Fuzz[Double]trait WithFuzzinessclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Trait to define the behavior of things that are number-like.
Trait to define the behavior of things that are number-like.
CONSIDER extending Ordered[NumberLike]
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class Rationaltrait Numericaltrait Fieldtrait Multivariatetrait Complexclass BaseComplexclass ComplexCartesianclass ComplexPolarclass Realobject NaNtrait Numberclass GeneralNumberclass ExactNumberclass FuzzyNumberShow all
Companion object for the NumberLike class.
Companion object for the NumberLike class.
This object provides typeclass instances and utility methods for working with NumberLike. It includes an implicit instance of the cats.Show typeclass, allowing NumberLike objects to be easily converted to their string representation in a human-readable format.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NumberLike.type
A case class representing a polynomial of numbers, extending the generic Polynomial trait. This polynomial includes a specific degree and a sequence of coefficients.
A case class representing a polynomial of numbers, extending the generic Polynomial trait. This polynomial includes a specific degree and a sequence of coefficients.
Value parameters
- coefficients
-
a sequence of coefficients where the ith element corresponds to the coefficient of the
x∧iterm. - degree
-
the degree of the polynomial, which is the highest power of x.
- ev
-
an implicit Numeric instance providing numeric operations for the coefficient type.
Attributes
- Constructor
-
Creates a NumberPolynomial instance with the specified degree, coefficients, and an implicit Numeric instance.
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Polynomial[Number]class Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NumberPolynomial.type
Trait to define the set in which a Number has membership. Examples of sets are Z (the integers) and R (the real numbers).
Trait defining the behavior of "numerical" objects.
Trait defining the behavior of "numerical" objects.
Attributes
- Supertypes
- Known subtypes
-
trait Fieldtrait Multivariatetrait Complexclass BaseComplexclass ComplexCartesianclass ComplexPolarclass Realobject NaNtrait Numberclass GeneralNumberclass ExactNumberclass FuzzyNumberShow all
Represents a polynomial function with a numeric type parameter X. Supports evaluation, differentiation, and construction of new polynomials.
Represents a polynomial function with a numeric type parameter X. Supports evaluation, differentiation, and construction of new polynomials.
TODO create an abstract Polynomial which will have the implicit Numeric[X] value
Attributes
- Supertypes
-
trait X => Xclass Objecttrait Matchableclass Any
- Known subtypes
-
class NumberPolynomialclass RationalPolynomial
A representation of a mathematical power series which is the sum of a finite or infinite sequence terms expressed as powers of a variable.
A representation of a mathematical power series which is the sum of a finite or infinite sequence terms expressed as powers of a variable.
Attributes
- Supertypes
- Known subtypes
Class to represent a (possible) prime number. The isProbablePrime method can be invoked to test if this is probably prime (to a very high certainty). The validate method can be invoked to test if it is definitely prime (but it's expensive!)
Class to represent a (possible) prime number. The isProbablePrime method can be invoked to test if this is probably prime (to a very high certainty). The validate method can be invoked to test if it is definitely prime (but it's expensive!)
NOTE: just because we have an instance of Prime does not mean that it is a prime number.
NOTE: Prime is no longer an AnyVal because we want to have lazy val validated.
Value parameters
- n
-
the value of the (possible) prime number (should be greater than zero, although this is not checked)
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Companion object to Prime. Represents a collection of mathematical utility methods and properties related to prime numbers.
Companion object to Prime. Represents a collection of mathematical utility methods and properties related to prime numbers.
Fields:
- BigOne: Represents a constant BigInt value of 1. May be used in various calculations involving primes.
- reciprocalPeriods: Stores data related to the reciprocal periods of numbers.
- carmichaelFile: Used for maintaining or accessing data related to Carmichael numbers.
- optionalPrime: Represents an optional instance of a Prime, used where a Prime may or may not exist.
Methods:
- coprime: Determines if two BigInt values are coprime.
- lcm: Computes the least common multiple of two BigInt values.
- totient: Computes Euler's Totient function (phi) for a given BigInt or prime power.
- reducedTotient: Computes the reduced (or Carmichael) Totient function for a given BigInt or prime power.
- primeCountingFunction: Counts the number of prime numbers less than a given BigInt.
- primeCountingFunctionExact: Precisely counts the number of primes less than a given BigInt.
- multiplicativeInverse: Computes the multiplicative inverse of a BigInt modulus n.
- primeFactors: Returns a sequence of prime factors (with repetition) of a given BigInt.
- primeFactorMultiplicity: Returns a Map with prime factors and their corresponding multiplicities.
- formatWithCommas: Formats a BigInt value with a specified delimiter string.
- apply: Constructs a new Prime instance if the value is positive. Throws an exception if the value is not positive.
- create: Creates an optional Prime instance from a BigInt or String.
- createMersennePrime: Creates an optional Mersenne Prime based on the ith prime exponent.
- mersenneNumber: Computes a Mersenne number for a given exponent or prime.
- hasSmallFactor: Checks if a number has any of the smaller prime factors. Assumes the number is odd.
- isProbableOddPrime: Tests if an odd BigInt is a probable prime using the Miller-Rabin test.
- isSmallPrime: Tests if a value is one of the first one hundred primes.
- isProbablePrime: Tests if a given BigInt is a probable prime using the Miller-Rabin test.
- isCarmichaelNumber: Determines if a BigInt is a Carmichael number.
- carmichaelTheoremApplies: A private method related to the application of Carmichael's theorem.
- fill: Creates a list containing multiple copies of a given value.
- getRandomValues: Generates random BigInt values based on the input BigInt.
Attributes
A custom exception class that represents errors related to prime number calculations or validations.
A custom exception class that represents errors related to prime number calculations or validations.
Value parameters
- str
-
The message or description of the error.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Represents a prime-power factor p^r in a factorisation.
Represents a prime-power factor p^r in a factorisation.
Value parameters
- p
-
the prime base.
- r
-
the exponent (multiplicity).
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Object providing utility methods related to prime numbers, including generating primes, checking primality, applying mathematical functions, and working with predefined sets of prime numbers and special cases such as Carmichael numbers.
Object providing utility methods related to prime numbers, including generating primes, checking primality, applying mathematical functions, and working with predefined sets of prime numbers and special cases such as Carmichael numbers.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Primes.type
This class represents a stateful random number generator.
This class represents a stateful random number generator.
Value parameters
- r
-
a random source of type java.util.Random.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Companion object to RandomState.
Companion object to RandomState.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RandomState.type
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RationalPolynomial.type
Represents a rational polynomial, defined by a degree and a sequence of rational coefficients.
Represents a rational polynomial, defined by a degree and a sequence of rational coefficients.
Value parameters
- coefficients
-
A sequence of coefficients of type Rational, where the ith element corresponds to the coefficient of the
x∧iterm. - degree
-
The degree of the polynomial, representing the highest power of x.
- ev
-
An implicit Numeric instance for Rational, providing numeric operations for the coefficients.
Attributes
- Constructor
-
Creates a new rational polynomial with a specified degree and coefficients.
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Polynomial[Rational]class Objecttrait Matchableclass AnyShow all
The Real object provides a representation and associated operations for real numbers. It offers methods to create Real instances from various types (String, Int, Double, Rational), and provides several utilities, implicit conversions, and typeclass instances for operations and comparisons.
The Real object provides a representation and associated operations for real numbers. It offers methods to create Real instances from various types (String, Int, Double, Rational), and provides several utilities, implicit conversions, and typeclass instances for operations and comparisons.
Attributes
Sub-class of Field: as opposed to Complex.
Sub-class of Field: as opposed to Complex.
TODO remove (direct) Number references and replace with Real.
Value parameters
- x
-
a Number which represents the value of this Real.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Fieldtrait Ordered[Field]trait Comparable[Field]trait Approximatabletrait Numericaltrait NumberLikeclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object NaN
Relative fuzziness.
Relative fuzziness.
Type parameters
- T
-
the underlying type of the fuzziness. Usually Double for fuzzy numerics [must have HasValue].
Value parameters
- shape
-
the shape (Uniform, Gaussian, etc.)
- tolerance
-
the error bound.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Fuzziness[T]class Objecttrait Matchableclass AnyShow all
A trait representing a mathematical series, where terms can be computed and evaluated up to a certain level of precision or number of terms.
A trait representing a mathematical series, where terms can be computed and evaluated up to a certain level of precision or number of terms.
CONSIDER extending some trait like HasValue, NumberLike, Numerical, Evaluatable, or Fuzz...
Type parameters
- X
-
the type of the series terms
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class AbstractInfiniteSeries[X]class InfiniteSeries[X]class AbstractSeries[X]class FiniteSeries[X]
Describes a probability density function for a continuous distribution. NOTE: this isn't suitable for discrete distributions, obviously.
Describes a probability density function for a continuous distribution. NOTE: this isn't suitable for discrete distributions, obviously.
CONSIDER: implement additional shapes, for example O(f(x)). This would be used for the Basel problem, for example.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Companion object for the TaylorSeries class. Provides utility methods for creating instances of TaylorSeries for commonly known functions.
Companion object for the TaylorSeries class. Provides utility methods for creating instances of TaylorSeries for commonly known functions.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
TaylorSeries.type
Represents a mathematical Taylor series, a specific type of power series that approximates smooth functions near a specified point. The series is defined by its expansion point, its starting function, derivative rules for generating further terms, and a convergence tolerance.
Represents a mathematical Taylor series, a specific type of power series that approximates smooth functions near a specified point. The series is defined by its expansion point, its starting function, derivative rules for generating further terms, and a convergence tolerance.
Value parameters
- convergence
-
A value specifying the convergence tolerance of the series.
- derivative
-
A function that computes the derivative of the series function.
- point
-
The point at which the Taylor series is centered.
- startFunction
-
The initial function defining the Taylor series.
Attributes
- Constructor
-
Creates a Taylor series with the given parameters.
- Companion
- object
- Supertypes
A trapezoidal probability distribution, arising from the convolution of two Box distributions. The flat top has half-width (b-a) and the ramps extend to (a+b). NOTE: unlike Box and Gaussian which are case objects with l passed as a parameter to wiggle, Trapezoid carries its own scale parameters a and b. The l parameter of wiggle and probability is therefore ignored. TODO: at some future point, refactor Box and Gaussian similarly, moving l into the case class/object.
A trapezoidal probability distribution, arising from the convolution of two Box distributions. The flat top has half-width (b-a) and the ramps extend to (a+b). NOTE: unlike Box and Gaussian which are case objects with l passed as a parameter to wiggle, Trapezoid carries its own scale parameters a and b. The l parameter of wiggle and probability is therefore ignored. TODO: at some future point, refactor Box and Gaussian similarly, moving l into the case class/object.
Value parameters
- a
-
the half-width of the smaller of the two constituent Box distributions (a <= b).
- b
-
the half-width of the larger of the two constituent Box distributions.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Shapeclass Objecttrait Matchableclass AnyShow all
Companion object for the WithFuzziness trait.
Companion object for the WithFuzziness trait.
This object provides utility constants or values related to fuzziness. It serves as a container for any shared definitions or configuration that may support implementations of the WithFuzziness trait.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
WithFuzziness.type
Represents a trait that provides an optional fuzzy characteristic.
Represents a trait that provides an optional fuzzy characteristic.
This trait is used to encapsulate fuzziness-related behavior. The fuzziness is represented as an optional value of type Fuzziness[Double].
Suitable when there's a need to describe uncertain or imprecise values through a specific fuzziness model.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait Exacttrait ExactNumberclass RationalNumberclass WholeNumberobject NoScalartrait Structuretrait Functionaltrait Radiansclass Angletrait Transformedclass Exponentialclass BinaryExponentialclass NaturalExponentialclass InversePowertrait Scalartrait Numberclass Realtrait Fuzz[T]class FuzzyDoubleclass FuzzyNumberclass GeneralNumberclass ExactNumbertrait NumberShow all
Value members
Concrete fields
This is the (approximate) error bound on double precision numbers. Not all 64-bit floating point numbers will have this much error, and some might have a bit more. The value of 2 to the power of -53 is 1.11E-16 (this is half of the "official value" because we represent error bounds in the form of plus or minus the error).
This is the (approximate) error bound on double precision numbers. Not all 64-bit floating point numbers will have this much error, and some might have a bit more. The value of 2 to the power of -53 is 1.11E-16 (this is half of the "official value" because we represent error bounds in the form of plus or minus the error).
For more detail see: (1) https://en.wikipedia.org/wiki/IEEE_754 (2) https://stackoverflow.com/questions/4317988/ieee-754-floating-point-precision-how-much-error-is-allowed which quotes a slightly lower value in one particular case. (3) http://cs.boisestate.edu/~alark/cs354/lectures/ieee754.pdf (4) https://babbage.cs.qc.cuny.edu/IEEE-754.old/64bit.html (5) http://www.h-schmidt.net/FloatConverter/IEEE754.html (single-precision converter)
NOTE also: in IEEE 754 binary, pi is 400921fb54442d18 this is equivalent to: 3.141592653589793 The true value is: 3.1415926535897932384626433... Varying the lowest-order bit down by one gives us: 3.1415926535897927 Varying the lowest-order bit up by one gives us: 3.1415926535897936 Thus, the absolute d-p error tolerance for Pi should be: +- 0.0000000000000009, i.e. 5E-16 Thus, the relative d-p error tolerance for Pi should be: +- 1.6E-16