Symbolic summation.
Syntax
r = symsum(s)
r = symsum(s,v)
r = symsum(s,a,b)
r = symsum(s,v,a,b)
Description
symsum(s) is the summation of the symbolic expression s with respect to its symbolic variable k as determined by findsym from 0 to k-1.
symsum(s,v) is the summation of the symbolic expression s with respect to the symbolic variable v from 0 to v-1.
symsum(s,a,b) and symsum(s,v,a,b) are the definite summations of the symbolic expression from v=a to v=b.
Examples
The commands
syms k n x
symsum(k^z)
return
1/3*k^3-1/2*k^2+1/6*k
symsum(k) returns
1/2*k^2-1/2*k
symsum(sin(k*pi)/k,0,n) returns
-1/2*sin(k*(n+1))/k+1/2*sin(k)/k/(cos(k)-1)*cos(k*(n+1))-
1/2*sin(k)/k/(cos(k)-1)
symsum(k^2,0,10) returns
385
symsum(x^k/sym(`k!'), k, 0,inf) returns
exp(x)
Note
The preceding example uses sym to create the symbolic expression k! in order to bypass MATLAB's expression parser, which does not recognize ! as a factorial operator.
See Also
findsym, int, syms
[ Previous | Help Desk | Next ]