InfiniteProduct

com.phasmidsoftware.number.core.misc.InfiniteProduct
case class InfiniteProduct[X](f: Int => X)(using evidence$1: Numeric[X]) extends Int => X

This case class represents an infinite product of terms which can be derived by a function (f) which takes as its parameter a prime number.

Each successive term in the product is based on the list of primes starting with 2.

Type parameters

X

a type for which there is evidence of Numeric[X].

Value parameters

f

the function (see description above).

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Int => X
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def apply(n: Int): X

The apply function which takes a number n and returns a value of X representing the (finite) product of the first n terms of the infinite series.

The apply function which takes a number n and returns a value of X representing the (finite) product of the first n terms of the infinite series.

Value parameters

n

the number which specifies how many terms we should use to evaluate this infinite product.

Attributes

Returns

an X which represents an approximation to the infinite product.

def toDouble(n: Int): Double

A function which takes a number n and returns a Double representing the (finite) product of the first n terms of the infinite series.

A function which takes a number n and returns a Double representing the (finite) product of the first n terms of the infinite series.

Value parameters

n

the number which specifies how many terms we should use to evaluate this infinite product.

Attributes

Returns

a Double which represents an approximation to the infinite product. This values depends on #apply(n).

Inherited methods

def andThen[A](g: X => A): Int => 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 compose[A](g: A => Int): A => X

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 productElementNames: Iterator[String]

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
def productIterator: Iterator[Any]

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
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1

Concrete fields

lazy val asLazyList: LazyList[X]

A lazy val representing the LazyList[X] which is all the terms of the infinite product.

A lazy val representing the LazyList[X] which is all the terms of the infinite product.

Attributes