From: Nilanjan Roy on
so i am giving the following commands and am facing an error in eval function :-

>> syms p q m n k
>> n =24
>> m = 25

A = symsum ( ((sym('(n-1)!')/(sym('(n-k-1)!') * (sym('k!'))))* (sym('m!')/(sym('(m-k)!')*(sym('k!')))) *(p^k)* ((1 - p)^(n-k-1)) * (q^k)* ((1 - q)^(m - k))), k, 0, n-1)

matlab gives eval(A) values in terms of p and q for n = 13; m = 14. But when i use a little higher values like the ones above(25, 24) , I get the following error :-

>> eval(A)
??? Error: Unexpected MATLAB operator.

Error in ==> sym.eval at 15
s = evalin('caller',vectorize(map2mat(char(x))));


Could anyone suggest any way of avoiding the error and to get the desired eval(A) ??


Thanks a lot.
From: Nilanjan Roy on
Okk so this is me again.....
Although I do not have the reason why this is not working I can make things work when I break the symbolic sum expression into 2 parts :- one from k = 0 to something say (n-10) and then (n-9) to (n-1).
I guess the magnitude of the problem is large and thats why the error.
Hence consider this post as closed now.
Thanks.


"Nilanjan Roy" <royn2010(a)gmail.com> wrote in message <hltngu$9js$1(a)fred.mathworks.com>...
> so i am giving the following commands and am facing an error in eval function :-
>
> >> syms p q m n k
> >> n =24
> >> m = 25
>
> A = symsum ( ((sym('(n-1)!')/(sym('(n-k-1)!') * (sym('k!'))))* (sym('m!')/(sym('(m-k)!')*(sym('k!')))) *(p^k)* ((1 - p)^(n-k-1)) * (q^k)* ((1 - q)^(m - k))), k, 0, n-1)
>
> matlab gives eval(A) values in terms of p and q for n = 13; m = 14. But when i use a little higher values like the ones above(25, 24) , I get the following error :-
>
> >> eval(A)
> ??? Error: Unexpected MATLAB operator.
>
> Error in ==> sym.eval at 15
> s = evalin('caller',vectorize(map2mat(char(x))));
>
>
> Could anyone suggest any way of avoiding the error and to get the desired eval(A) ??
>
>
> Thanks a lot.