Could anyone help me to solve the error in the following code

code:
syms n k
n=4
k=0
symsum(nchoosek(n,k),k,0,n)
If i run the code it gives error stating Undefined function 'symsum' for input arguments of type 'double'.
Could anyone help me how to overcome it.

 Risposta accettata

>> syms n k
>> symsum(nchoosek(n,k),k,0,n)
ans =
2^n
>> subs(ans, n, 4)

3 Commenti

ok.thanks.the above command executes when n=4,could you please help me how to execute using different values on n say for example n=4,5,6,7. I tried with the following command for n=3,5,7 k=0 syms n k symsum(nchoosek(n,k),k,0,n) subs(ans, n, (3,5,7)) end but unable to get the result.Could you please help me on this.
syms n k
f = symsum(nchoosek(n,k),k,0,n);
subs(f, n, [4 5 6 7])

Accedi per commentare.

Più risposte (1)

You need to have Symbolic Math Toolbox. Please check the link Symsum undefined function error.

3 Commenti

ok.Is there anyother way to rewrite the above commands as there is no Symbolic Math Toolbox.
Could you share your code or example of it. Also I want to know, if its series is finite or infinity?
You would not have been able to use
syms n k
without the Symbolic Math toolbox -- not unless you happened to have Maple installed instead.

Accedi per commentare.

Categorie

Scopri di più su MATLAB in Centro assistenza e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by