import numpy as np from scipy.integrate import quad import matplotlib.pyplot as plt f = lambda x: np.sin(x**2) A = [] x = np.arange(0.01, 10, 0.01) for i in x: res = quad(f, 0, i) A.append(res[0]) print(sum(A)) plt.plot(x[:600], A[:600],label="Fresnel Integral Si(x)") plt.grid() plt.legend() plt.show() print("From the plot, we find that the solution slowly converges to 0.5")
Comments
Post a Comment