In a first step, you should always try to get an intuition about what you are trying to calculate. Mathematica can help you, but it cannot replace thinking about your problem. You didn't provide values for your constants b
and t0
, but let me assume they are greater zero. In a first step, you could have created a small manipulate showing the function whose root your are trying to find
Manipulate[
Plot[
1/21 t^(19/116) (116 b (t^(21/116) - t0^(21/116))) - 1/gamma, {t, 0,
10}],
{gamma, 1, 2},
{t0, 0, 10},
{b, 0, 10}
]
When you move the sliders, then you see that as long as both constants are greater zero, you will always have a root at the very beginning. This lets me question your choice of the initial value for FindRoot
which you chose to be 10^6
. I guess with a value of 10, the root can be found fast.
In a next step, you should always ensure that your root-finding indeed returns a numerical value. NIntegrate
will try to evaluate your FindRoot
analytically, which will end badly. Therefore, define a function that ensures it can only be called for numeric values and returns the root you want to use as limit in your integration
root[gamma_?NumericQ] := Block[{t},
t /. FindRoot[
1/21 t^(19/116) (116 b (t^(21/116) - t0^(21/116))) == 1/gamma, {t, 10}]
]
As you see in the plot above, your root will be smaller than 10^6. I'm not sure you really want to integrate from 10^6 to e.g. 2 or the other way around. Let me assume you want it the other way around. If you have no experience with integrals, the easy way, in this case, is to solve it analytically but you leave out your real root
function and replace it with an arbitrary function f
. Then, your result takes the following form
Integrate[1, {gamma, 1, 2}, {t, f[gamma], 10^6}]
$$\int_1^2 (1000000-f(\gamma )) \, d\gamma$$
With integration rules, this simplifies to
$$10^6 - \int_1^2 f(\gamma ) \, d\gamma$$
where the function f
is your root
function. Let's write this down:
10^6 - NIntegrate[root[\[Gamma]], {\[Gamma], 1, 2}]
This gives 999997
. If you like, you can of course use your original call now:
NIntegrate[1, {gamma, 1, 2}, {t, root[gamma], 10^6}]
which gives the same result. Remember that I turned root[gamma]
and 10^6
around! I'm not sure I deciphered exactly what you want but the points I made should help you in any case.