Group Abstract Group Abstract

Message Boards Message Boards

[?] Use the solution of FindRoot as a integrate limit?

Posted 9 years ago
POSTED BY: Yonggang Luo
3 Replies
POSTED BY: Patrick Scheibe

Here the constants are B=0.00110132, t0=10^6, then you will find the root is larger than 10^6.

Excellent, then your insight is correct and I indeed used the wrong order of arguments.

I want to integrate is much more complicated than 1 so that we don't have an analytical solution

Yes, you can essentially use my exact approach. Since your roots are indeed greater then 10^6, you should set your initial point in root back to 10^6 and you are ready to go:

b = 0.00110132;
t0 = 10^6;

root[gamma_?NumericQ] := 
 Block[{t}, 
  t /. FindRoot[1/21 t^(19/116) (116 b (t^(21/116) - t0^(21/116))) == 1/gamma, {t, 10^6}]
]

NIntegrate[
 gamma^(-2.2) (t0/t)^(57/290) (1 -  gamma*116/21 b*t^(19/116) (t^(21/116) - t0^(21/116)))^(1/5),
 {gamma, 1, 2}, {t, 10^6, root[gamma]}
]

This gives 4.11988*10^6 on my machine.

Btw, please don't use variables (especially one letter variables) that start with a capital letter. You would be surprised how many of them are already used by Mathematica itself and you are likely to run into problems soon:

Select[Names["System`*"], StringMatchQ[#, CharacterRange["A", "Z"]] &]

(* {"C", "D", "E", "I", "K", "N", "O"} *)

Btw #2: If you like to participate more often here, you should lookup how Markdown syntax. It is an easy way to mark code as code (so that it is highlighted as in my post) and includes many more features like bold, italic, headlines, links, images, etc..

POSTED BY: Patrick Scheibe
Posted 9 years ago

Thank you for your explanation!

Here the constants are B=0.00110132, t0=10^6, then you will find the root is larger than 10^6. And let's assume the function I want to integrate is much more complicated than 1 so that we don't have a analytical solution.

If you need the original function, it's

gamma^(-2.2)(t0/t)^(57/290)(1 - gamma116/21Bt^(19/116)(t^(21/116) - t0^(21/116)))^(1/5)

So should I just try your method:

root[gamma_?NumericQ] := Block[{t}, t /. FindRoot[ 1/21 t^(19/116) (116 b (t^(21/116) - t0^(21/116))) == 1/gamma, {t, 10}] ]

so I can get a numerical value returned, then I can do my integrate?

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