Numerical integration and plotting

New to Mathematica, and trying to numerically evaluate two integrals:

g[x_] := (x + 1) Log[x + 1] - x Log[x];
C = NIntegrate[g[1/(Exp[1/x] - 1)], {x, 0, a}];
P = NIntegrate[1/(x (Exp[1/x] - 1)), {x, 0, a}];

and plot C as a function P, if possible. Kindly help.

• C is defined by Mathematica, look in the documentation. This works points=Table[{c=NIntegrate[g[1/(Exp[1/x]-1)], {x,0,a}], p=NIntegrate[1/(x (Exp[1/x]-1)), {x,0,a}]}, {a,0,1,.01}]; ListPlot[points, Joined->True] but gives some errors that you might be able to figure out. Otherwise NIntegrate demands every variable have been given some value first. – Bill Mar 17 '15 at 22:38
• By saying “plot C as a function P”, do you mean you want to use P as the independent variable of C? – xzczd Mar 18 '15 at 7:30

According to your definition we have

g[x_] := (x + 1) Log[x + 1] - x Log[x]

The two functions performing the numerical integration are

fC[a_] := NIntegrate[g[1/(Exp[1/x] - 1)], {x, 0, a}]
fP[a_] := NIntegrate[1/(x/(Exp[1/x] - 1)), {x, 0, a}]

Remarks

1) variable names must begin with a lower case letter, hence I have written fC and fP instead of C and P, respectively.
2) delayed assignment (:=) is requested and the upper integration limit must appear as an argument of the function.

Now you could plot both functions, for instance like this

Plot[{fC[a], fP[a]}, {a, 0, 5}]
(* picture not shown here *)
• I think you mistyped the definition of fP? – xzczd Mar 18 '15 at 7:34
• @xzczd: Yes, I did. Thanks for pointing it out. I've corrected it. – Dr. Wolfgang Hintze Mar 18 '15 at 8:29
• The OP wants to plot fC as a function fP, maybe like ParametricPlot[{fC[a],fP[a]},{a,0,5}]? – egwene sedai Mar 18 '15 at 16:20
• Yes, ParametricPlot.The resulting curve is almost a straigt line. – Dr. Wolfgang Hintze Mar 18 '15 at 22:22