Search code examples
mupad

Error message about identifiers in MuPAD


I'm writing a program in MuPAD. In this I'm using an equation which contains summation as well as product of N terms. But on running the code MuPAD throws an error:

Error: The summation variable must be an identifier or indexed identifier. [sum]

Can anyone suggest something? Thanks in advance. Below is my entire code.In this i am getting error in the second last line.

N:= 2;
lamda:= 785*10^(-9);
d:= 1*10^3;
a:= 5*10^-2;
ap:= 10;
be:=5;
bo:=0.25;
rhom:= 0.95;
g:= 2*bo*(1-rhom);
ohm:= 0.5;
f:= ohm + 2*(bo)*rhom;
A:= ((2*(ap)^(ap/2))/((g^(1+(ap/2)))*gamma(ap)))*(((g*be)/(g*be+f))^(be+(ap/2)));
k:= 2*PI/lamda;
ak:= (binomial(be-1,k-1)/gamma(k))*((g*be+f)^(1-(k/2)))*((f/g)^(k-1))*(ap/be)^(k/2);
ad:= 0.6;
v:= (sqrt(PI)*a)/(sqrt(2)*ad);
ae:= float(sqrt((ad^2*sqrt(PI)*erf(v))/(2*v*exp(-v^2))));
sigmas:= 0.3;
z:= ae/(2*sigmas);
sk:=(z^2/(1+z^2));
Y:=(ap^2*be^2*sk^2*(g+f)^2)/(16*ui*((g*be)+f)^2);
ccc:= meijerG(5,1,[1,(2+z^2)/2],[z^2/2,ap/2,(1+ap)/2,k/2,(1+k)/2],Y);
X:= (((ap*be)/(g*be+f))^(-((ap+k)/2)));
pb:=(1/2)*product(numeric::sum(((z^2*A*ak*(2^(ap+k-4)))/PI)*X*ccc,k=1..be),i=1..N);
S2:=hfarray(1..3,[pb $ ui=1..3]);

Solution

  • The summation variable name k is already used here: k:= 2*PI/lamda. Changing to a different variable name fixes the error.