Comments (7)
When applying Hermite quadrature, note that, given f
, it approximates the integral
int_{-infty}^{+infty} f(x) exp(-x^2)
The true result of int_{-infty}^{+infty} x^2 exp(-x^2)
is sqrt(pi)/2
, so quadpy is right.
from quadpy.
My bad! I've seen so much Gauss-Hermite used to approximate f(y) where y is a normally distributed variable that I thought that was the canonical representation of Gauss-Hermite.
Would you be interested in a pull request for the rescaling for the normally distributed case? I guess it's better to write a new function in that case
from quadpy.
You mean a function that already incorporates the term exp(-x ** 2)
?
from quadpy.
I mean a function that uses Gauss-Hermite polynomials to integrate a function f(y)
where y ~ N(mu, sigma)
. The integral would look this way:
\int f(y) stats.norm.pdf(y, mu, sigma) dy = \int_{-\infty}^{+\infty} \frac{1}{\sigma \sqrt{2\pi}} f(y) \exp \left( -\frac{(y-\mu)^2}{2\sigma^2} \right) dy
The integration procedure could be called this way (not sure about the name of course!)
quadpy.function_of_a_normal.integrate(f, quadpy.e1r2.GaussHermite(5))
from quadpy.
Not a big fan of this. One can easily transform the integral into one of the form
int_{-infty}^{+infty} f(x) exp(-x^2)
and is should be the responsibility of the user to do so.
from quadpy.
Ok! But, just in case, I don't think you can transform the integral into that form without rescaling the nodes.
from quadpy.
\int_{-\infty}^{+\infty} \frac{1}{\sigma \sqrt{2\pi}} f(y) \exp \left( -\frac{(y-\mu)^2}{2\sigma^2} \right) dy
= [x = (y - mu) / sqrt(2) / sigma]
\int_{-\infty}^{+\infty} \frac{1}{\sqrt{\pi}} f(x) \exp(-x^2) dx
so you want
f(x) / sqrt(pi)
No need to rescale anything.
from quadpy.
Related Issues (20)
- ValueError: Need x21 < 0.3 (also why is the code encrypted?) HOT 8
- Problem with vectorization HOT 6
- Quadpy usage HOT 1
- The source code is not available HOT 1
- Status of package and licensing HOT 4
- Quadpy is now asking for a sigma license HOT 18
- Can't import HOT 8
- Orthopy version no longer supported HOT 9
- version of orthopy no longer supported HOT 5
- Return points and values for integrate_adaptive HOT 1
- Importing quadpy causes python to quit without any error message HOT 4
- Issue upgrading quadpy HOT 7
- Unable to find valid license for Sigma. HOT 3
- Recurrent issue with sigma license HOT 5
- NameError: name 'c2' is not defined HOT 3
- Quadpy RuntimeError HOT 7
- Adaptive multivariate integration over hypercubes HOT 9
- Integrate over multiple limits at once using Quadpy HOT 8
- newest pip version not importable HOT 1
- the integrals with Heaviside function are very inaccurate HOT 9
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 quadpy.