Quantcast
Channel: Active questions tagged real-analysis - Mathematics Stack Exchange
Viewing all articles
Browse latest Browse all 8476

Issue in numerical integration of $\frac{1}{4\pi^{3/2}i}\int_Ce^{-\frac{z^3}{12}-tz}z^{-1/2}dz$

$
0
0

I am trying to numerically integrate the integral representation of $\operatorname{Ai}^2(x)$. The representation is

$$\operatorname{Ai}^2(t)=\frac{1}{4\pi^{3/2}i}\int_Ce^{-\frac{z^3}{12}-tz}z^{-1/2}dz.$$

Where the contour $C$ has upper portion $y_1(x)=\sqrt{3}\sqrt{x^2-4}$ and lower portion $y_2(x)=-\sqrt{3}\sqrt{x^2-4}$ where $x\in[2,\infty)$.

enter image description here

Since most of the integral is concentrated near the origin as, I can take the domain $x\in[2,10]$. Then I chop up the domain into $n$ bins.

$$\operatorname{Ai}^2(t)=\frac{1}{4\pi^{3/2}i}\int_Ce^{-\frac{z^3}{12}-tz}z^{-1/2}dz\approx\sum_{i=0}^n f((2+i\Delta x,y_i(2+i\Delta x)), t)\Delta y$$

where $f(z,t)=\frac{1}{4\pi^{3/2}i}e^{-\frac{z^3}{12}-tz}z^{-1/2}$. However, when I do this, the answer does not agree with the correct solution. Where have I gone wrong?

import mathimport numpy as npfrom matplotlib import pyplot as pltfrom scipy import specialimport numpy as npdef y1(x):  return np.sqrt(3)*np.sqrt(x**2-4)def y2(x):  return -np.sqrt(3)*np.sqrt(x**2-4)def f(z,t):  return 1/(4*math.pi**(3/2)*(1j))*np.exp((z**3)/12-t*z)*(z**(-1/2))def integral(t):  bins= 1000    # Upper contour  x=np.linspace(2,10,bins)  output = 0  for i in range(1, len(x)):    dy = (y1(x[i])-y1(x[i-1]))    output += f(complex(x[i],y1(x[i])),t)*dy  # Lower contour  for i in range(1, len(x))[::-1]:    dy = (y2(x[i])-y2(x[i-1]))    output += f(complex(x[i],y2(x[i])),t)*dy  return outputt=np.linspace(-4,4,100)# Numerical Answer plt.plot(t, [integral(index) for index in t])# Actual answerplt.plot(t, [special.airy(index)[0]**2 for index in t])plt.ylim(-1, 2)

Here is a publicly editable co-lab notebook with the running code

https://colab.research.google.com/drive/1PuibieIHpKKSbscHwZB0Gv9It9HcpfpF?usp=sharing

enter image description here


Viewing all articles
Browse latest Browse all 8476

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>