2
$\begingroup$

Lets say I have a function of the form:

$f(T) = T^4 \int_0^{1/T} \frac{x^3 dx}{e^x-1}$

This is an example of the situation I am describing not a unique problem.

I want to define it as a numerical function so I can manipulate it. For example, I might plot it.

Doing the following gets the plot of the function:

int[T_] = NIntegrate[x^3/(Exp[x] - 1), {x, 0, 1/T}];
Plot[T^4*int[T], {T, 0., 1.}]

But my function isn't really a general function. I can't take a derivative of it successfully. Mathematica spits out errors at me because my function definition is flawed somehow.

How do I get a function that I can use in all of the ways numerical functions can be used in Mathematica?

I also would like to generalize this beyond the simple example given.

$\endgroup$
4
  • 2
    $\begingroup$ The Debye function is expressible in terms of built-in functions: debye[t_] := {-t, 3 t^2, -6 t^3, 6 t^4}.PolyLog[Range[4], Exp[1/t]] - (π t)^4/15 - 1/4. $\endgroup$
    – J. M.'s torpor
    Nov 23 '15 at 15:28
  • $\begingroup$ FWIW just using Integrate (w/ Assumptions -> T > 0) gives an analytic result. ( A little different from the above, but I expect equivalent ) $\endgroup$
    – george2079
    Nov 23 '15 at 16:18
  • $\begingroup$ I love that everyone immediately recognized the Debye function. $\endgroup$
    – Paul T.
    Nov 23 '15 at 16:28
  • $\begingroup$ You could use a pure function int = NIntegrate[x^3/(Exp[x] - 1), {x, 0, 1/#}] &, you can calculate it's arbitrary derivative e.g. int''[T] gives $\frac{5}{\left(e^{1/T}-1\right) T^6}-\frac{e^{1/T}}{\left(e^{1/T}-1\right)^2 T^7}$, you can also plot it. $\endgroup$
    – jkuczm
    Nov 26 '15 at 0:57
2
$\begingroup$
Clear[f]

f[t_] = Assuming[{t > 0},
  t^4*Integrate[x^3/(Exp[x] - 1), {x, 0, 1/t}] //
   Simplify]

(*  -(1/4) + I*Pi*t - (Pi^4*t^4)/15 + 
   t*Log[-1 + E^(1/t)] + 3*t^2*PolyLog[2, E^(1/t)] - 
   6*t^3*PolyLog[3, E^(1/t)] + 
   6*t^4*PolyLog[4, E^(1/t)]  *)

tmax = 1.5;
Show[
 Plot[f[t], {t, 0, tmax},
  PlotStyle -> Blue,
  PlotLegends -> LineLegend[{Blue, Red},
    {"f[t]", "f'[t]"}]],
 Plot[f'[t] // Chop, {t, 0, tmax},
  PlotStyle -> Red,
  PlotPoints -> 50],
 ImageSize -> 400,
 PlotRange -> {0, 0.35}]

enter image description here

$\endgroup$
1
$\begingroup$

If $f(T) = T^4\int_0^{1/T} \frac{x^3}{e^x-1}dx$. Then you can differentiate it by parts which gives you

Cv[t_] := -1/(t*(Exp[1/t] - 1)) + (4*t^3*NIntegrate[x^3/(Exp[x] - 1), {x, 0, 1/t}])

Plot[Cv[t], {t, 0, 1}, Frame -> True]

enter image description here

$\endgroup$
1
  • $\begingroup$ Yes I can do work by hand, but I would like to generalize this this beyond the Debye function. So it works for any function defined in terms of an integration bound. $\endgroup$
    – Paul T.
    Nov 23 '15 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.