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

quad slow? #253

Open
nschloe opened this issue Mar 29, 2020 · 1 comment
Open

quad slow? #253

nschloe opened this issue Mar 29, 2020 · 1 comment

Comments

@nschloe
Copy link
Collaborator

nschloe commented Mar 29, 2020

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

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


def f(t):
    return t * 0.5 * (erf((t - 40) / 3) - 1) * j0(np.multiply.outer(q, t))


start = time.time()
y, _ = integrate.quad_vec(f, 0, 50)
end = time.time()
print(end - start)

start = time.time()
y1, _ = quadpy.quad(f, 0, 50)
end = time.time()
print(end - start)
0.0819394588470459
0.4957756996154785
@nschloe
Copy link
Collaborator Author

nschloe commented Apr 24, 2020

The speed in quadpy very much depends on the chosen Kronrod degree. The higher the degree, the faster the above example.

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

1 participant