InfiniteSeries
Represents an infinite mathematical series where the terms are lazily evaluated. This class extends the AbstractSeries class and serves as a concrete implementation for series that are infinite in nature.
Type parameters
- X
-
The type of elements in the series, which must have a
Numerictype-class instance.
Value parameters
- terms
-
A lazy sequence representing the terms of the infinite series.
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass AbstractInfiniteSeries[X]trait Series[X]class Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
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. - Definition Classes
Retrieves the number of terms of the series, if defined.
Retrieves the number of terms of the series, if defined.
Attributes
- Returns
-
None.
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.
Inherited 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. - Inherited from:
- AbstractInfiniteSeries
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]. - Inherited from:
- AbstractInfiniteSeries
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
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
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
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 from:
- AbstractInfiniteSeries