Hello.
I have a problem using nested symbolic summations when the symbolic engine finds no valid sum indexes.
Specifically, I am trying solving the following problem:
I want to calculate a nested summation that looks something like the following:
Where
.
I have defined symbolic integer variables d, T, T1, c1, c2 and a symbolic function c20(T1,c1).
Then I use the following code to calculate the sum:
S(d,T) = symsum(...
symsum(...
symsum(1,...
c2,c20(c1,T1,T),d-1),...
c1,T1,d-1),...
T1,1,T-1)
At another point in the code I assign a numeric value to T and d and try to convert everything to double:
DoubleVal = double(subs(S(Tval,dval)));
Now, for Tval = 1 the summation is supposed to be zero. However I think that the symbolic engine is trying to assign a NaN value to T1 which causes an error in the nested sum, as c1 cannot be NaN. As a result instead of getting DoubleVal = 0 I get an "inconsistent assumptions" error. The same thing happens when d is too small wrt T.
How can I force matlab to assign zero as the result of a summation in which there are no available indexes?
Thank you very much