Comments (2)
What is your interval (a,b)?
- If the interval includes x=±1, where your w(x) blows up, then your integral does not converge (unless f vanishes at these points), because this is not an integrable singularity. For the same reason,
QuadGK.gauss
will not work for this weight function. - Or maybe you want to compute a Cauchy Principal value? In that case, you can use a simple transformation to remove the singularity: #44 (comment)
- If your interval does not include the singularity, why do you need to precompute the effect of the weight function at all? Why not just pass the whole integrand F(x)=w(x)f(x) to
quadgk
or some other quadrature method? But yes, you could useQuadGK.gauss
to obtain a custom weighted quadrature scheme in this case.
from quadgk.jl.
Hi @stevengj,
Thank you very much for your help. So, my interval can arbitrarily be chosen (a, b>=0).
If the interval includes x=±1, where your w(x) blows up, then your integral does not converge (unless f vanishes at these points), because this is not an integrable singularity. For the same reason, QuadGK.gauss will not work for this weight function.
Do you mean that at these values my w(x) will equal to 0? But I think w(x)=1/(1+x^2) = 1
when x=+-1
.
Or maybe you want to compute a Cauchy Principal value? In that case, you can use a simple transformation to remove the singularity: #44 (comment)
Yes, indeed. That is what I want. Here my weight function could be (1)w(x) = e^{-x^2}
(normal distribution) or (2) w(x) = 1/(1+x^2)
(Half-Cauchy distribution, https://distribution-explorer.github.io/continuous/halfcauchy.html). In case (1), we can use Gauss–Laguerre quadrature (https://en.wikipedia.org/wiki/Gauss–Laguerre_quadrature). But in case (2), I could not find a proper a quadrature rule (see https://en.wikipedia.org/wiki/Gaussian_quadrature in Section "Other Forms"). Perhaps, I would need to do a transformation as you suggested to remove the singularity. Or another transformation is x = tan(u)
. So my integral will be I = \int_{a}^{b} w(x)f(x)dx = \int_{arctan(a)}^{arctan(b)} f(tan(u))du
. Then, I can use your function QuadGK.gauss to get notes and weights. I am sorry that I do not know how to display LaTeX formulaes in GitHub.
If your interval does not include the singularity, why do you need to precompute the effect of the weight function at all? Why not just pass the whole integrand F(x)=w(x)f(x) to quadgk or some other quadrature method? But yes, you could use QuadGK.gauss to obtain a custom weighted quadrature scheme in this case.
Yes, indeed. I also thought that. But I thought that using QuadGK.gauss on F(x)
might not give a good approximation compared to a special technique using different polynomials on w(x)
. So, I will try with your suggestions. Also, do you have any suggestions for other quadrature methods that I could look at?
Thank you very much for your help!
from quadgk.jl.
Related Issues (20)
- confusion in kronrod() documentation? HOT 1
- Documentation suggestion
- TagBot trigger issue HOT 13
- AD compatibility HOT 1
- How to cite QuadGK HOT 1
- Compatibility with CUDA.jl HOT 2
- Possible regression using quadgk function and Unitful limits HOT 9
- unitful infinite bounds
- order=1 seems børked HOT 1
- contour integration HOT 1
- documentation build is failing HOT 4
- Autodiff of `quadgk` HOT 2
- Can not catch a JuliaError caused by function blowing up to infinity HOT 2
- misleading error estimate for non-convergent integral (maxevals=10^7 reached) HOT 5
- QuadGK evaluates function at upper bound HOT 4
- No cachedrule for DynamicQuantities types HOT 4
- Regression with [email protected] HOT 6
- spurious underflow in kronrod for large n HOT 1
- infinite limits with units and segbuf broken
- quadgk with identical lower and upper bound is broken HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quadgk.jl.