Integration using quad.

asked 3 years ago

Sanu gravatar image

updated 3 years ago

tmonteil gravatar image

In my understanding, I is the integration of normal distribution from -infinity to 2^50. The value should be 1. But it is giving 0. I need very good precision say up to 50 decimal places.

p=0.578
q=1-p
a=p*2^(24)

b=p*q*2^(24)
b=sqrt(b)
T=2^50

F = lambda x: 1/(sqrt(2*pi)*b)*e^(-(x-a)^2/(2*b*b))
I=quad(F, [-inf,T])
I=round(I,1000)

print(I)
Preview: (hide)

Comments

How is quad defined ? What is inf ? Are you using Sage ?

tmonteil gravatar imagetmonteil ( 3 years ago )

I used " from mpmath import *" and "import time". It is running. My Sage version is 8.2

Sanu gravatar imageSanu ( 3 years ago )
1

Suggestions:

  • Use SageMath 9.5
  • Use Arb for numerical integration
slelievre gravatar imageslelievre ( 3 years ago )