2
$\begingroup$

How do I get the following into Mathematica, solving for $a$:

$$ 0.7 = 1 - \frac{2}{a} \times \left[ \frac{1}{a} \int_0^a \frac{x}{\exp(x)-1}\mathrm dx + \frac{a}{6} - 1\right] $$

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Verbeia Nov 30 '15 at 6:02
  • 1
    $\begingroup$ In particular, it is helpful to let us know what you have already tried? This site does not provide tutorial services. I would suggest first trying to evaluate Integrate[(x/(Exp[x] - 1)), {x, 0, a}] and see what that answer suggests to you. You can then use NSolve or maybe FindRoot to work out the rest. $\endgroup$ – Verbeia Nov 30 '15 at 6:03
  • $\begingroup$ Thanks Verbeia. Can you tell me what the following won't return the Reals result and gives me back an equation?: 'NSolve[1 - (2/ a)*((1/a)*Integrate[(x/(Exp[x] - 1)), {x, 0, a}] + (a/6) - 1) == 0.7, a, Reals]' $\endgroup$ – Matt Nov 30 '15 at 6:27
14
$\begingroup$

In my experience FindRoot works best for such problems:

In[1]:= fun[a_?NumericQ] := NIntegrate[(x/(Exp[x] - 1)), {x, 0, a}]

In[2]:= FindRoot[1 - (2/a)*((1/a)*fun[a] + (a/6) - 1) == 0.7, {a, 0.1}]

Out[2]= {a -> 58.3073}
$\endgroup$
3
$\begingroup$

One can also use the event detection capability (WhenEvent[]) of NDSolve[] to find the desired root:

(* (Exp[x] - 1)/x; see http://books.google.com/books?id=7J52J4GrsJkC&pg=PA20 *)
exm1x[x_?NumberQ] := With[{t = Exp[x], one = N[1, Precision[x]]}, 
                          Piecewise[{{one, t == 1}}, (t - 1)/Log[t]]]

NDSolveValue[{y'[x] == 1/exm1x[x], y[0] == 0, 
             WhenEvent[7 x^2/10 == x^2 - 2 (y[x] + x^2/6 - x), "StopIntegration",
                       "DetectionMethod" -> Interpolation,
                       "LocationMethod" -> "Brent"]},
             y["Domain"], {x, 0, ∞}, Method -> "Extrapolation",
             AccuracyGoal -> 20, WorkingPrecision -> 20][[1, -1]]
   58.307312765209898828
$\endgroup$
2
$\begingroup$

The integral has an exact representation, so it's possible to use several methods.

fun[a_] = Integrate[(x/(Exp[x] - 1)), {x, 0, a}, Assumptions -> a > 0]
(*  -(a^2/2) + I a π - π^2/6 + a Log[-1 + E^a] + PolyLog[2, E^a]  *)

FindRoot[1 - (2/a)*((1/a)*fun[a] + (a/6) - 1) == 7/10, {a, 1}, 
 WorkingPrecision -> 20]
(*  {a -> 58.307312765239769644}  *)

NSolve[1 - (2/a)*((1/a)*fun[a] + (a/6) - 1) == 7/10 && 50 < a < 60, a,
  WorkingPrecision -> 20]
(*  {{a -> 58.307312765239769644}}  *)

Of course, to use NSolve you need to give it a compact domain, so one needs some knowledge of where the root is.

Or if you want an exact representation,

sol = Root[{
  1 - (2/a)*((1/a)*fun[a] + (a/6) - 1) == 7/10 /. 
     Equal -> Subtract /. a -> # // Function[bdy, bdy &],
  a /. FindRoot[1 - (2/a)*((1/a)*fun[a] + (a/6) - 1) == 7/10, {a, 1}, 
    WorkingPrecision -> 20]
  }]

Mathematica graphics

N[sol, 50]
(*  58.307312765239769643612756575305892317507739080842 + 0.*10^-49 I  *)
$\endgroup$
  • $\begingroup$ I'm seeing a number of questions involving Debye-like functions lately. I wonder why... $\endgroup$ – J. M. will be back soon Feb 18 '16 at 3:11
  • $\begingroup$ @J.M. I have no idea. This is a somewhat older question, though. $\endgroup$ – Michael E2 Feb 18 '16 at 3:25

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.