# Revision history [back]

This isn't an answer, but apparently the problem isn't Maxima per se. After the requisite assumptions, I have

(%i5) integrate(-q*log(q),x,minf,inf);
2
2              (x - mu)
(x - mu)             - ---------
inf    - ---------                     2
/                2               2 sigma
[         2 sigma            %e
I     %e            log(-----------------------) dx
]                       sqrt(2) sqrt(%pi) sigma
/
minf
(%o5)        - ---------------------------------------------------
sqrt(2) sqrt(%pi) sigma
(%i6)


which shouldn't cause an overflow.

This isn't an answer, but apparently the problem isn't Maxima per se. After the requisite assumptions, I have (in Sage's native Maxima):

sage: maxima_console()
<snip>
(%i1) q:1/((2*%pi)^(1/2)*sigma)*exp(-(x - mu)^2/(2*sigma^2));
2
(x - mu)
- ---------
2
2 sigma
%e
(%o1)                       -----------------------
sqrt(2) sqrt(%pi) sigma
(%i2) assume(sigma>0);
(%o2)                             [sigma > 0]
(%i3) assume(mu>0);
(%o3)                              [mu > 0]
(%i4) integrate(q,x,minf,inf);
(%o4)                                  1

(%i5) integrate(-q*log(q),x,minf,inf);
2
2              (x - mu)
(x - mu)             - ---------
inf    - ---------                     2
/                2               2 sigma
[         2 sigma            %e
I     %e            log(-----------------------) dx
]                       sqrt(2) sqrt(%pi) sigma
/
minf
(%o5)        - ---------------------------------------------------
sqrt(2) sqrt(%pi) sigma
(%i6)


which shouldn't cause an overflow.

This isn't an answer, but apparently the problem isn't Maxima per se. (Recall that Maxima is the normal integration engine within Sage.) After the requisite assumptions, I have (in Sage's native Maxima):

sage: maxima_console()
<snip>
(%i1) q:1/((2*%pi)^(1/2)*sigma)*exp(-(x - mu)^2/(2*sigma^2));
2
(x - mu)
- ---------
2
2 sigma
%e
(%o1)                       -----------------------
sqrt(2) sqrt(%pi) sigma
(%i2) assume(sigma>0);
(%o2)                             [sigma > 0]
(%i3) assume(mu>0);
(%o3)                              [mu > 0]
(%i4) integrate(q,x,minf,inf);
(%o4)                                  1

(%i5) integrate(-q*log(q),x,minf,inf);
2
2              (x - mu)
(x - mu)             - ---------
inf    - ---------                     2
/                2               2 sigma
[         2 sigma            %e
I     %e            log(-----------------------) dx
]                       sqrt(2) sqrt(%pi) sigma
/
minf
(%o5)        - ---------------------------------------------------
sqrt(2) sqrt(%pi) sigma
(%i6)


which shouldn't cause an overflow.overflow. See the other answer for more details on how to simplify this.

(In the notebook, one can choose "Maxima" from the combo box of systems, or put %maxima at the beginning of a cell, and then just put the input commands above in that cell to evaluate this.)