GeneralNumber

com.phasmidsoftware.number.core.numerical.GeneralNumber
See theGeneralNumber companion class
object GeneralNumber

The GeneralNumber object provides utility methods for performing various operations on numbers with particular emphasis on exact, fuzzy, and generalized numeric types. It aims to handle operations in a flexible way based on the types and factors associated with numbers.

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def applyFunc(f: Double => Double, dfByDx: Double => Double)(x: Number): Try[Number]

Applies a given mathematical function along with its derivative to the specified number.

Applies a given mathematical function along with its derivative to the specified number.

Value parameters

dfByDx

The derivative of the function f, mapping a Double to a Double.

f

A function mapping a Double to a Double, representing the main operation to be applied.

x

The input number on which the function f and its derivative are to be applied.

Attributes

Returns

A Try containing the resulting Number if the operation succeeds, or a failure if an error occurs.

def doTimes(p: Number, q: Number, factor: Factor): Number

Performs the multiplication operation between two numbers using a given factor.

Performs the multiplication operation between two numbers using a given factor.

Value parameters

factor

an instance of Factor representing specific configuration or scaling rules for the operation

p

the first number to be multiplied

q

the second number to be multiplied

Attributes

Returns

the result of multiplying the two numbers, represented as a Number

def isInfinite(x: Number): Boolean

Checks if the given number is infinite.

Checks if the given number is infinite.

Value parameters

x

the number to be checked for infinity.

Attributes

Returns

true if the number is infinite, otherwise false.

def isZero(x: Number): Boolean

Determines if the given number is equivalent to zero.

Determines if the given number is equivalent to zero.

Value parameters

x

the number to check.

Attributes

Returns

true if the number is zero, otherwise false.

def plus(x: Number, y: Number): Number

Performs the addition operation between two numbers, combining them into a single resultant number as per the mathematical rules defined by their specific types and factors.

Performs the addition operation between two numbers, combining them into a single resultant number as per the mathematical rules defined by their specific types and factors.

Value parameters

x

the first number to be added

y

the second number to be added

Attributes

Returns

the result of adding the two given numbers

def power(x: Number, y: Number): Number

Method to raise an (exact) Number to a power. NOTE: This method is invoked only by doPower (in ExactNumber).

Method to raise an (exact) Number to a power. NOTE: This method is invoked only by doPower (in ExactNumber).

TODO: move this into ExactNumber but CAREFULLY!

CONSIDER: surely that y.scale(PureNumber) might create a fuzzy number, right?

Value parameters

x

the base Number (always exact).

y

the power (may not be exact).

Attributes

Returns

x raised to the power of y.

def times(x: Number, y: Number): Number

Computes the product of two Number instances recursively.

Computes the product of two Number instances recursively.

Value parameters

x

the first operand, represented as a Number instance

y

the second operand, represented as a Number instance

Attributes

Returns

the result of multiplying x and y, represented as a Number instance

Concrete fields

A higher-order function that creates a new Number instance based on a provided prototype ProtoNumber and a Number instance.

A higher-order function that creates a new Number instance based on a provided prototype ProtoNumber and a Number instance.

Attributes

Returns

A new Number instance created by the make method of the provided Number, using elements of the given ProtoNumber.