2
$\begingroup$

So there is this equation that I have to numerically solve for T:

Q/(3nRT) = f(T/300) - f(T/77)

Here Q = 920.364, n = 0.24, R = 8.314 while f is defined as the following:

f[t_?NumericQ]:= (3/t^4)*NIntegrate[(y^3)/(E^y -1),{y,0,t}]

I'm trying to do the following based on this, (Edited f2 here; initially was f[T/77]-f[T/300])

Block[{f1,f2,T,sol},
f1:= Q/(3nRT);
f2:= f[T/300]-f[T/77];
sol=N@Reduce[f1==f2,T]]

This is just giving errors:

Reduce::inex: Reduce was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Reduce require exact input, providing Reduce with an exact version of the system may help. >>

and I'm unable to solve for T. Please help! Is there any elegant method of doing this?

$\endgroup$
3
$\begingroup$
Q = 920.364;
n = 0.24;
R = 8.314;
f[t_?NumericQ] := 3/t^4*NIntegrate[y^3/(Exp[y] - 1), {y, 0, t}]

Plot[Evaluate[{Q/(3 n R T), f[T/77] - f[T/300]}], {T, 0, 10000}, 
 PlotLegends -> {"Q/(3n R T)", "f[T/77]-f[T/300]"}]

enter image description here

There are no crossings. Your equation has not a real solution.

Edit with the new condition.

Plot[Evaluate[{Q/(3 n R T), -f[T/77] + f[T/300]}], {T, 0, 2000}, 
 PlotLegends -> {"Q/(3n R T)", "-f[T/77]+f[T/300]"}]

enter image description here

eq = Q/(3 n R T) == -f[T/77] + f[T/300];
FindRoot[eq, {T, 500}]
(* {T -> 470.293} *)

It looks much better now!

| improve this answer | |
$\endgroup$
  • $\begingroup$ Oops that should be f[T/300]-f[T/77]. $\endgroup$ – Sunil S. Feb 28 '16 at 17:02
  • 1
    $\begingroup$ @Sunil S. Now the solution is fine. $\endgroup$ – user36273 Feb 28 '16 at 17:57
1
$\begingroup$

As indicated by rewi there is no solution.

Despite that I think it is beneficial to attack problems of this nature by evaluating the integral up front and then using it in downstream processing.

In other words, get rid of NIntegrate if possible.

For your example replace NIntegrate with Integrate and see if there is a symbolic result.

Integrate[(t^3)/(E^t - 1), t]

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

Now evaluate that at t=0. In order to do that one has use Limit to avoid an indeterminate expression.

Limit[-(t^4/4) + t^3 Log[1 - E^t] + 3 t^2 PolyLog[2, E^t] - 
  6 t PolyLog[3, E^t] + 6 PolyLog[4, E^t], t -> 0]

(* π^4/15 *)

Now f[t_] can be defined as (side note, avoid capitol letters, T so as to not conflict with predefined Mathematica symbols).

f[t_] := (3/t^4)*(-(t^4/4) + t^3 Log[1 - E^t] + 
    3 t^2 PolyLog[2, E^t] - 6 t PolyLog[3, E^t] + 
    6 PolyLog[4, E^t] - π^4/15)

and use this in your analysis.

| improve this answer | |
$\endgroup$

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.