0
$\begingroup$

I have this function $R(r)$, and $r*R^2$ is a probability density function.

R[n_, l_, r_] := 
  Sqrt[(n - l - 1)!/(2*n*((l + 1)!)^3)]*(2/(n*a))^(l + 1/2)*
   D[LaguerreL[n + l, (2*r)/(n*a)], {r, 2*l + 1}]*r^l*Exp[-r/(n*a)]

I am basically trying to find the value of $s$ such that the integral of the function $R(r)$ as $r$ goes from $0$ to $s$ is $95\%$ probability.

In the function below, I need the argmin $s$ such that the integral value is at least $0.95$. Solve didn't work for an exact number. How do I set it up to solve for "at least" 0.95?

Solve[Integrate[(r*R[1, 0, r])^2, {r, 0, s}] == 0.95, s]
$\endgroup$
0

1 Answer 1

1
$\begingroup$
Integrate[(r*R[1, 0, r])^2, {r, 0, s}] /. s -> σ*a // FullSimplify
(*    1 + E^(-2σ) (-1 - 2σ (1 + σ))    *)

FindRoot[% == 0.95, {σ, 3}]
(*    {σ -> 3.1479}    *)

In one line:

FindRoot[Integrate[(r*R[1, 0, r])^2, {r, 0, σ*a}] == 0.95, {σ, 3}]
(*    {σ -> 3.1479}    *)
$\endgroup$
4
  • $\begingroup$ Or as analytical Root expression: Solve[Integrate[(r*R[1, 0, r])^2, {r, 0, \[Sigma]*a}] == 95/100, \[Sigma], Reals] yields {{\[Sigma] -> Root[{-20 + E^(2 #1) - 40 #1 - 40 #1^2 &, 3.14789681093599487090}]}} $\endgroup$
    – Akku14
    Commented Sep 6, 2021 at 17:20
  • $\begingroup$ @Akku14 isn't the Root object just a camouflaged FindRoot in practice? $\endgroup$
    – Roman
    Commented Sep 6, 2021 at 19:34
  • $\begingroup$ It's great. Did we just get lucky that the acanceled in that expression? Would it not have worked if a did not cancel? $\endgroup$
    – Frank
    Commented Sep 9, 2021 at 15:46
  • 1
    $\begingroup$ @Frank It's not a coincidence that $a$ cancelled. The integrand looks like a radial quantum wave function ($R$ is the radial wave function and $r^2$ the Jacobian) and $a$ is its length scale. So by dimensional analysis the result must be a multiple of $a$. $\endgroup$
    – Roman
    Commented Sep 9, 2021 at 17:23

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.