TransWikia.com

How to get x value where area under curve is some number?

Mathematica Asked on May 13, 2021

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]

2 Answers

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}}

Correct answer by bill s on May 13, 2021

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 *)

Answered by Bob Hanlon on May 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP