Function reference · Calculus

sum

Evaluates a finite symbolic sum over an integer index.

With concrete integer bounds, Nerdamer substitutes the index through the inclusive range and adds the resulting symbolic terms. If a bound is still symbolic, the sum remains unevaluated.

Examples

These examples use Nerdamer Notation.

Sum a simple finite integer range.

sum(k,k,1,5)
// → 15

Combine symbolic indexing, a Vector, size(...), and a finite sum.

V:[x,x^2-1,2]; sum(3*V[k],k,0,size(V)[0]-1)
// → 3+3*x+3*x^2

Substitute a finite integer range through an expression with symbolic parameters.

sum((a*k+b)^2,k,1,5)
// → (b+a)^2+(b+2*a)^2+(b+3*a)^2+(b+4*a)^2+(b+5*a)^2

Interfaces

The same operation is available through the interfaces below.

Nerdamer Notation · nerdamer API · Direct API

Nerdamer Notation

Use this form inside input passed to nerdamer(...).

sum(arg1, arg2, arg3, arg4)

nerdamer.sum

Call the operation through the default nerdamer import.

nerdamer.sum(expr: Expression, index: Expression, lower: Expression, upper: Expression): Expression

Parameters

NameTypeDescription
exprExpressionThe expression to be summed.
indexExpressionThe index variable (must be a plain symbol).
lowerExpressionThe lower bound (integer required for evaluation).
upperExpressionThe upper bound (integer required for evaluation).

Returns

Expression — The summation result or a symbolic sum node.

Browse the nerdamer API →

Direct JavaScript / TypeScript API

Import the operation directly from its package entry point.

import { sum } from 'nerdamer/calculus';
sum(expr: Expression, index: Expression, lower: Expression, upper: Expression): Expression

Parameters

NameTypeDescription
exprExpressionThe expression to be summed.
indexExpressionThe index variable (must be a plain symbol).
lowerExpressionThe lower bound (integer required for evaluation).
upperExpressionThe upper bound (integer required for evaluation).

Returns

Expression — The summation result or a symbolic sum node.

Browse nerdamer/calculus →

← Back to Function reference