finiteSum {sumR}R Documentation

Calculates the sum of a discrete series with a single maximum for a pre-set number of evaluations

Description

A discrete finite series is calculated exactly with no need for approximations. This can also be used for infinite series approximation with a pre-determined number of iterations, but this has no guarantee of quality of approximation

Usage

finiteSum(logFunction, parameters = numeric(), n, n0 = 0)

Arguments

logFunction

The function that returns the series value an in the log scale. Can either be an R function or a string indicating one of the precompiled functions. See precompiled() for a list of available functions. If defined in R, the function's definition must have two arguments. The first argument must be the integer argument equivalent to nn in an and the second must be a vector of numeric parameters.

parameters

A numeric vector with parameters used in logFunction. Vectorized summation over various parameter values sets is not implemented. Use apply() or their variants to achieve this.

n

A single integer positive number indicating the number of iterations to perform in the function.

n0

The sum will be performed for the series starting at this value.

Value

A summed-objects() object.

See Also

precompiled() provides a list with precompiled functions that can be used for the summation.

Examples

# Sum values from 5 to 100
finiteSum(function(x, p) log(x), numeric(), 100 - 5, 5)

[Package sumR version 0.4.15 Index]