I'm trying to find the maximum entropy distribution as such:
Assuming[Element[l, Reals],
NSolve[Sum[Exp[l i] i/Sum[Exp[l j], {j, 0, 100}], {i, 0, 100}] == 50,l]]
but I then get answers such as
{l -> ConditionalExpression[
1. ((-1.11022*10^-16 - 0.652623 I) + (0. + 6.28319 I) C[1]),
C[1] \[Element] Integers]}
which seem to be either identically zero or complex, which is not what I'm looking for.
Q1: What's happening and how can I get only the (real) answer I want, i.e., the that maximizes the entropy?
Also, I'd like to solve for sums involving for instance 3000 terms, but the kernel keeps crashing due to low memory.
Q2: What are some better, standard methods for finding maximum entropy distributions numerically in Mathematica?
Thanks!