Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quadpy should have dblquad. #254

Open
shankardutt opened this issue Apr 5, 2020 · 1 comment
Open

Quadpy should have dblquad. #254

shankardutt opened this issue Apr 5, 2020 · 1 comment

Comments

@shankardutt
Copy link

shankardutt commented Apr 5, 2020

Hi, I am using scipy.integrate.dblquad to integrate the function as shown below. Obviously, it is quite slow. Is there any way to implement the same in quadpy so as to achieve better performance.

import numpy as np
from scipy import integrate
from scipy.special import erf
from scipy.special import j0
import time

q = np.linspace(0.03, 1.0, 1000)

start = time.time()

def f(q, z, t):
    return t * 0.5 * (erf((t - z) / 3) - 1) * j0(q * t) * (1 / (np.sqrt(2 * np.pi) * 2)) * np.exp(
        -0.5 * ((z - 40) / 2) ** 2)


y = np.empty([len(q)])
for n in range(len(q)):
    y[n] = integrate.dblquad(lambda t, z: f(q[n], z, t), 0, 50, lambda z: 10, lambda z: 60)[0]

end = time.time()
print(end - start)

Total time is

212.96751403808594
@nschloe
Copy link
Collaborator

nschloe commented Apr 5, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants