com.phasmidsoftware.number.expression.expr
Members list
Type members
Classlikes
Represents the root of an equation, associated with a specific branch.
Represents the root of an equation, associated with a specific branch.
This class models the concept of a mathematical root, where an equation is solved for a specific branch index, yielding a solution that adheres to the constraints defined in the Algebraic trait. It extends AtomicExpression to integrate with the broader mathematical expression framework.
Value parameters
- branch
-
the branch index used to solve the equation
- equ
-
the mathematical equation whose solution is represented by this root
Attributes
- Supertypes
-
trait Roottrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class LinearRootclass QuadraticRoot
An abstract class representing a transcendental mathematical entity, extending the Transcendental trait. This class encapsulates a human-readable name and an Expression representing its value.
An abstract class representing a transcendental mathematical entity, extending the Transcendental trait. This class encapsulates a human-readable name and an Expression representing its value.
Value parameters
- expression
-
An
Expressionrepresenting the mathematical definition or value of the transcendental entity. - name
-
A
Stringrepresenting the name of the transcendental entity.
Attributes
- Constructor
-
Creates a new instance of
AbstractTranscendental. - Supertypes
-
trait Transcendentaltrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Extractor for commutative additive operations with an identity element (zero).
Extractor for commutative additive operations with an identity element (zero).
This object is a specialized implementation of the CommutativeExtractor trait, specifically designed to handle expressions where one side of a commutative addition operation is an additive identity (e.g., zero).
It operates under the assumption that addition is commutative and attempts to extract sub-expressions from either side of a binary expression in a manner that accounts for the commutativity of the operation.
The left-hand side of the expression is simply returned as-is, while the right-hand side is inspected to check if it represents the additive identity (zero). If the right-hand side is zero, its associated sub-expression is extracted.
Attributes
- Supertypes
- Self type
Represents a composite expression that computes the total of a sequence of expressions. The sequence must be non-empty.
Represents a composite expression that computes the total of a sequence of expressions. The sequence must be non-empty.
Value parameters
- xs
-
A non-empty sequence of expressions to be totaled.
Attributes
- Constructor
-
Constructs an Aggregate instance with a sequence of expressions.
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Multipletrait CompositeExpressiontrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
Represents an arctangent operation as a binary function. Calculates the angle (in radians) whose tangent is the quotient of the two provided Valuables. If either input is not a real number, the result will be NaN encapsulated in a Real.
Represents an arctangent operation as a binary function. Calculates the angle (in radians) whose tangent is the quotient of the two provided Valuables. If either input is not a real number, the result will be NaN encapsulated in a Real.
- Operates on two
Valuablevalues as the input. - Uses the
atanfunction to compute the angle between the two numbers. - Returns a
Realresult if both inputs can be interpreted as numbers; otherwise, returnsReal(Number.NaN).
Constraints:
- This operation is not commutative.
- May yield inexact results if the inputs are not exact.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionBiFunctionclass Objecttrait Matchableclass AnyShow all
- Self type
-
Atan.type
Companion object for the AtomicExpression trait. Provides utility methods for working with instances of AtomicExpression.
Companion object for the AtomicExpression trait. Provides utility methods for working with instances of AtomicExpression.
The unapply method enables pattern matching on AtomicExpression instances, providing an optional Valuable as a result based on the type of the expression. The behavior of this method varies for different subtypes of AtomicExpression, such as Complex, ValueExpression, Literal, Valuable, Noop, and ReducedQuadraticRoot.
Notes:
- For
Complex, the method directly returns theComplexinstance as aValuable. - For
ValueExpressionandLiteral, the value of the Valuable is returned, but the name might be discarded during extraction. - For
Valuable, the method directly returns the Valuable. - For
ReducedQuadraticRoot, the method attempts to evaluate it "as-is." - For
Noop, the method returnsNone.
Considerations:
- The use of
ComplexandValuabledirectly in the extraction may warrant re-evaluation. - The potential loss of the name in
ValueExpressionandLiteralis noted as a trade-off.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
AtomicExpression.type
An Expression that is based on one simple constant value. The four subtypes of AtomicExpression are:
An Expression that is based on one simple constant value. The four subtypes of AtomicExpression are:
ValueExpressionRootTranscendentalNoop
Attributes
- Companion
- object
- Supertypes
-
trait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class Nooptrait Rootclass AbstractRootclass LinearRootclass QuadraticRoottrait Transcendentalclass AbstractTranscendentalobject ETranscendentalobject EulerMascheroniobject L2object LgEobject PiTranscendentalclass ValueExpressionclass Literalclass NamedConstantobject Eobject Iobject Infinityclass ScalarConstantobject Halfobject MinusOneobject Oneobject Piobject Twoobject ZeroShow all
This class represents a dyadic function of the two given expressions.
This class represents a dyadic function of the two given expressions.
Value parameters
- a
-
the first expression being operated on.
- b
-
the second expression being operated on.
- f
-
the function to be applied to a and b.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass BinaryFunctiontrait Multipletrait CompositeExpressiontrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
BiFunction.type
This class represents a dyadic function of the two given expressions.
This class represents a dyadic function of the two given expressions.
Value parameters
- a
-
the first expression being operated on.
- b
-
the second expression being operated on.
- f
-
the function to be applied to a and b.
Attributes
- Supertypes
-
trait Multipletrait CompositeExpressiontrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class BiFunction
Abstract extractor for commutative binary operations. Handles trying both (left, right) and (right, left) orderings automatically.
Abstract extractor for commutative binary operations. Handles trying both (left, right) and (right, left) orderings automatically.
Type parameters
- A
-
the type extracted from the "left" position
- B
-
the type extracted from the "right" position
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object AdditiveIdentityCommutativeobject EulerSumCommutativeobject SumSymmetricCommutativeShow all
The Commutes object provides a mechanism to extract instances of ExpressionBiFunction that exhibit the property of commutativity. A binary function is considered commutative if the order of operands does not affect the result of the operation.
The Commutes object provides a mechanism to extract instances of ExpressionBiFunction that exhibit the property of commutativity. A binary function is considered commutative if the order of operands does not affect the result of the operation.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Commutes.type
A trait representing a composite mathematical or logical expression. It is a higher-order expression that combines multiple sub-expressions into a structured form. This trait provides methods and utilities for simplifying, rendering, and interpreting such expressions.
A trait representing a composite mathematical or logical expression. It is a higher-order expression that combines multiple sub-expressions into a structured form. This trait provides methods and utilities for simplifying, rendering, and interpreting such expressions.
CompositeExpression inherits from the Expression trait and serves as a foundation for more specific composite structures, such as aggregates or compound expressions.
NOTE: this trait was formerly sealed. It has been unsealed to allow splitting across multiple files.
Attributes
- Companion
- object
- Supertypes
-
trait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class Eulertrait Multipleclass Aggregateclass BinaryFunctionclass BiFunctionclass UniFunctionShow all
Companion object for the CompositeExpression case class.
Companion object for the CompositeExpression case class.
Provides a utility method to create an Expression from a function and a sequence of Expressions.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CompositeExpression.type
Matches cos(θ) → UniFunction(θ, Cosine), returns θ.
Matches cos(θ) → UniFunction(θ, Cosine), returns θ.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Cos.type
Represents the cosine trigonometric function.
Represents the cosine trigonometric function.
Cosine is a specific instance of the SineCos class with sine set to false, meaning it applies the cosine (cos) function to an Expression.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass Hyperbolicclass ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Self type
-
Cosh.type
Matches cosh(x) → UniFunction(x, Cosh), returns x.
Matches cosh(x) → UniFunction(x, Cosh), returns x.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CoshX.type
Represents the cosine trigonometric function.
Represents the cosine trigonometric function.
Cosine is a specific instance of the SineCos class with sine set to false, meaning it applies the cosine (cos) function to an Expression.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass SineCosclass ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Self type
-
Cosine.type
Object CubeRoot provides an extractor method for matching and decomposing expressions that represent cube root operations. This is specifically aimed at identifying instances of NthRoot where the root value is 3.
Object CubeRoot provides an extractor method for matching and decomposing expressions that represent cube root operations. This is specifically aimed at identifying instances of NthRoot where the root value is 3.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CubeRoot.type
The constant e. Yes, this is an exact number.
The constant e. Yes, this is an exact number.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
E.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
EagerOps.type
Represents an object with no functionality or state.
Represents an object with no functionality or state.
This is only defined here so that we no longer have a file without a corresponding class or object.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Empty.type
Represents the canonical lazy complex form re^(itheta), per Euler's formula.
Represents the canonical lazy complex form re^(itheta), per Euler's formula.
This is the canonical lazy representation for complex exponential and trigonometric expressions in the Number library. It materialises to ComplexPolar on evaluation.
Conversion rules (applied by the simplification pipeline, not at construction):
cos(theta) + i*sin(theta)=>Euler(one, theta)(Euler recognition)exp(i*theta)=>Euler(one, theta)(Euler recognition)exp(a + i*b)=>Euler(exp(a), b)(Euler recognition)
Special materialisation cases:
Euler(r, 0)=> r (real result)Euler(r, Pi)=> Negate(r) (negative real)Euler(1, 0)=> 1Euler(1, Pi)=> -1 (Euler's identity)Euler(1, Pi/2)=> iEuler(0, theta)=> 0 (zero modulus)
Arithmetic rules (applied by the simplification pipeline):
Euler(r1,t1) * Euler(r2,t2)=>Euler(r1*r2, t1+t2)(de Moivre multiplication)Euler(r1,t1) / Euler(r2,t2)=>Euler(r1/r2, t1-t2)(de Moivre division)Euler(r,t) ^ n=>Euler(r^n, n*t)(de Moivre's theorem)Euler(r,t) + Euler(r,-t)=>2*r*cos(t)(conjugate sum => real)Euler(r,t) - Euler(r,-t)=>2*i*r*sin(t)(conjugate diff => imaginary)
Value parameters
- r
-
the modulus expression (non-negative real)
- θ
-
the argument (angle) expression, in radians
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait CompositeExpressiontrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
Singleton object representing the Euler-Mascheroni constant (𝛾), a fundamental mathematical constant. It extends AbstractTranscendental to encapsulate its symbolic representation and mathematical definition.
Singleton object representing the Euler-Mascheroni constant (𝛾), a fundamental mathematical constant. It extends AbstractTranscendental to encapsulate its symbolic representation and mathematical definition.
The Euler-Mascheroni constant is a transcendental entity commonly used in number theory and analysis.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass AbstractTranscendentaltrait Transcendentaltrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
EulerMascheroni.type
Commutative extractor for the Euler recognition pattern cos(θ) + i·sin(θ).
Commutative extractor for the Euler recognition pattern cos(θ) + i·sin(θ).
Matches a pair (left, right) where one side is cos(θ) and the other is i·sin(θ) (in either multiplication order), returning (θ_from_cos, θ_from_sin). The caller guards with θ1 == θ2.
extractLeft excludes the i·sin shape so the two roles are mutually exclusive, preventing the swap path from producing spurious matches.
Attributes
- Supertypes
- Self type
-
EulerSumCommutative.type
An extractor object used to identify whether a given ExpressionMonoFunction has a parity of Parity.Even.
An extractor object used to identify whether a given ExpressionMonoFunction has a parity of Parity.Even.
This is useful in scenarios where the specific parity attribute of an ExpressionMonoFunction needs to be matched or validated.
The unapply method returns true if the parity field of the provided ExpressionMonoFunction is equal to Parity.Even; otherwise, it returns false.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Even.type
Represents a mathematical exponential function, exp(x), where e is the base of natural logarithms. This case object extends ExpressionMonoFunction and applies the exp operation on a given number. It defines the exponential operation for transformation or evaluation within expressions.
Represents a mathematical exponential function, exp(x), where e is the base of natural logarithms. This case object extends ExpressionMonoFunction and applies the exp operation on a given number. It defines the exponential operation for transformation or evaluation within expressions.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Self type
-
Exp.type
Matches exp(x) → UniFunction(x, Exp), returns x.
Matches exp(x) → UniFunction(x, Exp), returns x.
NOTE: if the name Exp clashes with the ExpressionFunction case object of the same name inside the match body, rename this extractor to ExpX.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ExpX.type
The Expression companion object provides utilities for creating, manipulating, and parsing expressions.
The Expression companion object provides utilities for creating, manipulating, and parsing expressions.
Methods and values within this object help in constructing expressions from various types like Field or Int, perform conversions, parse string representations of expressions, define constants, and offer implicit operators for working with expressions.
It offers functionalities for mathematical operations, common constants, and extensions to manipulate operations in a lazy manner.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Expression.type
Trait Expression which defines the behavior of a lazily evaluated tree of mathematical operations and operands.
Trait Expression which defines the behavior of a lazily evaluated tree of mathematical operations and operands.
NOTE there are only two subtypes of Expression: AtomicExpression and CompositeExpression We do not use "sealed" because this module would grow much too large.
Attributes
- Companion
- object
- Supertypes
-
trait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait AtomicExpressionclass Nooptrait Rootclass AbstractRootclass LinearRootclass QuadraticRoottrait Transcendentalclass AbstractTranscendentalobject ETranscendentalobject EulerMascheroniobject L2object LgEobject PiTranscendentalclass ValueExpressionclass Literalclass NamedConstantobject Eobject Iobject Infinityclass ScalarConstantobject Halfobject MinusOneobject Oneobject Piobject Twoobject Zerotrait CompositeExpressionclass Eulertrait Multipleclass Aggregateclass BinaryFunctionclass BiFunctionclass UniFunctionShow all
Represents a binary function used in expression evaluation. This abstraction encapsulates the logic for applying a binary operation to two Eager objects while supporting features such as exactness, commutativity, and optional identity elements.
Represents a binary function used in expression evaluation. This abstraction encapsulates the logic for applying a binary operation to two Eager objects while supporting features such as exactness, commutativity, and optional identity elements.
Value parameters
- f
-
the underlying binary function to be applied to the
Eagerinputs. - isExact
-
a flag indicating whether the function is strictly exact (producing precise results).
- maybeIdentityL
-
an optional identity element for the left-hand operand; if defined, evaluation recognizes and simplifies the operation when this value is encountered.
- maybeIdentityR
-
an optional identity element for the right-hand operand; if defined, evaluation recognizes and simplifies the operation when this value is encountered.
- name
-
the unique name identifying the binary function.
Attributes
- Companion
- object
- Supertypes
- Known subtypes
Companion object for the ExpressionBiFunction class.
Companion object for the ExpressionBiFunction class.
Provides an extractor method to deconstruct ExpressionBiFunction instances into their associated function and name.
Attributes
- Companion
- class
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ExpressionBiFunction.type
Extractor object for handling negation expressions in a commutative manner. Matches pairs of expressions where one is a plain Expression and the other is its negation UniFunction(x, Negate).
Extractor object for handling negation expressions in a commutative manner. Matches pairs of expressions where one is a plain Expression and the other is its negation UniFunction(x, Negate).
extractLeft excludes negated expressions so that the two roles are mutually exclusive. This prevents the swap path in CommutativeExtractor from binding a to a negated expression and producing a spurious a == b match.
With this fix the commented-out shorthand in structuralMatcher works correctly:
case ProductExpression(ExpressionComplementaryCommutative(a, b)) if a == b =>
minusXSquared(a)
Attributes
- Supertypes
- Self type
A configuration object for expression-related settings. This object is responsible for loading and providing specific configurations used to control behavior such as log levels during expression matching.
A configuration object for expression-related settings. This object is responsible for loading and providing specific configurations used to control behavior such as log levels during expression matching.
It uses the ConfigFactory to load configuration settings and determines the appropriate log level for expression matching based on the number.expression.match-log-level property from the configuration.
The supported log levels are:
- "off": Corresponds to
LogOff. - "info": Corresponds to
LogInfo. - "debug": Corresponds to
LogDebug.
If the property is not specified or does not match any of the expected values, the log level defaults to LogOff.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ExpressionConfig.type
Cats Eq instance for Expression providing structural equality. Two expressions are equal if they are structurally identical.
Cats Eq instance for Expression providing structural equality. Two expressions are equal if they are structurally identical.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ExpressionEq.type
A custom exception that represents errors related to expressions.
A custom exception that represents errors related to expressions.
Value parameters
- str
-
The error message providing details about the expression error.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Represents a named, generic computation or transformation from an input of type P to an output value of type Valuable. The ExpressionFunction trait defines an abstract function by extending the (P => Valuable) function type. It can be used to model mathematical or computational expressions with a specific name. It is the super-type of ExpressionMonoFunction and ExpressionBiFunction.
Represents a named, generic computation or transformation from an input of type P to an output value of type Valuable. The ExpressionFunction trait defines an abstract function by extending the (P => Valuable) function type. It can be used to model mathematical or computational expressions with a specific name. It is the super-type of ExpressionMonoFunction and ExpressionBiFunction.
Type parameters
- P
-
the type of the input parameter to the function
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
class ExpressionBiFunctionobject Atanobject Logobject Powerobject Productobject Sumclass ExpressionMonoFunctionobject Expclass Hyperbolicobject Coshobject Sinhobject Lnobject Negateobject Reciprocalclass SineCosobject Cosineobject SineShow all
Object containing utility methods for working with functions in the context of mathematical or computational expressions. The ExpressionFunction object provides helpers to lift operations between Field types to operations between Valuable types.
Object containing utility methods for working with functions in the context of mathematical or computational expressions. The ExpressionFunction object provides helpers to lift operations between Field types to operations between Valuable types.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ExpressionFunction.type
Matchers whose input is generally an Expression.
Matchers whose input is generally an Expression.
These Matchers are used to simplify (lazy) Expressions before those Expressions get evaluated, thus sometimes avoiding loss of precision.
Rules for matching: (1) All substitution is based on a successful match -- no match, no substitution; CONSIDER this second rules seems strange (2) The first match to try for any expression is the exactMaterializer which returns Match(Literal(value)); (2) Some matches return non-exact match results -- these should be passed to flatMap simplifier; NOTE: do not pass anything to flatMap simplifier if it could possibly be the same as the input (else stack overflow).
Attributes
- Companion
- object
- Supertypes
- Self type
The ExpressionMatchers object provides utilities for evaluating relationships between two Expression objects using a given ExpressionBiFunction. It enables analysis of complementary expressions under specific mathematical or logical contexts.
The ExpressionMatchers object provides utilities for evaluating relationships between two Expression objects using a given ExpressionBiFunction. It enables analysis of complementary expressions under specific mathematical or logical contexts.
These methods are here so that they're not part of the ExpressionMatchers API.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ExpressionMatchers.type
The companion object for the ExpressionMonoFunction class. Provides utility methods for working with ExpressionMonoFunction instances.
The companion object for the ExpressionMonoFunction class. Provides utility methods for working with ExpressionMonoFunction instances.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
A lazy monadic expression function.
A lazy monadic expression function.
TODO need to mark whether this function is exact or not (but I can't think of many which are exact).
TODO implement also for other Valuables than Numbers.
Value parameters
- f
-
the function Number => Number.
- name
-
the name of this function.
Attributes
Extractor object for handling negation expressions in a commutative manner. Matches pairs of expressions where one is an Expression and the other is a negated ValueExpression(-1).
Extractor object for handling negation expressions in a commutative manner. Matches pairs of expressions where one is an Expression and the other is a negated ValueExpression(-1).
This object extends the CommutativeExtractor to allow the extraction of operands in any order (i.e., it supports both (A, B) and (B, A) configurations).
Attributes
- Supertypes
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ExpressionPrelude.type
Represents the mathematical constant 1/2 (half).
Represents the mathematical constant 1/2 (half).
This object is a specific implementation of the Constant trait and is used to represent the value of half within mathematical expressions.
It provides:
- An evaluation method that returns the predefined constant value of half.
- A context definition for the constant.
- A string representation of the constant.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ScalarConstantclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Half.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
HasEuler.type
Represents a hyperbolic trigonometric function (sinh or cosh) as a specialized monadic expression. This abstract class extends the ExpressionMonoFunction and defines behavior specific to hyperbolic sine (sinh) or hyperbolic cosine (cosh) operations. The choice between sinh and cosh is determined by the sinh parameter.
Represents a hyperbolic trigonometric function (sinh or cosh) as a specialized monadic expression. This abstract class extends the ExpressionMonoFunction and defines behavior specific to hyperbolic sine (sinh) or hyperbolic cosine (cosh) operations. The choice between sinh and cosh is determined by the sinh parameter.
Value parameters
- parity
-
The parity of the function, which can be odd, even, or neither. For example,
sinhhas odd parity, whilecoshhas even parity. - sinh
-
A boolean value indicating whether the function represents
sinh(true) orcosh(false).
Attributes
- Constructor
-
Creates a new instance of the
Hyperbolicclass. - Companion
- object
- Supertypes
-
class ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Known subtypes
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Hyperbolic.type
The constant i (viz., the square root of 2) Yes, this is an exact number.
The constant i (viz., the square root of 2) Yes, this is an exact number.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
I.type
Companion object providing an extractor for identifying expressions involving specific patterns with mathematical constants i (imaginary unit) and π (pi).
Companion object providing an extractor for identifying expressions involving specific patterns with mathematical constants i (imaginary unit) and π (pi).
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IPi.type
Represents an infinite value in the Valuable of expressions.
Represents an infinite value in the Valuable of expressions.
The Infinity object is a special case of NamedConstant with a value of positive infinity. It is immutable and serves as a singleton instance to represent the mathematical concept of infinity in calculations or expressions. It overrides certain behaviors of ValueExpression to handle operations specific to infinity.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Infinity.type
Extractor object for commutative operations between an InversePower and a value that can be powered, represented by CanPower[eager.Number].
Extractor object for commutative operations between an InversePower and a value that can be powered, represented by CanPower[eager.Number].
This object extends CommutativeExtractor, enabling it to automatically handle both (left, right) and (right, left) orderings in commutative binary operations. Specifically, it extracts:
- An
InversePowerfrom the "left" side of the expression, provided the base of the inverse power (n) is greater than 1. - A
CanPower[eager.Number]from the "right" side of the expression.
The unapply method allows pattern matching to operate on pairs of expressions, extracting valid (InversePower, CanPower[eager.Number]) pairs regardless of their position in the tuple.
Attributes
- Supertypes
- Self type
Matches a commutative BiFunction, exposing all three components. Currently Sum and Product are commutative; Power is not.
Matches a commutative BiFunction, exposing all three components. Currently Sum and Product are commutative; Power is not.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsCommutative.type
Extractor matching cos²(z), i.e. BiFunction(UniFunction(z, Cosine), Two, Power). Returns the argument z.
Extractor matching cos²(z), i.e. BiFunction(UniFunction(z, Cosine), Two, Power). Returns the argument z.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsCosSquared.type
Extractor matching cosh²(z), i.e. BiFunction(UniFunction(z, Cosh), Two, Power). Returns the argument z.
Extractor matching cosh²(z), i.e. BiFunction(UniFunction(z, Cosh), Two, Power). Returns the argument z.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsCoshSquared.type
Companion object providing an extractor for retrieving the Eager value associated with a given Expression. The extractor is used to match on Expression instances and specifically identify instances that are ValueExpression containing an Eager component.
Companion object providing an extractor for retrieving the Eager value associated with a given Expression. The extractor is used to match on Expression instances and specifically identify instances that are ValueExpression containing an Eager component.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsEager.type
The IsEuler object provides functionality to extract an instance of Euler from a given Expression if the expression conforms to a known form of Euler's representation. It enables pattern matching for expressions representing Euler's equation or its variations.
The IsEuler object provides functionality to extract an instance of Euler from a given Expression if the expression conforms to a known form of Euler's representation. It enables pattern matching for expressions representing Euler's equation or its variations.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsEuler.type
An extractor object that checks if a given expression is hyperbolic by matching it against the hyperbolic sine (sinh) or hyperbolic cosine (cosh) functions.
An extractor object that checks if a given expression is hyperbolic by matching it against the hyperbolic sine (sinh) or hyperbolic cosine (cosh) functions.
The object provides an unapply method that takes an Expression as input and attempts to extract the inner expression z if the input expression matches the form of a hyperbolic function.
Cases:
- Matches expressions of the form UniFunction(z, Sinh) or UniFunction(z, Cosh) and returns the inner expression
zin a Some if matched. - Returns None if the input expression does not match the hyperbolic form.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsHyperbolic.type
An object that provides pattern matching for determining whether a given Expression represents an imaginary value.
An object that provides pattern matching for determining whether a given Expression represents an imaginary value.
It attempts to evaluate the Expression and checks if it can be identified as an imaginary value through the IsImaginary extractor.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
An extractor object that determines if a pair of expressions is related through an imaginary expression in a commutative manner. This means that the imaginary component can appear on either side of the tuple, and the extractor will match in both cases.
An extractor object that determines if a pair of expressions is related through an imaginary expression in a commutative manner. This means that the imaginary component can appear on either side of the tuple, and the extractor will match in both cases.
The extractor takes a tuple of two Expression objects as input and attempts to find one of the expressions being an IsImaginaryExpression. If a match is found, it extracts the eager value from the IsImaginaryExpression and returns it along with the other expression in the tuple.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Provides a mechanism to determine whether an Expression can be represented as an integer value and, if so, extracts the corresponding integer value.
Provides a mechanism to determine whether an Expression can be represented as an integer value and, if so, extracts the corresponding integer value.
The IsIntegral object acts as an extractor, allowing pattern matching against Expression instances to identify those that represent whole numbers. This is particularly useful when working with complex expressions that may or may not simplify to integers.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsIntegral.type
Object IsMinusOne is used to identify and extract instances of Expression that represent -1.
Object IsMinusOne is used to identify and extract instances of Expression that represent -1.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsMinusOne.type
Extractor matching sin²(z), i.e. BiFunction(UniFunction(z, Sine), Two, Power). Returns the argument z.
Extractor matching sin²(z), i.e. BiFunction(UniFunction(z, Sine), Two, Power). Returns the argument z.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsSinSquared.type
Extractor matching sinh²(z), i.e. BiFunction(UniFunction(z, Sinh), Two, Power). Returns the argument z.
Extractor matching sinh²(z), i.e. BiFunction(UniFunction(z, Sinh), Two, Power). Returns the argument z.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsSinhSquared.type
Object IsUnity is used to identify and extract instances of Expression that represent unity. Unity is determined based on the isUnity property of the Expression.
Object IsUnity is used to identify and extract instances of Expression that represent unity. Unity is determined based on the isUnity property of the Expression.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsUnity.type
Companion object for the IsZero extractor.
Companion object for the IsZero extractor.
This object provides a custom pattern matching mechanism for the Expression trait. It matches any Expression that evaluates to a zero value, allowing concise and readable extraction of such cases.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
IsZero.type
Represents the natural logarithm of 2 as a transcendental constant. NOTE that L2 evaluates to None because generating a Double from L2 would lose precision.
Represents the natural logarithm of 2 as a transcendental constant. NOTE that L2 evaluates to None because generating a Double from L2 would lose precision.
This is a case object extending the AbstractTranscendental class, encapsulating the mathematical expression for the natural log of 2 (ln(2)) and the corresponding expression (Two.log).
The L2 object is defined as a named transcendental entity and can be used in operations or expressions involving transcendental numbers.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass AbstractTranscendentaltrait Transcendentaltrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
L2.type
Represents the natural logarithm of 2 as a transcendental constant. NOTE that L2 evaluates to None because generating a Double from L2 would lose precision.
Represents the natural logarithm of 2 as a transcendental constant. NOTE that L2 evaluates to None because generating a Double from L2 would lose precision.
This is a case object extending the AbstractTranscendental class, encapsulating the mathematical expression for the natural log of 2 (ln(2)) and the corresponding expression (Two.log).
The L2 object is defined as a named transcendental entity and can be used in operations or expressions involving transcendental numbers.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass AbstractTranscendentaltrait Transcendentaltrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
LgE.type
Represents the linear root of a given equation. A LinearRoot is an extension of the AbstractRoot class, specialized for cases where the root corresponds to a degree-1 (linear) polynomial equation.
Represents the linear root of a given equation. A LinearRoot is an extension of the AbstractRoot class, specialized for cases where the root corresponds to a degree-1 (linear) polynomial equation.
This implementation assumes the linear root is unique and thus corresponds to the only solution available for a first-degree equation.
Value parameters
- equ
-
the
Equationinstance associated with this root. Assumes the equation is linear (degree 1).
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass AbstractRoottrait Roottrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
A ValueExpression based on a literal Valuable.
A ValueExpression based on a literal Valuable.
Value parameters
- maybeName
-
an optional name (typically this will be None).
- value
-
the
Valuable.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
Companion object for the Literal class, providing factory methods and pattern matching support.
Represents the natural logarithmic function as an ExpressionMonoFunction.
Represents the natural logarithmic function as an ExpressionMonoFunction.
Renaming this function as Ln (logarithmus naturalis).
This object provides functionality to compute the natural logarithm (ln) of a given Number. The underlying implementation utilizes the log method of the Number type.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Self type
-
Ln.type
The Log object represents a mathematical logarithmic operation as a binary function. It extends the ExpressionBiFunction, enabling evaluation of logarithmic expressions with specific constraints and rules for exactness.
The Log object represents a mathematical logarithmic operation as a binary function. It extends the ExpressionBiFunction, enabling evaluation of logarithmic expressions with specific constraints and rules for exactness.
Thus the value is log to the base b of a, where a and b are the expressions in the BiFunction.
This class supports restricted evaluation contexts and provides mechanisms for exact computation or fallback to default behavior when exact evaluation is not possible.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionBiFunctionclass Objecttrait Matchableclass AnyShow all
- Self type
-
Log.type
Typeclass for mathematical equality that considers expressions equal if they simplify to structurally equivalent forms.
Typeclass for mathematical equality that considers expressions equal if they simplify to structurally equivalent forms.
This is distinct from structural equality (Eq) which only considers the syntactic structure of expressions.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MathematicalEq.type
Syntax extensions for MathematicalEq.
Syntax extensions for MathematicalEq.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MathematicalEqSyntax.type
Represents the constant value -1.
Represents the constant value -1.
MinusOne is a specific instance of the ScalarConstant class, which evaluates to the numerical value -1 regardless of the context.
This constant can be used in mathematical expressions involving Valuables and supports operations defined in the Valuable trait.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ScalarConstantclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
MinusOne.type
An extractor for the Multiple trait, allowing deconstruction into its sequence of terms.
An extractor for the Multiple trait, allowing deconstruction into its sequence of terms.
This object provides a pattern matching mechanism for Multiple, enabling access to its underlying sequence of sub-expressions.
Attributes
Represents a composite expression consisting of multiple terms. Multiple is a specialized trait that inherits from CompositeExpression and provides functionality to manage a sequence of sub-expressions.
Represents a composite expression consisting of multiple terms. Multiple is a specialized trait that inherits from CompositeExpression and provides functionality to manage a sequence of sub-expressions.
Would like this to be package-sealed if they ever add that feature.
Attributes
- Companion
- object
- Supertypes
-
trait CompositeExpressiontrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
An object that extracts and matches expressions based on the commutative property of multiplication with the identity element (unity).
An object that extracts and matches expressions based on the commutative property of multiplication with the identity element (unity).
This object extends CommutativeExtractor and provides the specific implementation for extracting expressions in the form of a multiplicative operation where one operand is the multiplicative identity (unity), and the other is the remaining expression.
It defines the following extraction rules:
- The
extractLeftmethod always extracts and returns the input expression as-is. - The
extractRightmethod matches an expression that is the multiplicative identity (IsUnity(x)) and extracts the contained valuex.
The unapply mechanism allows this extractor to match pairs of expressions in a commutative manner, ensuring symmetry in the analysis of multiplicative operations.
Attributes
- Supertypes
- Self type
Represents a specific constant whose value is a Valuable with an associated name.
Represents a specific constant whose value is a Valuable with an associated name.
This abstract class extends ValueExpression, allowing for named representation of constants in mathematical expressions, while being tied to a specific Valuable type.
Value parameters
- name
-
the name associated with this constant.
- x
-
the mathematical Valuable to which this constant belongs.
Attributes
- Constructor
-
Creates a named constant within the context of the provided Eager.
- Supertypes
-
class ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Negate is a specific implementation of the ExpressionMonoFunction that changes the sign of a numeric value.
Negate is a specific implementation of the ExpressionMonoFunction that changes the sign of a numeric value.
This object represents the mathematical negation operation ("-") applied to a numeric input. It uses the negate method, which evaluates the negation of a given Number while handling specific cases like imaginary numbers and converting non-pure factors to PureNumber form as necessary.
The function is exact and operates lazily.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Self type
-
Negate.type
The Noop object is an atomic expression that represents a no-operation placeholder in an expression tree. It cannot be evaluated, simplified, or associated with any specific factor. It is a concrete implementation of the AtomicExpression trait.
The Noop object is an atomic expression that represents a no-operation placeholder in an expression tree. It cannot be evaluated, simplified, or associated with any specific factor. It is a concrete implementation of the AtomicExpression trait.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
An object that provides utilities for working with nth root expressions. Specifically, it allows for the deconstruction and extraction of components from expressions that match specific root-related patterns.
An object that provides utilities for working with nth root expressions. Specifically, it allows for the deconstruction and extraction of components from expressions that match specific root-related patterns.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NthRoot.type
An extractor object for identifying whether a given ExpressionMonoFunction has an odd parity. This is determined by evaluating the parity property of the provided function and checking if it is Parity.Odd.
An extractor object for identifying whether a given ExpressionMonoFunction has an odd parity. This is determined by evaluating the parity property of the provided function and checking if it is Parity.Odd.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Odd.type
Represents the constant numeric value 1.
Represents the constant numeric value 1.
One is a case object that extends ScalarConstant, indicating that it is a well-defined, immutable, and atomic mathematical value.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ScalarConstantclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
One.type
Represents the parity of a number.
Represents the parity of a number.
Parity can either be:
Odd: Indicates the givenExpressionMonoFunctionis odd.Even: Indicates the givenExpressionMonoFunctionis even.Neither: Indicates the givenExpressionMonoFunctiondoes not have a defined parity, such as in the case of certain non-integral or undefined inputs.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Pi represents the mathematical constant π (pi) exactly.
Pi represents the mathematical constant π (pi) exactly.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ScalarConstantclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Pi.type
Represents the power operation as a binary function within expressions. This operation raises the first operand to the power of the second operand. It is not exact for all inputs and does not commute.
Represents the power operation as a binary function within expressions. This operation raises the first operand to the power of the second operand. It is not exact for all inputs and does not commute.
TODO check on Eager.zero as identityL.
Extends ExpressionBiFunction where the specific function is implemented using the power method from the Valuable class.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionBiFunctionclass Objecttrait Matchableclass AnyShow all
- Self type
-
Power.type
Represents a specific implementation of the ExpressionBiFunction that performs multiplication between two Valuable values.
Represents a specific implementation of the ExpressionBiFunction that performs multiplication between two Valuable values.
This object embodies a binary operation where the function takes two inputs and computes their product using the multiply method defined on Valuable. The operation is represented by the symbol "*".
- The operation is marked as exact, ensuring the result is always precise when the inputs are exact.
- It inherits the commutative property from
ExpressionBiFunction, as multiplication is commutative.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionBiFunctionclass Objecttrait Matchableclass AnyShow all
- Self type
-
Product.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ProductExpression.type
The QuadraticRoot object provides functionality to construct and manipulate roots of quadratic equations. Basically, this method tries to reverse-engineer a QuadraticSolution into a QuadraticRoot. We don't currently manage it for all possibilities (understatement!) TODO complete more cases.
The QuadraticRoot object provides functionality to construct and manipulate roots of quadratic equations. Basically, this method tries to reverse-engineer a QuadraticSolution into a QuadraticRoot. We don't currently manage it for all possibilities (understatement!) TODO complete more cases.
This object acts as a factory for creating instances of QuadraticRoot using algebraic data, and offers methods for working with quadratic equations and their solutions.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
QuadraticRoot.type
Represents a root of a quadratic equation with a specified branch. This class is a case class extending the AbstractRoot, which models the root of an equation and provides required functionality for specific implementations.
Represents a root of a quadratic equation with a specified branch. This class is a case class extending the AbstractRoot, which models the root of an equation and provides required functionality for specific implementations.
The QuadraticRoot works specifically with quadratic equations, which have two branches corresponding to their solutions. Each instance of QuadraticRoot is associated with one branch of the equation.
Value parameters
- branch
-
the branch index indicating the solution branch of the equation. This value should be within the valid range of branches supported by the equation, typically
0or1for quadratic equations. - equ
-
the equation whose root is being represented. It must be an instance of the
Equationtrait.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass AbstractRoottrait Roottrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
The QuadraticValue object provides functionality for extracting components of a quadratic-related Expression through pattern matching. It identifies specific cases such as Root or Literal with a QuadraticSolution and produces structured data accordingly.
The QuadraticValue object provides functionality for extracting components of a quadratic-related Expression through pattern matching. It identifies specific cases such as Root or Literal with a QuadraticSolution and produces structured data accordingly.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
QuadraticValue.type
Reciprocal is an ExpressionMonoFunction representing the mathematical reciprocal operation. The function takes a numeric input x and computes 1 / x. It is identified by the name "rec". CONSIDER eliminating this and forcing any reciprocal to be power of negative one.
Reciprocal is an ExpressionMonoFunction representing the mathematical reciprocal operation. The function takes a numeric input x and computes 1 / x. It is identified by the name "rec". CONSIDER eliminating this and forcing any reciprocal to be power of negative one.
The operation is performed lazily and adheres to the behavior defined in its parent class.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Self type
-
Reciprocal.type
The Root trait represents a mathematical root derived from a specific equation. It corresponds to a solution of a multivalued mathematical expression that is typically associated with a monic polynomial equation. Each root is uniquely identified by its underlying equation and a branch index that represents a specific solution when multiple solutions are possible.
The Root trait represents a mathematical root derived from a specific equation. It corresponds to a solution of a multivalued mathematical expression that is typically associated with a monic polynomial equation. Each root is uniquely identified by its underlying equation and a branch index that represents a specific solution when multiple solutions are possible.
Attributes
- Companion
- object
- Supertypes
-
trait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
The Root object provides predefined mathematical constants or solutions to well-known equations modeled as roots. These constants are instances of QuadraticRoot or LinearRoot corresponding to specific root solutions of their respective equations.
The Root object provides predefined mathematical constants or solutions to well-known equations modeled as roots. These constants are instances of QuadraticRoot or LinearRoot corresponding to specific root solutions of their respective equations.
Attributes
An abstract representation of a scalar constant in a specific mathematical Valuable, for example, π (pi), 1, 0, but not e.
An abstract representation of a scalar constant in a specific mathematical Valuable, for example, π (pi), 1, 0, but not e.
This class extends NamedConstant, tying the scalar constant to a particular Valuable instance and associating it with a specific name. It is designed to represent immutable scalar constants in mathematical expressions, leveraging the properties and operations of the Valuable.
Value parameters
- name
-
the name associated with the scalar constant.
- x
-
the
Valuableinstance representing the value of the scalar constant.
Attributes
- Supertypes
-
class NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Matches sin(θ) → UniFunction(θ, Sine), returns θ.
Matches sin(θ) → UniFunction(θ, Sine), returns θ.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Sin.type
Represents the sine trigonometric function.
Represents the sine trigonometric function.
Sine is a case object of the SineCos abstract class with the sine parameter set to true, which designates that the sine (sin) function is to be applied to expressions.
It applies the sine function to a given mathematical expression and inherits all behavior defined in the SineCos abstract class.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass SineCosclass ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Self type
-
Sine.type
Represents a trigonometric function, either sine or cosine, that is derived from the abstract ExpressionMonoFunction.
Represents a trigonometric function, either sine or cosine, that is derived from the abstract ExpressionMonoFunction.
The SineCos class applies a specified trigonometric function (sin or cos) to an Expression. The function to be applied is determined by the given sine boolean parameter.
If sine is true, the sine (sin) function is applied, otherwise, the cosine (cos) function is applied.
Value parameters
- sine
-
a boolean indicating whether the sine function should be used (
truefor sine,falsefor cosine).
Attributes
- Companion
- object
- Supertypes
-
class ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Known subtypes
Represents the sine trigonometric function.
Represents the sine trigonometric function.
Sine is a case object of the SineCos abstract class with the sine parameter set to true, which designates that the sine (sin) function is to be applied to expressions.
It applies the sine function to a given mathematical expression and inherits all behavior defined in the SineCos abstract class.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass Hyperbolicclass ExpressionMonoFunctiontrait ExpressionFunction[Eager]class Objecttrait Matchableclass AnyShow all
- Self type
-
Sinh.type
Matches sinh(x) → UniFunction(x, Sinh), returns x.
Matches sinh(x) → UniFunction(x, Sinh), returns x.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SinhX.type
Object SquareRoot provides a mechanism to extract and match square root operations represented as a specific Expression.
Object SquareRoot provides a mechanism to extract and match square root operations represented as a specific Expression.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SquareRoot.type
Represents a sum operation as a binary function that adds two Valuable values.
Represents a sum operation as a binary function that adds two Valuable values.
This object extends ExpressionBiFunction by defining its operation as addition (add) with the corresponding symbol "+" and is flagged as not always exact (isExact = false).
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ExpressionBiFunctionclass Objecttrait Matchableclass AnyShow all
- Self type
-
Sum.type
Extractor for BiFunction(a, b, Sum) — returns (a, b) as a tuple suitable for use with CommutativeExtractor subtypes.
Extractor for BiFunction(a, b, Sum) — returns (a, b) as a tuple suitable for use with CommutativeExtractor subtypes.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SumExpression.type
Fully symmetric commutative extractor for Sum expressions. Both positions accept any Expression; the inner match in matchBiFunctionIdentitiesSum applies the specific guards. Used for Pythagorean and related identities where both operands are CompositeExpression and no asymmetric role distinction applies.
Fully symmetric commutative extractor for Sum expressions. Both positions accept any Expression; the inner match in matchBiFunctionIdentitiesSum applies the specific guards. Used for Pythagorean and related identities where both operands are CompositeExpression and no asymmetric role distinction applies.
Attributes
- Supertypes
- Self type
Represents a type of AtomicExpression that embodies a transcendental entity. A transcendental entity typically includes non-algebraic constants or functions that cannot arise from finite polynomial equations with rational coefficients.
Represents a type of AtomicExpression that embodies a transcendental entity. A transcendental entity typically includes non-algebraic constants or functions that cannot arise from finite polynomial equations with rational coefficients.
This trait extends the characteristics of AtomicExpression by enabling the application of a transformation or computation defined as an ExpressionMonoFunction.
Attributes
- Supertypes
-
trait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class AbstractTranscendentalobject ETranscendentalobject EulerMascheroniobject L2object LgEobject PiTranscendentalShow all
Represents the constant number 2 as a case object, extending the ScalarConstant class.
Represents the constant number 2 as a case object, extending the ScalarConstant class.
This object evaluates to the numeric constant 2 within the given context. It can be used in mathematical expressions and operations involving constants.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ScalarConstantclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Two.type
The UniFunction companion object provides utility methods for initializing and converting UniFunction instances. It includes methods to construct a UniFunction from a MonadicDuple as well as an implicit conversion mechanism.
The UniFunction companion object provides utility methods for initializing and converting UniFunction instances. It includes methods to construct a UniFunction from a MonadicDuple as well as an implicit conversion mechanism.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
UniFunction.type
This class represents a monadic function of the given expression.
This class represents a monadic function of the given expression.
Value parameters
- f
-
the function to be applied to x.
- x
-
the expression being operated on.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait CompositeExpressiontrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
The ValueExpression companion object provides a mechanism to extract elements from a ValueExpression instance. It defines the unapply method to enable pattern matching and decomposition of ValueExpression objects.
The ValueExpression companion object provides a mechanism to extract elements from a ValueExpression instance. It defines the unapply method to enable pattern matching and decomposition of ValueExpression objects.
The extraction operation retrieves the underlying Eager and an optional name, if available. It handles two main cases:
- For instances of
Literal, it extracts theEagervalue along withNonefor the optional name. - For other cases, it extracts the
Eagervalue along with its associated optional name.
Attributes
- See also
-
ValueExpression
Literal
- Companion
- class
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ValueExpression.type
Represents an abstract expression for a Valuable that can optionally be associated with a name.
Represents an abstract expression for a Valuable that can optionally be associated with a name.
A ValueExpression provides methods for evaluating its qualifications within a given context, rendering its representation, and determining equality or hashing. It extends the AtomicExpression trait, allowing it to be used wherever atomic expressions are valid.
CONSIDER placing maybeName in the second parameter list.
Value parameters
- maybeName
-
an optional name for the Valuable expression
- value
-
the
Valuableassociated with the expression
Attributes
- Companion
- object
- Supertypes
-
trait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Represents the mathematical constant zero. This object extends the ScalarConstant class, providing implementation specific to zero.
Represents the mathematical constant zero. This object extends the ScalarConstant class, providing implementation specific to zero.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass ScalarConstantclass NamedConstantclass ValueExpressiontrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Zero.type
The ∅ object represents the identity element in mathematical operations on expressions. It serves as a symbolic representation of the "empty" or neutral element in addition and multiplication operations.
The ∅ object represents the identity element in mathematical operations on expressions. It serves as a symbolic representation of the "empty" or neutral element in addition and multiplication operations.
This object supports operations such as addition, subtraction, multiplication, and division, which adhere to mathematical identity properties or represent specific transformations when combined with expressions.
Functions:
-
Addition (
+): Performs addition with an expression or integer. For expressions, it returns the operand itself, acting as the addition identity. For integers, it creates aLiteralrepresentation of the integer and returns that. -
Multiplication (
*): Performs multiplication with an expression or integer. For expressions, it returns the operand itself, acting as the multiplication identity. For integers, it creates aLiteralrepresentation of the integer and returns that. -
Division (
/): Represents the division operation. For expressions or integers, it creates a transformed expression wrapped in theReciprocaloperation. -
Subtraction (
-): Represents subtraction or negation. For expressions or integers, it creates a transformed expression wrapped in theNegateoperation.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
∅.type
Deprecated classlikes
Case object representing the transcendental constant e.
Case object representing the transcendental constant e.
Extends the AbstractTranscendental class, providing implementations specific to the mathematical constant e (Euler's number), known for its importance in the Valuable of mathematics, particularly in calculus and exponential growth behavior.
The name parameter is set to "xD835DF00", which represents a unique identifier for this transcendental, and its expression is given by the constant E.
The E object inherits all methods and properties from AbstractTranscendental, allowing it to be treated as an atomic and exact mathematical expression with various evaluative and comparison capabilities. It also ensures consistency in rendering and context-based operations.
Attributes
- Deprecated
-
[Since version 0.1.0]use E instead. - Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass AbstractTranscendentaltrait Transcendentaltrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
ETranscendental.type
PiTranscendental is a case object representing the mathematical constant π (pi). It extends the AbstractTranscendental class, with a symbolic name "π" and Pi as its exact value.
PiTranscendental is a case object representing the mathematical constant π (pi). It extends the AbstractTranscendental class, with a symbolic name "π" and Pi as its exact value.
This object provides an exact representation of π and inherits capabilities for evaluation, materialization, and comparison from its abstract superclass.
Attributes
- Deprecated
-
use Pi instead.
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass AbstractTranscendentaltrait Transcendentaltrait AtomicExpressiontrait Nameabletrait Expressiontrait Approximatetrait Lazytrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
PiTranscendental.type