AnyRoot

com.phasmidsoftware.number.core.inner.AnyRoot
case class AnyRoot(inversePower: Rational) extends InversePower

This object represents a general inverse power factor.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait InversePower
trait Factor
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def asRoot(value: Value): Option[String]

Converts a given value into a string representation and appends it to the root symbol.

Converts a given value into a string representation and appends it to the root symbol.

Value parameters

value

the value to be converted into a string representation.

Attributes

Returns

an optional string representing the root concatenated with the value.

def canMultiply(f: Factor): Boolean

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.

def convert(v: Value, f: Factor): Option[Value]

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.

override def doRaiseByPureNumber(x: Value, y: Value): Option[ProtoNumber]

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, or None otherwise

Definition Classes

Inherited methods

def add(x: Value, y: Value, f: Factor, negative: Boolean): Option[ProtoNumber]

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

Inherited from:
InversePower
def asImaginary(value: Value): Option[String]

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.

Inherited from:
InversePower
def canAdd(f: Factor): Boolean

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
def canRaise(f: Factor, exponent: Field): Boolean

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
def canShow(value: Value): Boolean

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 Factor can be rendered exactly; false otherwise.

Inherited from:
InversePower
def clean(po: Option[ProtoNumber]): Option[ProtoNumber]

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 None if input is None

Inherited from:
Factor
def invert(x: Value): Option[ProtoNumber]

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, or None otherwise

Inherited from:
InversePower
def isA(context: CoreContext): Boolean

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.

Inherited from:
InversePower
def isAdditive: Boolean

Determines if the current factor operates additively.

Determines if the current factor operates additively.

Attributes

Returns

false.

Inherited from:
InversePower
def modulate(v: Value): Value

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

Inherited from:
InversePower
def multiply(x: Value, y: Value, f: Factor): Option[ProtoNumber]

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

Inherited from:
InversePower
def multiplyRootValues(x: Value, r: Int, y: Value, s: Int): Option[ProtoNumber]

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; None if the values are not positive or cannot be represented rationally

Inherited from:
InversePower
def negate(x: Value): Option[ProtoNumber]

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; None if the operation is not applicable

Inherited from:
InversePower
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
def raise(x: Value, y: Value, f: Factor): Option[ProtoNumber]

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
override def render(x: Value): String

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
Inherited from:
InversePower
def render(x: String): String

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

Inherited from:
InversePower
def simplifyRoot(p: ProtoNumber, v: Value, r: Rational, divisor: Int): Option[ProtoNumber]

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

Inherited from:
InversePower
override def toString: String

Converts the object into its string representation.

Converts the object into its string representation.

Attributes

Returns

a string representation of the object

Definition Classes
InversePower -> Any
Inherited from:
InversePower

Inherited fields

lazy val isExact: Boolean

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.

Inherited from:
InversePower
val value: Double

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.

Attributes

Inherited from:
InversePower