Log

com.phasmidsoftware.number.expression.expr.Log
case object Log extends ExpressionBiFunction

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

Graph
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait ((Eager, Eager)) => Valuable
class Object
trait Matchable
class Any
Show all
Self type
Log.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(a: Eager, b: Eager): Option[Eager]

Applies a binary operation to the provided Valuable elements a and b, with stricter evaluation rules, and returns an optional result. The evaluation succeeds only if the operation satisfies specific conditions (e.g., exact representations or mathematical constraints).

Applies a binary operation to the provided Valuable elements a and b, with stricter evaluation rules, and returns an optional result. The evaluation succeeds only if the operation satisfies specific conditions (e.g., exact representations or mathematical constraints).

Value parameters

a

the Valuable whose log we required, a Valuable instance.

b

the base, a Valuable instance.

Attributes

Returns

an Option[Valuable] containing the result of the operation if it can be computed exactly, or None if the operation fails to meet exactness requirements.

def leftContext(context: Context): Context

Identifies and retrieves a restricted evaluation context suitable for left-hand operations.

Identifies and retrieves a restricted evaluation context suitable for left-hand operations.

This method reduces the input Context by applying constraints, resulting in a new RestrictedContext based on predefined evaluation criteria.

Value parameters

context

the input evaluation Context that defines the left-hand context for the operation.

Attributes

Returns

a RestrictedContext(PureNumber) object that represents the constrained left-hand evaluation context.

def rightContext(factor: Factor)(context: Context): Context

Retrieves the right-hand evaluation context associated with this function.

Retrieves the right-hand evaluation context associated with this function.

Value parameters

context

the input evaluation Context that specifies the right-hand context for the operation.

Attributes

Returns

the same Context object passed as input, representing the right-hand evaluation context.

Inherited methods

def andThen[A](g: Valuable => A): (Eager, 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(ff: (Eager, Eager)): Eager

Alternative apply method which satisfies the type declaration. Applies the binary function f to the given tuple of Eager elements.

Alternative apply method which satisfies the type declaration. Applies the binary function f to the given tuple of Eager elements.

Value parameters

ff

a tuple containing two Eager elements, representing the inputs to the binary function.

Attributes

Returns

a Eager that is the result of applying the binary function to the input tuple.

Inherited from:
ExpressionBiFunction
def apply(a: Eager, b: Eager): Eager

Evaluate this function on x.

Evaluate this function on x.

Value parameters

a

the first parameter to the function.

b

the second parameter to the function.

Attributes

Returns

the result of f(x).

Inherited from:
ExpressionBiFunction
def applyExact(p: (Eager, Eager)): Option[Eager]

Applies the function exactly to the given input of type P, returning an Option of type Valuable if the application is successful.

Applies the function exactly to the given input of type P, returning an Option of type Valuable if the application is successful.

If defined, the output is guaranteed to be exact.

Value parameters

p

the input parameter of type P to which the function is applied

Attributes

Returns

an Option containing a Valuable result if the function executes successfully, or None if the operation cannot produce a valid result

Inherited from:
ExpressionBiFunction
def compose[A](g: A => (Eager, 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, b: Expression)(context: Context): Option[Eager]

Evaluates two expressions x and y in a given context and determines the resulting Valuable based on specific identity and evaluation rules. Trivial identities are recognized and evaluated appropriately.

Evaluates two expressions x and y in a given context and determines the resulting Valuable based on specific identity and evaluation rules. Trivial identities are recognized and evaluated appropriately.

Value parameters

a

the first expression to be evaluated.

b

the second expression to be evaluated.

context

the evaluation context providing the necessary environment for resolving expressions.

Attributes

Returns

an Option[Valuable] containing the result of the evaluation if successful, or None if evaluation fails.

Inherited from:
ExpressionBiFunction
def evaluateAsIs(x: Expression, y: Expression): Option[Eager]

Evaluates two expressions as-is (without any simplification or conversion) and applies the function f to the results if both evaluations are successful.

Evaluates two expressions as-is (without any simplification or conversion) and applies the function f to the results if both evaluations are successful.

Value parameters

x

the first expression to be evaluated.

y

the second expression to be evaluated.

Attributes

Returns

an Option[Valuable] containing the result of applying the binary function to the evaluated results of x and y, or None if either evaluation fails.

Inherited from:
ExpressionBiFunction
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
ExpressionBiFunction -> Function1 -> Any
Inherited from:
ExpressionBiFunction

Inherited fields

lazy val commutes: Boolean

Indicates whether the binary operation represented by this instance commutes, meaning the result remains unchanged for arbitrary swapping of inputs. This is determined based on the absence of a right-hand identity (maybeIdentityR).

Indicates whether the binary operation represented by this instance commutes, meaning the result remains unchanged for arbitrary swapping of inputs. This is determined based on the absence of a right-hand identity (maybeIdentityR).

Attributes

Inherited from:
ExpressionBiFunction
val f: (Eager, Eager) => Eager

Attributes

Inherited from:
ExpressionBiFunction
val isExact: Boolean

Attributes

Inherited from:
ExpressionBiFunction
val maybeIdentityL: Option[Eager]

Attributes

Inherited from:
ExpressionBiFunction
val maybeIdentityR: Option[Eager]

Attributes

Inherited from:
ExpressionBiFunction
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:
ExpressionBiFunction