AbstractInfiniteSeries
Represents an abstract mathematical series, inheriting from the Series trait. Provides methods for evaluating the series and accessing individual terms. This class facilitates the representation and evaluation of a series where terms are of type X and are subject to numerical operations.
Type parameters
- X
-
The type of elements in the series, which must have a
Numerictype-class instance.
Value parameters
- terms
-
A sequence representing the terms of the mathematical series.
Attributes
- Graph
-
- Supertypes
- Known subtypes
-
class InfiniteSeries[X]
Members list
Value members
Abstract methods
Returns the default convergence rate used for evaluating the series. The convergence rate determines the threshold at which terms in the series are considered sufficiently small to be ignored in the evaluation. This is used to determine the error bounds when evaluating to a tolerance. The error bounds are the tolerance divided by this number
Returns the default convergence rate used for evaluating the series. The convergence rate determines the threshold at which terms in the series are considered sufficiently small to be ignored in the evaluation. This is used to determine the error bounds when evaluating to a tolerance. The error bounds are the tolerance divided by this number
Attributes
- Returns
-
The convergence rate as a
Double.
Creates a new series from a lazy list of terms, providing a representation of a mathematical series. The terms of the series are derived from the elements of the provided LazyList.
Creates a new series from a lazy list of terms, providing a representation of a mathematical series. The terms of the series are derived from the elements of the provided LazyList.
Value parameters
- ys
-
A
LazyListof terms from which the series will be constructed. The terms must be of a numeric type, and aNumericcontext bound is required for the type parameterY.
Attributes
- Returns
-
A
Series[Y], representing the mathematical series defined by the input terms.
Concrete methods
Evaluates the series by summing the specified number of terms or a default number of terms if not provided. If any term cannot be evaluated, the method returns None.
Evaluates the series by summing the specified number of terms or a default number of terms if not provided. If any term cannot be evaluated, the method returns None.
Value parameters
- maybeN
-
An optional integer specifying the number of terms to evaluate. If not provided, the default number of terms will be used.
Attributes
- Returns
-
An
Option[X]containing the result of the summation if all terms are successfully evaluated, orNoneif any term evaluation fails.
Evaluates the series by summing the terms until their absolute value falls below a given threshold. NOTE: the result of this method is always a Try[Number], regardless of X. If X and Number are not the same, a ClassCastException will be thrown.
Evaluates the series by summing the terms until their absolute value falls below a given threshold. NOTE: the result of this method is always a Try[Number], regardless of X. If X and Number are not the same, a ClassCastException will be thrown.
Value parameters
- epsilon
-
The threshold value for determining the cutoff in the series evaluation. Terms with an absolute value less than this will not be included.
Attributes
- Returns
-
A
Trycontaining the result of the series evaluation if successful, or an exception if the computation fails. - Note
-
Throws java.lang.ClassCastException if
Xis notFuzz[Double].
Transforms the elements of the series using the provided function and returns a new series.
Transforms the elements of the series using the provided function and returns a new series.
Type parameters
- Y
-
The type of the elements in the resulting series, constrained by the
Numerictype class.
Value parameters
- f
-
A function that maps each element of type
Xin the series to a new element of typeY.
Attributes
- Returns
-
A new series where each element is the result of applying the function
fto the corresponding element in the original series.
Retrieves the term at the specified index from the series, if the index is valid.
Retrieves the term at the specified index from the series, if the index is valid.
A valid index is non-negative and less than the total number of terms in the series, as defined by nTerms.
Value parameters
- i
-
The index of the term to retrieve.
Attributes
- Returns
-
An
Optioncontaining the term at the given index if the index is valid, orNoneotherwise.
Inherited methods
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
nterms - Inherited from:
- Series
Inherited and Abstract methods
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
- Inherited from:
- Series