I am trying to integrate my function over u
and xx
and then store the values in a matrix so I can plot them with imshow
or pcolormesh
. The bounds on the integration are 0 < u < inf
and -inf < xx < inf
. At the moment, I am only taking the bounds to be 10 until I can figure this out.
import numpy as np
import pylab as pl
from scipy.integrate import dblquad
b = 50.0
x = np.linspace(-10, 10, 1000)
y = np.linspace(0, 10, 1000)
T = pl.zeros([len(x), len(y)])
for xi in enumerate(x):
for yi in enumerate(y):
def f(xi, yi, u, xx):
return ((np.exp(u * (b - yi)) - np.exp(-u * (b - yi))) /
(np.exp(u * b) - np.exp(-u * b)) * np.cos(u * (xx - xi)))
def fint(u, xx):
return T + dblquad(f, -10, 10, 0.1, 10, args = (u, xx))[0]
This is the code I have so far but I know it isn't working properly; unfortunately, I don't know what the problem is. Maybe I can't have the two for loops in my definition of f
or my my fint
is wrong.