What is the difference between sum and symsum

Respuestas (2)

KSSV
KSSV el 1 de En. de 2018

0 votos

sum works on double......it add the given numbers across specified dimension.
symsum works on symbolic variables.
You may read the documentation further.
Walter Roberson
Walter Roberson el 1 de En. de 2018
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.

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 1 de En. de 2018

Respondida:

el 1 de En. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by