SineCos

com.phasmidsoftware.number.expression.expr.SineCos
See theSineCos companion object
abstract class SineCos(sine: Boolean, parity: Parity) extends 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 (true for sine, false for cosine).

Attributes

Companion
object
Graph
Supertypes
trait Eager => Valuable
class Object
trait Matchable
class Any
Show all
Known subtypes
object Cosine
object Sine

Members list

Value members

Concrete methods

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

Applies the sine or cosine function to a given Valuable value if the value matches specific constants. Returns an exact result for known trigonometric values of zero, π/2, π, and 3π/2.

Applies the sine or cosine function to a given Valuable value if the value matches specific constants. Returns an exact result for known trigonometric values of zero, π/2, π, and 3π/2.

Value parameters

x

the input Valuable value to be evaluated.

Attributes

Returns

an Option[Valuable] containing the result of the sine or cosine function if the input matches a known constant, or None if the input does not match any predefined constants.

def paramContext(context: Context): Context

Regardless of the value of context, the required Context for the parameter is Radian.

Regardless of the value of context, the required Context for the parameter is Radian.

Value parameters

context

ignored.

Attributes

Returns

a new RestrictedContext instance configured with the Radian factor.

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
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