# Using NSolve with an interporlated function

I have defined the interpolation function below

T = {10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1, 0.5,
0.215, 0.213, 0.2, 0.19, 0.180, 0.171, 0.169, 0.160, 0.151, 0.149,
0.140, 0.130, 0.100, 0.050, 0.020, 0.010, 0.005, 0.002, 0.001,
0.0005, 0.0002, 0.0001, 0.00005, 0.00002, 0.00001};
ge = {106.75,
106.75, 106.74, 106.72, 106.61, 105.90, 103.53, 97.40, 88.45, 86.22,
85.60, 82.50, 76.34, 69.26, 62.49, 62.49, 50.75, 44.01, 38.27,
33.47, 33.47, 29.51, 26.31, 26.32, 23.77, 21.76, 18.00, 14.63,
11.33, 10.76, 10.74, 10.71, 10.60, 10.16, 7.66, 4.46, 3.39, 3.36,
3.36};

gstarELogLog = Interpolation[LogLog /@ Transpose[{T, ge}],InterpolationOrder -> 1] // Quiet;
gstarE[T_] := Exp[gstarELogLog[Log[T]]] // Quiet;


I can't seem to use it to do anything useful in NSolve, the simplest example being

NSolve[gstarE[Tpt] == 10, Tpt]


EDIT: it was pointed out that the above is a bad example. consider instead

NSolve[gstarE[Tpt]Tpt == 10, Tpt]


I get the following output

• geisn't defined! – Ulrich Neumann Mar 30 at 11:12
• it was, but now it's on its own line so should be clearer. Apologies – Rudyard Mar 30 at 11:14

Mathematica doesn't know LogLogas function. Try

gstarELogLog =Interpolation[Map[Log, Transpose[{T, ge}]], InterpolationOrder -> 1]
gstarE[T_] := Exp[gstarELogLog[Log[T]]] // Quiet;


The equation gstarE[Tpt] == 10 has no real positive solution,because gstarE[Tpt]>10 .

FindRoot[gstarE[Tpt] == 12 , {Tpt,  1/10, 10^-5  , 1} ]

FindRoot[Tpt gstarE[Tpt] == 10 , {Tpt,  1/10, 10^-5  , 1} ]

• Try FindRoot[Tpt gstarE[Tpt] == 10 , {Tpt, 1/10, 10^-5 , 1} ] (*{Tpt -> 0.199213}*) – Ulrich Neumann Mar 30 at 12:31