2
$\begingroup$

I am trying to calculate the following definite integral with the parameter H. So my result would like to be a analytical one with the parameter H. For example for the integral NIntegrate[ax, {x, 1, 2}] the result would be a*1.5 for a≠0

My integral:

NIntegrate[(w*Sqrt[((w^2) - 1)])/((1 + Exp[6*(w - 1) - H])*
 (Pi^2)*(3.8615926796 * (10^(-13))^3)) , {w, 1, \[Infinity]}]

I also tried the assumptions function but it doesn't work for definite integrals? Do you have a suggestion on how to solve it?

$\endgroup$
5
  • $\begingroup$ The problem that Mathematica is having with this integral is the following: you have left $H$ to be completely arbitrary, but NIntegrate does not work like that. You have to specify all parameters in order to get the result. Also, what is the parameter $H$? Is it integer? Positive? $\endgroup$
    – bmf
    Apr 24 at 6:31
  • $\begingroup$ as a rule of thumb, 1/ replace NIntegrate by NIntegrate1 and look at the integrant $\endgroup$
    – chris
    Apr 24 at 6:40
  • 2
    $\begingroup$ NIntegrate can not deal with symbolic parameters. On the other hand, many integrals have no analytic solution. What you can do ist to calculate the integral numerically for different values of H and interpolate the results. $\endgroup$ Apr 24 at 7:40
  • $\begingroup$ To provide the full context, I need the integral to equal a known value. For instance, let's consider n_e=NIntegrate1[(w*Sqrt[((w^2) - 1)])/((1 + Exp[6*(w - 1) - H])*(Pi^2)*(3.8615926796 * (10^(-13))^3)) , {w, 1, [Infinity]}, Assumptions -> H > 0], where n_e​ is known. Therefore, what I aim to determine is the value of H, a positive parameter. Also when I use the indefinite integral there is no result. $\endgroup$ Apr 24 at 8:41
  • $\begingroup$ Thank you everyone for your help. I really appreciate it! $\endgroup$ Apr 25 at 7:25

2 Answers 2

4
$\begingroup$

What you have posed is an example of an XY problem. In this case, the problem you actually want to solve has a straightforward approach. First turn the parametrized numeric integral into a "black box" function, that only evaluates when given a numeric input.

numIntegrate[h_?NumericQ] := NIntegrate[(w*Sqrt[((w^2) - 1)])/
  ((1 + Exp[6*(w - 1) - h])*(Pi^2)*(3.8615926796*(10^(-13))^3)),
  {w,1,Infinity}]

Now use a simple root-finder to solve for the integral being equal to 3.

rt = FindRoot[numIntegrate[h] == 3, {h, 1}]

(* Out[49]= {h -> -82.888} *)

Check the result.

NIntegrate[(w*Sqrt[((w^2) - 1)])/
  ((1 + Exp[6*(w - 1) - (h/.rt)])*(Pi^2)*(3.8615926796*(10^(-13))^3)), 
  w, 1, Infinity}]

(* Out[50]= 3. *)
$\endgroup$
3
$\begingroup$

All comments you obtained are correct. However, there is a workaround. Let us assume that what you call n_e (in Mathematical this notation is illegal) is 0.3*10^-38. I would act as follows. 1 step: let us make a table of the values of this integral at various H:

 lst = Table[{H, 
    NIntegrate[(w Sqrt[-1 + w^2])/(
     1 + E^(-H + 6 (-1 + w))), {w, 1, \[Infinity]}]}, {H, 0, 1, 
    0.1}] /. {x_, y_} -> {x, 2.624*^-37*y}

(* {{0., 2.36305*10^-38}, {0.1, 2.56271*10^-38}, {0.2, 
  2.77603*10^-38}, {0.3, 3.00354*10^-38}, {0.4, 3.24578*10^-38}, {0.5,
   3.50325*10^-38}, {0.6, 3.77646*10^-38}, {0.7, 
  4.06587*10^-38}, {0.8, 4.37194*10^-38}, {0.9, 4.69511*10^-38}, {1., 
  5.03579*10^-38}} *)

Please note that I intentionally removed the figure 2.62382*10^37 from under the integral, and multiplied by it the result of integration. 2 step: Let us fit the obtained list:

 model = 0.09*2.624*^-37 + k1*H + k2*H^2;
ff = FindFit[lst, model, {k1, k2}, H]
Show[{
  ListPlot[lst, PlotStyle -> Blue],
  Plot[model /. ff, {H, 0, 1}, PlotStyle -> Red]
  }]

(* {k1 -> 1.89899*10^-38, k2 -> 7.71397*10^-39} *)

enter image description here

3 step: Now one can find the solution

NSolve[(model /. ff) == 3*10^-38, H]

(* {{H -> -2.76145}, {H -> 0.299694}} *)

You only need a positive result.

Have fun!

$\endgroup$

Your Answer

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

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