In the following code, I assume that my variables are strictly positive. However, mathematica doesn't take this in consideration when it evaluates the If : the If is still in a non simplified form.
Why ?
In[99]:= Clear[PXMini, PXini, PM, lambda00, lambda00Bis, lambda, \
lambdaBis]
In[100]:= PXMini = Table[0, {i, 1, 8}, {j, 1, 8}];
In[101]:= PXMini[[1, 1]] = lambda00;
In[102]:= PXMini[[2, 1]] = lambda00Bis;
In[103]:= {PXMini[[3, 2]], PXMini[[5, 3]], PXMini[[7, 4]]} = {lambda,
lambda, lambda};
In[104]:= {PXMini[[4, 2]], PXMini[[6, 3]],
PXMini[[8, 4]]} = {lambdaBis, lambdaBis, lambdaBis};
In[105]:= PXini[x_] := Sum[PXMini[[x, k]], {k, 1, 8}];
In[106]:= PM[m_] := Sum[PXMini[[k, m]], {k, 1, 8}];
In[107]:= Infoi =
Assuming[lambda00 > 0 && lambda00Bis > 0 && lambda > 0 &&
lambdaBis > 0,
Sum[If[PXMini[[x, m]] != 0,
PXMini[x, m]*Log[PXMini[x, m]/(PXini[x]*PM[m])], 0], {x, 1,
8}, {m, 1, 8}]]
Out[107]=
3 If[lambda != 0, PXMini[x, m] Log[PXMini[x, m]/(PXini[x] PM[m])],
0] + If[lambda00 != 0,
PXMini[x, m] Log[PXMini[x, m]/(PXini[x] PM[m])], 0] +
If[lambda00Bis != 0, PXMini[x, m] Log[PXMini[x, m]/(PXini[x] PM[m])],
0] + 3 If[lambdaBis != 0,
PXMini[x, m] Log[PXMini[x, m]/(PXini[x] PM[m])], 0]
In[]
labels. ConsiderSetOptions[$FrontEnd, ExportMultipleCellsOptions -> {"IncludeCellLabels" -> False}]
, if you want to make it easier for others to help you. $\endgroup$