2
$\begingroup$

I have this function:

Emax[T_, d_] := -(1/2) + d + d/(-1 + E^(d/T)) - 1/2 Coth[1/(2 T)];

All I want is to transform this Function so I get:

T[Emax_, d_] := .....

I just want to be able to put in Emax and d value and get the correspoding T. If tried doing tables and stuff but it doesn't work as I would want it to:/

Thanks in advance

$\endgroup$
4
  • 1
    $\begingroup$ Mathematica can't invert that equation exactly. Is an approximation acceptable? around which values? (I assume you mean Exp[(d/T)]) $\endgroup$
    – rhermans
    Aug 21, 2018 at 13:32
  • $\begingroup$ Exact solutions, if they exist, can be found for specific values using constructs like t /. Solve[1 == Emax[t, 7/3], t, Reals]. Also, you probably want to replace e with E. You can also find equation solutions for specific values of d: InverseFunction[Emax[#, 2] &] $\endgroup$
    – kirma
    Aug 21, 2018 at 13:49
  • $\begingroup$ @rhermans Hm, I guess an approximation would be a good start. $\endgroup$ Aug 21, 2018 at 13:52
  • $\begingroup$ @kirma Ok, I'll try that out and report back. Thanks $\endgroup$ Aug 21, 2018 at 13:52

2 Answers 2

1
$\begingroup$

The numerical function T[em,d]:

solT[em_?NumericQ, d_?NumericQ] := T /. NMinimize[{1, 
{T > 0,em == -(1/2) + d + d/(-1 + Exp[d/T]) - 1/2 Coth[1/(2 T)]}},T][[2]]

solT[3, 2]
(*0.0259196*)
$\endgroup$
7
  • $\begingroup$ This worked very nice! Thanks, I'm finally making some progress. But I ran into a few issues :/ 1. Numerical solutions are not continous. It's possible that for certain combinations of em and d there will be no value for T which would cause the programm to crash. Ideas ? 2. The thing is I am trying to use this function in a plot in which I continously can change values of em and d. This causes massive lag. For single values it's fine though. 3. Would it be rather possible to get a simpler/continous approximation for the value of T? $\endgroup$ Aug 21, 2018 at 14:51
  • $\begingroup$ And last but not least: I was trying to use certain values for solT solT[List[a,b,c][[2]], d] For d it worked fine in the plot since d is one of the dynamical variables I can change. But apparently taking one certain entry from List which looks sth. like this: {10,7,5,6,3} and what I did with List[[2]] was to single the value 7 out, has the wrong format or something. Either way I connot use it for solT[List[[2]],d] to get vaules. Any ideas how to change the format ? Thanks $\endgroup$ Aug 21, 2018 at 14:56
  • $\begingroup$ solT[{0.1, .5, .62}[[3]], 2] works! So your second question seems to be an issue of Dynamic variables? $\endgroup$ Aug 21, 2018 at 15:23
  • $\begingroup$ Your first question: If you plot Emax[d,T] let's say in the range 0<T<5 for d=Range[ 1,3,.1}you get the region of admissable parametervalues. In this region the solution T exists and the numerical function solT will find T! $\endgroup$ Aug 21, 2018 at 15:27
  • $\begingroup$ Hm I see, then yes it must be a problem with the Dynamical Variable. You see all I want is to use the solT[em,d] Value is in a plot as Limit for the manipulate variable T. So in a Sense I want Manipulate[ListPlot[MinVar[T, R, d], {T, 1,solT[em, d]}, {R, 10, 20},{d,10,20}] Now d is easy because it is also a manipulate variable. But for em I need a value from another dynamical List that is changing constantly as I change the manipulate variables. $\endgroup$ Aug 22, 2018 at 10:29
1
$\begingroup$

Here is one approach:

einv = InverseFunction[-(1/2) + d + d/(-1 + E^(d/#)) - 1/2 Coth[1/(2 #)] &]

To use this, you need to specify a value of d, for example:

N[einv[5] /. d -> 5]
N[einv[0] /. d -> 1]

To plot, you can do something like:

e2[dval_] = Abs[N[einv[0] /. d -> dval]];
ListPlot[e2[#] & /@ Range[1, 10, 0.1]]

enter image description here

Of course, you can also change the "0" to a range of values.

$\endgroup$
2
  • 1
    $\begingroup$ Thanks but the thing is I need this thing to be dynamic :/ I am using a manipulate[Plot[...] {d,1,10},{Emax,1,10}] where I change d or Emax constanantly. That's why I want a function for T, to get constantly a new T which corresponds to any d or Emax I currently have. Understand what I mean? $\endgroup$ Aug 21, 2018 at 13:56
  • $\begingroup$ Your question explicitly states: "I just want to be able to put in Emax and d value and get the correspoding T." $\endgroup$
    – bill s
    Aug 21, 2018 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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