Message Boards Message Boards

Define a solution of equation as the integration limit?

Posted 6 years ago

In order to explain my question, I use a trivial function for this discussion.

Say I define a function as:

limit[tt_, gamma_] := FindRoot[(tt)^(1/2) (-250*((tt)^(-3/2) - t^(-3/2)) + 1/(10^3*t^(1/2))) == 1/gamma, {t, 10^5}][[1]][[2]];

Apparently, this function cannot be written explicitly. Then I want to do a integration as follow:

NIntegrate[gamma*tprime, {gamma, 10, 100}, {tprime, limit[107810, gamma], limit[110000, gamma]}];

Firstly, I do integral over tprime, but integral is function limit[tt,gamma] instead of some constant as normal. After first integral, we should get a function of gamma. Then we do integral over gamma, we should get a number. But when I run this code, the result is follow:

FindRoot::nlnum: The function value {0.00103905 -1./gamma} is not a list of numbers with dimensions {1} at {t} = {100000.}.

FindRoot::nlnum: The function value {0.00104974 -1./gamma} is not a list of numbers with dimensions {1} at {t} = {100000.}.

FindRoot::nlnum: The function value {0.00103905 -1./gamma} is not a list of numbers with dimensions {1} at {t} = {100000.}.

General::stop: Further output of FindRoot::nlnum will be suppressed during this calculation.

I don't know what's wrong in my code. Does anyone have any idea? What should I do to achieve my calculation? Thank you!

POSTED BY: Yonggang Luo

I think FindRoot is not the right option in your case.

limit[tt_, gamma_] := 
  Solve[((tt)^(1/2) (-250*((tt)^(-3/2) - t^(-3/2)) + 
        1/(10^3*t^(1/2))) == 1/gamma), {t}];

And then

NIntegrate[
 gamma*tprime, {gamma, 10, 100}, {tprime, 
  First[t /. limit[107810, gamma]], First[t /. limit[110000, gamma]]}]

gives: 4.48302*10^10.

POSTED BY: Claude Mante
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract