What is the difference between sum and symsum

Answers (2)

sum works on double......it add the given numbers across specified dimension.
symsum works on symbolic variables.
You may read the documentation further.
symsum should only be used for calculating the formula for indefinite summations (or, sometimes, very large definite summations.) For example
syms k x
symsum(x^k/factorial(k), k, 1, inf)
symsum knows this is exp(x)
If you are adding up a finite list of distinct terms, you should probably be calculating the terms using vector calculations (and possibly subs() a vector of values into a symbolic expression) and then use sum() -- even if you are adding up symbolic expressions.
symsum() can never be used to index an array with a symbolic variable. You cannot use
symsum(x(k)/2^k, k, 1, length(x)) %wrong!!
for example.

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 1 Jan 2018

Answered:

on 1 Jan 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!