Reciprocal

com.phasmidsoftware.number.expression.expr.Reciprocal
case object Reciprocal extends ExpressionMonoFunction

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

Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Eager => Valuable
class Object
trait Matchable
class Any
Show all
Self type
Reciprocal.type

Members list

Type members

Inherited types

type MirroredElemLabels = EmptyTuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Singleton
type MirroredElemTypes = EmptyTuple

Attributes

Inherited from:
Singleton
type MirroredMonoType = this.type

The mirrored *-type.

The mirrored *-type.

Attributes

Inherited from:
Singleton
type MirroredType = this.type

Attributes

Inherited from:
Singleton

Inherited and Abstract types

type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def applyExact(x: Eager): Option[Eager]

Attempts to compute the reciprocal (exact inverse) of the given Valuable. For specific cases of Real representations, such as ExactNumber with pure, logarithmic, or root factors, the method determines the inverse or applies negation as appropriate. Complex or unsupported Valuable cases are ignored, and None is returned.

Attempts to compute the reciprocal (exact inverse) of the given Valuable. For specific cases of Real representations, such as ExactNumber with pure, logarithmic, or root factors, the method determines the inverse or applies negation as appropriate. Complex or unsupported Valuable cases are ignored, and None is returned.

Value parameters

x

the input Valuable to which the exact reciprocal operation should be applied.

Attributes

Returns

an Option[Valuable] containing the exact reciprocal if it can be computed, otherwise None.

def paramContext(context: Context): Context

Ignores the provided context and returns contexts that can be exactly inverted.

Ignores the provided context and returns contexts that can be exactly inverted.

Value parameters

context

ignored.

Attributes

Returns

a new context resulting from the combination of the RestrictedContext defined with PureNumber and the AnyLog condition using the logical "or" operation.

Inherited methods

def andThen[A](g: Valuable => A): Eager => A

Composes two instances of Function1 in a new Function1, with this function applied first.

Composes two instances of Function1 in a new Function1, with this function applied first.

Type parameters

A

the result type of function g

Value parameters

g

a function R => A

Attributes

Returns

a new function f such that f(x) == g(apply(x))

Inherited from:
Function1
def apply(x: Eager): Eager

Evaluate this function on Valuable x.

Evaluate this function on Valuable x.

Value parameters

x

the parameter to the function.

Attributes

Returns

the result of f(x).

Inherited from:
ExpressionMonoFunction
def applyComplex(z: Complex): Option[Eager]

Applies the mathematical operation encapsulated by this ExpressionMonoFunction to the given complex number. The operation is determined based on the specific subtype or case of this function instance.

Applies the mathematical operation encapsulated by this ExpressionMonoFunction to the given complex number. The operation is determined based on the specific subtype or case of this function instance.

Value parameters

z

the input complex number of type algebra.eager.Complex to which the operation will be applied

Attributes

Returns

an Option[Eager] containing the result of applying the operation as an Eager instance, or None if the operation is not supported for this function instance

Inherited from:
ExpressionMonoFunction
def compose[A](g: A => Eager): A => Valuable

Composes two instances of Function1 in a new Function1, with this function applied last.

Composes two instances of Function1 in a new Function1, with this function applied last.

Type parameters

A

the type to which function g can be applied

Value parameters

g

a function A => T1

Attributes

Returns

a new function f such that f(x) == apply(g(x))

Inherited from:
Function1
def evaluate(a: Expression)(context: Context): Option[Eager]

Evaluates the given Expression in the specified Context and attempts to derive an Eager result. This method relies on the Expression being evaluated as-is and applies this function's exact logic if applicable.

Evaluates the given Expression in the specified Context and attempts to derive an Eager result. This method relies on the Expression being evaluated as-is and applies this function's exact logic if applicable.

CONSIDER the alternative version (commented out) which seems like it should be correct but isn't.

Value parameters

a

the Expression to be evaluated.

context

the Context within which the evaluation is performed.

Attributes

Returns

an Option[Eager] containing the result of the evaluation if successful, or None otherwise.

Inherited from:
ExpressionMonoFunction
def fromProduct(p: Product): MirroredMonoType

Creates a new instance of type T with elements taken from product p.

Creates a new instance of type T with elements taken from product p.

Attributes

Inherited from:
Singleton
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
override def toString: String

Generate helpful debugging information about this ExpressionMonoFunction.

Generate helpful debugging information about this ExpressionMonoFunction.

Attributes

Returns

a String.

Definition Classes
ExpressionMonoFunction -> Function1 -> Any
Inherited from:
ExpressionMonoFunction

Inherited fields

val f: Eager => Eager

Attributes

Inherited from:
ExpressionMonoFunction
val name: String

Returns the name of the expression function.

Returns the name of the expression function.

Attributes

Returns

a string representing the name of the function

Inherited from:
ExpressionMonoFunction
val parity: Parity

Attributes

Inherited from:
ExpressionMonoFunction