Learn R Programming

IntervalQuestionStat (version 0.2.0)

sum: Calculate the sum of \(n\) intervals

Description

This function calculates the sum of \(n\) nonempty compact real intervals.

Usage

# S4 method for IntervalList
sum(x)

Value

This function returns an IntervalData object with the calculated sum of the given \(n\) intervals, which is defined as another nonempty compact real interval.

Arguments

x

A list of intervals stored as an IntervalList object.

Author

José García-García garciagarjose@uniovi.es

Details

This function generalizes the Minkowski's sum of two nonempty compact real intervals explained in arithmetic section and implemented through + operator's method for two IntervalData objects.

References

Hankin, R.K.S. (2010). A step-by-step guide to writing a simple package that uses S4 methods: a "hello world" example. Technical Report. Auckland University of Technology.

See Also

For further information of the interval arithmetic see arithmetic.

Examples

Run this code
## The following code calculates the sum
## of a list with two different intervals
list <- IntervalList(c(1, 3), c(2, 5))
sum(list)

Run the code above in your browser using DataLab