Series

com.phasmidsoftware.number.core.numerical.Series
See theSeries companion object
trait Series[X]

A trait representing a mathematical series, where terms can be computed and evaluated up to a certain level of precision or number of terms.

CONSIDER extending some trait like HasValue, NumberLike, Numerical, Evaluatable, or Fuzz...

Type parameters

X

the type of the series terms

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def evaluate(maybeN: Option[Int]): Option[X]

Evaluates the series up to a specified number of terms if provided.

Evaluates the series up to a specified number of terms if provided.

Value parameters

maybeN

an optional parameter specifying the maximum number of terms to evaluate; if None, the evaluation uses all available terms

Attributes

Returns

an Option containing the evaluation result of the series, or None if the evaluation cannot be performed

def evaluateToTolerance(epsilon: Double): Try[X]

Evaluates the series to a result of type X, stopping when the increment is below the specified precision epsilon.

Evaluates the series to a result of type X, stopping when the increment is below the specified precision epsilon.

Value parameters

epsilon

the desired precision level for the evaluation; the computation halts when the improvement between terms drops below this value

Attributes

Returns

a Try containing the result of the evaluation if successful, or a Failure if the series could not be evaluated

def nTerms: Option[Int]

Retrieves the total number of terms available in the series, if defined.

Retrieves the total number of terms available in the series, if defined.

Attributes

Returns

an Option containing the number of terms in the series, or None if the number is undefined

def term(n: Int): Option[X]

Computes the nth term of the series.

Computes the nth term of the series.

Value parameters

n

the index of the term to compute, where the index starts from 0

Attributes

Returns

an Option containing the computed term of type X if it exists, or None if the term cannot be computed

def terms: Seq[X]

Retrieves the sequence of terms in the series. NOTE that the sequence may be a List or a LazyList or something else.

Retrieves the sequence of terms in the series. NOTE that the sequence may be a List or a LazyList or something else.

Attributes

Returns

a sequence of terms of type X, representing the elements of the series

Concrete methods

def render(n: Int): String

Generates a string representation of the series, including up to a specified number of terms. The output is formatted as "Series: (n terms) x1, x2, ..., xn,".

Generates a string representation of the series, including up to a specified number of terms. The output is formatted as "Series: (n terms) x1, x2, ..., xn,".

Value parameters

n

the number of terms to include in the rendered representation of the series

Attributes

Returns

a string that represents the series with up to n terms