How to combine integration equation in Python?

  • Context: Python 
  • Thread starter Thread starter Nur Ziadah
  • Start date Start date
  • Tags Tags
    Integration Python
Click For Summary
SUMMARY

The discussion focuses on calculating the key rate (R^Rate-wise) by integrating the function R(eta) over the interval from 0 to 1, using a log-normal probability distribution (PDTC). The integration is performed using Python, specifically leveraging the SciPy library for numerical integration. The user provides Python code snippets for both the log-normal distribution and the R(eta) function, seeking guidance on how to effectively integrate R(eta) across the specified range. The integration output is intended to be visualized in a plot representing R^Rate-wise.

PREREQUISITES
  • Understanding of log-normal distribution and its properties
  • Familiarity with Python programming, particularly with NumPy and Matplotlib
  • Knowledge of numerical integration techniques in Python using SciPy
  • Basic concepts of quantum key distribution and QBER (Quantum Bit Error Rate)
NEXT STEPS
  • Learn how to implement numerical integration using SciPy's integrate.quad function
  • Explore advanced plotting techniques in Matplotlib for better data visualization
  • Study the mathematical foundations of log-normal distributions and their applications in statistics
  • Investigate the implications of QBER on quantum key distribution protocols
USEFUL FOR

Researchers, data scientists, and developers working on quantum key distribution, as well as anyone interested in numerical methods for integrating complex functions in Python.

Nur Ziadah
Messages
34
Reaction score
3
TL;DR
I'm calculating key rate (R^Rate-wise) by integrating R(eta) over all possible eta from 0 to 1, with a probability distribution (PDTC) which is a log-normal distribution using Python language.
I'm calculating key rate (R^Rate-wise) by integrating R(eta) over all possible eta from 0 to 1, with a probability distribution (PDTC) which is a log-normal distribution.

The equation of log-normal distribution:
243810


The equation of R(eta):
243811


Therefore, R^Rate-wise = Integrate_0^1(R(eta)*P(eta)*d eta):
243812


This is Python code of log-normal distribution:
Python:
x=np.linspace(0,1,1000)
sigma0=[0.9]
color=['green']
for i in range(len(sigma0)):
    sigma=sigma0[i]
    y=1/(x*sigma*np.sqrt(2*np.pi))*np.exp(-(np.log(x/0.3)+(1/2*sigma*sigma))**2/(2*sigma*sigma))
    plt.plot(x,y,color[i])
plt.title('Lognormal distribution')
plt.xlabel('x')
plt.ylabel('lognormal density distribution')
#plt.xlim((0,0.002))
plt.ylim((0,5))
plt.show()

This is Python code of R(eta):
Python:
n1=np.arange(10, 55, 1)
n=10**(-n1/10)Y0=1*(10**-5)
nd=0.25
ed=0.03
nsys=nd*n
QBER=((1/2*Y0)+(ed*nsys))/(Y0+nsys)
H2=-QBER*np.log2(QBER)-(1-QBER)*np.log2(1-QBER)
Rsp=np.log10((Y0+nsys)*(1-(2*H2)))
print (Rsp)

plt.plot(n1,Rsp)
plt.xlabel('Loss (dB)')
plt.ylabel('log10(Rate)')
plt.show()

My question is how to integrate R(eta) over possible eta from 0 to 1? The output should be in the following figure (R^Rate-wise):

243813


The referred article can be find in this link: https://arxiv.org/pdf/1712.08949.pdf

Thank you so much.
 
Technology news on Phys.org
I usually use the https://docs.scipy.org/doc/scipy/reference/tutorial/integrate.html to do numerical integration in Python. You will need to define a function which defines the integrand.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 21 ·
Replies
21
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
6K
Replies
4
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K