Dual integration calculation
-
I need to figure out a double integration with dblquad.
I'm fighting like this: IntegrationWarning: The maximum number of subdivisions (50) has been achieved. If increasing the limit yields no improvement it is advised to analyze the integrand in order to determine the difficulties. If the position of a local difficulty can be determined (singularity, discontinuity) one will probably gain from splitting up the interval and calling the integrator on the subranges. Perhaps a special-purpose integrator should be used.
I have pix[i,j][0] a mass of piccell values. n[i] = a mass of 1 to 600 m[j] = 1 to 462
C = [[0] * width for i in range(height)] for i in range(len(n)): for j in range(len(m)): C[i][j] = dblquad(lambda x, y: pix[i, j][0] * math.sin(math.pi*x*n[i]/width)*math.sin(math.pi*y*m[j]/height)*math.sin(math.pi*x*n[i]/width)*math.sin(math.pi*y*m[j]/height), 0, height, lambda x: 0, lambda x: width)
I'm just trying to run different ways of eliminating artifacts in the image. I thought I'd try to sinus and cosines.
-
At high sinusoid frequencies, sinusoid is highly absorbed, so the adaptive algorithm of the 50-heat interval is not matched.
Baseline https://github.com/scipy/scipy/blob/v1.7.1/scipy/integrate/quadpack.py#L530-L602 shows that this function within itself causes https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.nquad.html#scipy.integrate.nquad ♪ In your case, the challenge is reduced.
nquad(ваша_функция, [[0,width], [0,height]], opts={"epsabs": 1.49e-8, "epsrel": 1.49e-8})
The number of iterations is controlled by the option
limit
♪ Add the parameter.opts
Couple."limit": 100
or any other number.But in fact, I would recommend that you learn.
numpy
Furje https://numpy.org/doc/stable/reference/generated/numpy.fft.fft2.html ♪ After that, you can easily and unintentionally display images on two-way garmones by a specialized method. https://numpy.org/doc/stable/reference/generated/numpy.fft.rfft2.html for physically important functions.