Computes the sum of an expression evaluated for each member of a collection.
Namespace:
Extreme.Mathematics
Assembly:
Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
public static double Sum<T>(
IEnumerable<T> collection,
Func<T, double> terms
)
Public Shared Function Sum(Of T) (
collection As IEnumerable(Of T),
terms As Func(Of T, Double)
) As Double
public:
generic<typename T>
static double Sum(
IEnumerable<T>^ collection,
Func<T, double>^ terms
)
static member Sum :
collection : IEnumerable<'T> *
terms : Func<'T, float> -> float
Parameters
- collection
- Type: System.Collections.GenericIEnumerableT
An enumerable collection of elements of type T. - terms
- Type: SystemFuncT, Double
A delegate that returns the value of the specified term.
Type Parameters
- T
- The type of the elements of the collection.
Return Value
Type:
DoubleThe sum of
terms evaluated for each element of
collection.
Reference