Hi!

On 2017-10-14, Santanu Sarkar <[email protected]> wrote:
> In Sage, is it possible to find a such that
>
>  \int_{a}^{\infty} e^(-x^2/2) dx=2^(-20)

Yes.

Probably you want to see how.


First, define a variable `a`. I don't know if one really needs
to declare its domain to solve the problem, but when one does,
the computation works:

  sage: var('a', domain='real')
  a

Compute the integral (which relies on the error function):

  sage: F = (e^(-x^2/2)).integral(x,a,infinity)
  sage: F
  -1/2*sqrt(2)*sqrt(pi)*erf(1/2*sqrt(2)*a) + 1/2*sqrt(2)*sqrt(pi)

Solve for `a`. I want the solution to be given as a list of
dictionaries:

  sage: LD = solve(F==2^(-20), a, solution_dict=True)

The solution is unique and is given in terms of the inverse of
the error function:

  sage: len(LD)
  1
  sage: LD[0][a]
  sqrt(2)*erfinv(-1/1048576*sqrt(2)/sqrt(pi) + 1)

You can evaluate it numerically, and then verify it's correct:

  sage: a_num = RR(LD[0][a]); a_num
  4.94513221771782
  sage: RR((e^(-x^2/2)).integral(x,a_num,infinity)) - 2.^-20
  0.000000000000000

Regards,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to