Integration using quad.

asked 2022-02-10 13:48:58 +0200

Sanu gravatar image

updated 2022-02-10 14:09:06 +0200

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)
edit retag flag offensive close merge delete

Comments

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

tmonteil gravatar imagetmonteil ( 2022-02-10 14:09:32 +0200 )edit

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

Sanu gravatar imageSanu ( 2022-02-10 15:37:56 +0200 )edit
1

Suggestions:

  • Use SageMath 9.5
  • Use Arb for numerical integration
slelievre gravatar imageslelievre ( 2022-02-10 20:50:06 +0200 )edit