Function Math.Sum Method
Definition
Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
Overload List
Sum( | Computes the sum of an expression evaluated over the specified range. |
Sum<T>(IEnumerable<T>, Func<T, Double>) | Computes the sum of an expression evaluated for each member of a collection. |
Sum<T>(IEnumerable<T>, Func<T, Double>)
Computes the sum of an expression evaluated for each member of a collection.
public static double Sum<T>(
IEnumerable<T> collection,
Func<T, double> terms
)
Parameters
- collection IEnumerable<T>
- An enumerable collection of elements of type T.
- terms Func<T, Double>
- A delegate that returns the value of the specified term.
Type Parameters
- T
- The type of the elements of the collection.
Return Value
DoubleThe sum of terms evaluated for each element of collection.
Exceptions
Argument | terms is null. |
Sum(Func<Int32, Double>, Int32, Int32)
Computes the sum of an expression evaluated over the specified range.
public static double Sum(
Func<int, double> terms,
int lowerBound,
int upperBound
)
Parameters
- terms Func<Int32, Double>
- A delegate that returns the value of the specified term.
- lowerBound Int32
- The (inclusive) lower bound of the summation.
- upperBound Int32
- The (exclusive) upper bound of the summation.
Return Value
DoubleThe sum of terms evaluated at all integers from lowerBound up to but not including upperBound.
Exceptions
Argument | terms is null. |