A sealed trait extending the Factor trait, representing a mathematical root-based factorization.
This trait provides mechanisms to convert values associated with one root-based factor to another, when such conversions are mathematically possible.
Attributes
- Companion
- object
- Graph
-
- Supertypes
- Known subtypes
Members list
Value members
Abstract methods
Converts the given value into its root representation if applicable.
Converts the given value into its root representation if applicable.
Value parameters
- value
-
the Value object to be converted into its root representation.
Attributes
- Returns
-
an optional String representing the root form of the value, or None if the conversion is not applicable.
Retrieves the root degree represented by this factor.
Retrieves the root degree represented by this factor.
The root degree indicates the mathematical nth root applicable to this factor. For instance, a root degree of 2 represents a square root, a root degree of 3 represents a cube root, and so on.
Attributes
- Returns
-
the integer value of the root degree.
Concrete methods
Adds two values together and computes an appropriate factor for the result.
Adds two values together and computes an appropriate factor for the result.
Value parameters
- f
-
the factor associated with y
- negative
-
NOTE ignored.
- x
-
the first value
- y
-
the addend
Attributes
- Returns
-
an optional tuple containing the resultant value and its factor
Converts a given Value into its imaginary representation, if applicable.
Converts a given Value into its imaginary representation, if applicable.
The method checks if the provided value can be represented as an imaginary number based on specific mathematical conditions, such as whether it is a negative integer and has a corresponding square root.
Value parameters
- value
-
the Value object to be evaluated and potentially converted into its imaginary representation.
Attributes
- Returns
-
an optional String representing the imaginary form of the value, or None if the value does not meet the conditions for conversion to an imaginary number.
Determines whether given value with this Factor can be rendered exactly.
Determines whether given value with this Factor can be rendered exactly.
Attributes
- Returns
-
true if this
Factorcan be rendered exactly; false otherwise.
Raises the value x to the power of the value y.
Raises the value x to the power of the value y.
Value parameters
- x
-
the base value to be raised
- y
-
the exponent value (from a PureNumber)
Attributes
- Returns
-
an optional result of type
ProtoNumber, representing the computed value if the operation is valid, orNoneotherwise
Inverts the given value by raising it to the power of -1, using a pure number factor.
Inverts the given value by raising it to the power of -1, using a pure number factor.
Value parameters
- x
-
the value to be inverted
Attributes
- Returns
-
an optional result of type
ProtoNumber, representing the inverted value if the operation is valid, orNoneotherwise
Determines if the current factor satisfies certain conditions within the given context.
Determines if the current factor satisfies certain conditions within the given context.
Value parameters
- context
-
the context in which the factor is evaluated.
Attributes
- Returns
-
a Boolean indicating whether the factor satisfies the specified conditions in the given context.
Determines if the current factor operates additively.
Determines if the current factor operates additively.
Attributes
- Returns
-
false.
Modulates the given value according to the context or rules defined by this factor.
Modulates the given value according to the context or rules defined by this factor.
Value parameters
- v
-
the value to be modulated
Attributes
- Returns
-
the modulated value
Multiplies two values together and computes an appropriate factor for the result.
Multiplies two values together and computes an appropriate factor for the result.
Value parameters
- f
-
the factor associated with y
- x
-
the first value
- y
-
the multiplicand
Attributes
- Returns
-
an optional tuple containing the resultant value and its factor
Multiplies the root values of two given Value objects based on their respective root degrees.
Multiplies the root values of two given Value objects based on their respective root degrees.
This method computes the product of the rational representations of x and y, each raised to their specified root degrees (r and s respectively). The result is wrapped with an associated factor and optional additional information if the operation is valid. The method ensures that the input values are positive and can be represented rationally.
Value parameters
- r
-
the root degree of the first value
- s
-
the root degree of the second value
- x
-
the first value to be multiplied
- y
-
the second value to be multiplied
Attributes
- Returns
-
an optional tuple containing the resultant value, its associated factor, and optional metadata;
Noneif the values are not positive or cannot be represented rationally
Negates the given value and computes an appropriate output tuple. The computation may include a value, its associated factor, and an optional fuzziness.
Negates the given value and computes an appropriate output tuple. The computation may include a value, its associated factor, and an optional fuzziness.
Value parameters
- x
-
the value to be negated
Attributes
- Returns
-
an optional tuple containing the negated value, its factor, and an optional fuzziness;
Noneif the operation is not applicable
Generates a string representation of the cube root for a given input.
Generates a string representation of the cube root for a given input.
Value parameters
- x
-
the input string to be represented with the cube root symbol
Attributes
- Returns
-
a string in the format ³√ followed by the input
Method to render a Value in the context of this Factor.
Method to render a Value in the context of this Factor.
Value parameters
- x
-
the Value.
Attributes
- Returns
-
a String.
- Definition Classes
Simplifies a root representation of a number based on the given parameters. The method computes whether the provided value v can be converted into a simpler root form using the provided divisor (e.g., square root for divisor 2, cube root for divisor 3).
Simplifies a root representation of a number based on the given parameters. The method computes whether the provided value v can be converted into a simpler root form using the provided divisor (e.g., square root for divisor 2, cube root for divisor 3).
Value parameters
- divisor
-
the root degree (e.g., 2 for square root, 3 for cube root)
- p
-
the prototype number containing initial value and metadata
- r
-
the rational factor determining the type of root operation
- v
-
the value to be simplified
Attributes
- Returns
-
an optional ProtoNumber containing the simplified root representation, or the original input if simplification is not applicable
Converts the object into its string representation.
Converts the object into its string representation.
Attributes
- Returns
-
a string representation of the object
- Definition Classes
-
Any
Inherited methods
Determines whether the current factor can be augmented by the given factor. CONSIDER do we need this method now that we have add(x, y, this)?
Determines whether the current factor can be augmented by the given factor. CONSIDER do we need this method now that we have add(x, y, this)?
Value parameters
- f
-
the factor to be checked for compatibility with addition.
Attributes
- Returns
-
true if the factors can be added; false otherwise.
- Inherited from:
- Factor
Determines whether this factor can be raised by the given factor f. CONSIDER do we need this method now that we have raise(x, y, this)?
Determines whether this factor can be raised by the given factor f. CONSIDER do we need this method now that we have raise(x, y, this)?
Value parameters
- f
-
the factor to be checked for compatibility with raising to a power.
Attributes
- Returns
-
true if the factors can be powered; false otherwise.
- Inherited from:
- Factor
Cleans a given optional ProtoNumber by potentially simplifying its root quantities based on specific conditions and returning the modified result.
Cleans a given optional ProtoNumber by potentially simplifying its root quantities based on specific conditions and returning the modified result.
Value parameters
- po
-
an optional ProtoNumber that may be simplified
Attributes
- Returns
-
an optional ProtoNumber, simplified if applicable, or
Noneif input isNone - Inherited from:
- Factor
Raises x to the power of y and compute an appropriate factor for the result. NOTE: for now, we only allow raising to a power of a PureNumber. TODO: enable powers of Radian factor.
Raises x to the power of y and compute an appropriate factor for the result. NOTE: for now, we only allow raising to a power of a PureNumber. TODO: enable powers of Radian factor.
Value parameters
- f
-
the factor associated with y
- x
-
the first value
- y
-
the power
Attributes
- Returns
-
an optional tuple containing the resultant value and its factor
- Inherited from:
- Factor
Inherited and Abstract methods
Determines whether the current factor can be multiplied by the given factor. CONSIDER do we need this method now that we have multiply(x, y, this)?
Determines whether the current factor can be multiplied by the given factor. CONSIDER do we need this method now that we have multiply(x, y, this)?
Value parameters
- f
-
the factor to be checked for compatibility with multiplication.
Attributes
- Returns
-
true if the factors can be multiplied; false otherwise.
- Inherited from:
- Factor
Convert a value x from this factor to f if possible, using the simplest possible mechanism. If the factors are incompatible, then None will be returned.
Convert a value x from this factor to f if possible, using the simplest possible mechanism. If the factors are incompatible, then None will be returned.
NOTE: only ScalarScalar, NthRootNthRoot or LogarithmicLogarithmic conversions can be effected.
Value parameters
- f
-
the factor of the result.
- v
-
the value to be converted.
Attributes
- Returns
-
an optional Value which, given factor f, represents the same quantity as v given this.
- Inherited from:
- Factor
Concrete fields
Determines whether the current scalar can be exactly converted to a PureNumber.
Determines whether the current scalar can be exactly converted to a PureNumber.
Attributes
- Returns
-
true if the scalar represents an exact value; false otherwise.
A value which can be used to convert a value associated with this Factor to a different Factor.
A value which can be used to convert a value associated with this Factor to a different Factor.