Search code examples
matlabinfinity

How to implement negative infinity to positive infinity limit in MATLAB?


I need to find the limit of

symsum(expression,variable,-Inf,Inf)

It gives error. How I can solve.


Solution

  • Split the summation range in two. For example, to sum 1/(k+1/2)^2 for k ranging from -inf to inf:

    >> syms k
    >> S = symsum(1/(k+1/2)^2,1,inf) + symsum(1/(-k+1/2)^2,0,inf)
    S =
    pi^2