3
$\begingroup$

My goal is to get x value where area under the curve (from the x ~ infinity) is about 0.05. But the code which I have tried shows errors. How to correct it?

Solve[\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(x\), \(\[Infinity]\)]\(
\*FractionBox[\(
\*SuperscriptBox[\(E\), \(\(-x\)/2\)]\ 
\*SuperscriptBox[\(x\), \(3/2\)]\), \(3\ 
\*SqrtBox[\(2\ \[Pi]\)]\)] \[DifferentialD]x\)\) == 0.05, x]
$\endgroup$
0
7
$\begingroup$

Your integral has a closed form solution, so take that and give it a name:

g[x_] := 1/3 E^(-x/2) Sqrt[2/\[Pi]] Sqrt[x] (3 + x) + Erfc[Sqrt[x]/Sqrt[2]]

One way to find the value of x where g[x]==0.05 is to solve:

Minimize[Abs[(g[x] - 0.05)^2] && x \[Element] Reals, x]
{2.92244*10^-18, {x -> 11.0705}}
$\endgroup$
2
  • 2
    $\begingroup$ "Closed-form" is perhaps a generous way of describing the error function. $\endgroup$ – Michael Seifert Apr 18 at 22:44
  • 1
    $\begingroup$ @Michael Seifert -- if you prefer... a solution in terms of well-defined functions! $\endgroup$ – bill s Apr 19 at 3:03
6
$\begingroup$
Clear["Global`*"]

Your integral is the complement of the CDF for a GammaDistribution.

dist = GammaDistribution[5/2, 2];

pdf[x_] = PDF[dist, x]

(* Piecewise[{{x^(3/2)/(E^(x/2)*(3*Sqrt[2*Pi])), x > 0}}, 0] *)

The integral is

int[x_] = Assuming[x > 0, 1 - CDF[dist, x] // Simplify]

(* 1 - GammaRegularized[5/2, 0, x/2] *)

While GammaRegularized can be "simplified" to the result given by bill s

int[x] // FunctionExpand // FullSimplify

(* 1/3 E^(-x/2) Sqrt[2/π] Sqrt[x] (3 + x) + Erfc[Sqrt[x]/Sqrt[2]] *)

It is easier to deal with GammaRegularized and its inverse. The exact solution is

a = x /. Solve[{int[x] == 1/20, x > 0}, x][[1]]

(* 2 InverseGammaRegularized[5/2, 0, 19/20] *)

The approximate numeric value is

a // N

(* 11.0705 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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