Skip to content

Commit

Permalink
build based on 8f7af44
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Feb 4, 2025
1 parent 444c192 commit 0f6dd57
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions dev/api/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/gauss-kronrod/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@
-0.7541667265708492204408171669461158663862998043714845
-0.5384693101056830910363144207002088049672866069055604
-0.2796304131617831934134665227489774362421188153561727
0.0</code></pre><h2 id="Quadrature-rules-for-weighted-integrals"><a class="docs-heading-anchor" href="#Quadrature-rules-for-weighted-integrals">Quadrature rules for weighted integrals</a><a id="Quadrature-rules-for-weighted-integrals-1"></a><a class="docs-heading-anchor-permalink" href="#Quadrature-rules-for-weighted-integrals" title="Permalink"></a></h2><p>More generally, one can compute quadrature rules for a <strong>weighted</strong> integral:</p><p class="math-container">\[\int_a^b W(x) f(x) dx \approx \sum_{i=1}^n w_i f(x_i)\]</p><p>where the effect of <strong>weight function</strong> <span>$W(x)$</span> (usually required to be <span>$≥ 0$</span> in <span>$(a,b)$</span>) is included in the quadrature weights <span>$w_i$</span> and points <span>$x_i$</span>. The main motivation for weighted quadrature rules is to handle <em>poorly behaved</em> integrands — singular, discontinuous, highly oscillatory, and so on — where the &quot;bad&quot; behavior is <em>known</em> and can be <em>factored out</em> into <span>$W(x)$</span>. By designing a quadrature rule with <span>$W(x)$</span> taken into account, one can obtain fast convergence as long as the remaining factor <span>$f(x)$</span> is smooth, regardless of how &quot;bad&quot; <span>$W(x)$</span> is. Moreover, the rule can be re-used for many different <span>$f(x)$</span> as long as <span>$W(x)$</span> remains the same.</p><p>The QuadGK package can compute both Gauss and Gauss–Kronrod quadrature rules for arbitrary weight functions <span>$W(x)$</span>, to arbitrary precision, as described in the section: <a href="../weighted-gauss/#Gaussian-quadrature-and-arbitrary-weight-functions">Gaussian quadrature and arbitrary weight functions</a>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../quadgk-examples/">« Examples</a><a class="docs-footer-nextpage" href="../weighted-gauss/">Weighted quadrature »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Wednesday 18 September 2024 12:06">Wednesday 18 September 2024</span>. Using Julia version 1.6.7.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0.0</code></pre><h2 id="Quadrature-rules-for-weighted-integrals"><a class="docs-heading-anchor" href="#Quadrature-rules-for-weighted-integrals">Quadrature rules for weighted integrals</a><a id="Quadrature-rules-for-weighted-integrals-1"></a><a class="docs-heading-anchor-permalink" href="#Quadrature-rules-for-weighted-integrals" title="Permalink"></a></h2><p>More generally, one can compute quadrature rules for a <strong>weighted</strong> integral:</p><p class="math-container">\[\int_a^b W(x) f(x) dx \approx \sum_{i=1}^n w_i f(x_i)\]</p><p>where the effect of <strong>weight function</strong> <span>$W(x)$</span> (usually required to be <span>$≥ 0$</span> in <span>$(a,b)$</span>) is included in the quadrature weights <span>$w_i$</span> and points <span>$x_i$</span>. The main motivation for weighted quadrature rules is to handle <em>poorly behaved</em> integrands — singular, discontinuous, highly oscillatory, and so on — where the &quot;bad&quot; behavior is <em>known</em> and can be <em>factored out</em> into <span>$W(x)$</span>. By designing a quadrature rule with <span>$W(x)$</span> taken into account, one can obtain fast convergence as long as the remaining factor <span>$f(x)$</span> is smooth, regardless of how &quot;bad&quot; <span>$W(x)$</span> is. Moreover, the rule can be re-used for many different <span>$f(x)$</span> as long as <span>$W(x)$</span> remains the same.</p><p>The QuadGK package can compute both Gauss and Gauss–Kronrod quadrature rules for arbitrary weight functions <span>$W(x)$</span>, to arbitrary precision, as described in the section: <a href="../weighted-gauss/#Gaussian-quadrature-and-arbitrary-weight-functions">Gaussian quadrature and arbitrary weight functions</a>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../quadgk-examples/">« Examples</a><a class="docs-footer-nextpage" href="../weighted-gauss/">Weighted quadrature »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Tuesday 4 February 2025 14:49">Tuesday 4 February 2025</span>. Using Julia version 1.6.7.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
2 changes: 1 addition & 1 deletion dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

julia&gt; integral, error = quadgk(x -&gt; cos(200x), 0, 1)
(-0.004366486486069925, 2.552917865170437e-13)</code></pre><p>Notice that the result is a <a href="https://docs.julialang.org/en/v1/manual/functions/#Tuples">tuple</a> of two values: the estimated <code>integral</code> of <code>-0.004366486486069925</code>, an estimated upper bound <code>error ≈ 2.55e-13</code> on the <a href="https://en.wikipedia.org/wiki/Truncation_error">truncation error</a> in the computed integral (due to the finite number of points at which <code>quadgk</code> evaluates the integrand).</p><p>By default, <code>quadgk</code> evaluates the integrand at more and more points (&quot;adaptive quadrature&quot;) until the relative error estimate is less than <code>sqrt(eps())</code>, corresponding to about 8 significant digits. Often, however, you should change this by passing a relative tolerance (<code>rtol</code>) and/or an absolute tolerance (<code>atol</code>), e.g.:</p><pre><code class="language-julia-repl">julia&gt; quadgk(x -&gt; cos(200x), 0, 1, rtol=1e-3)
(-0.004366486486069085, 2.569238200052031e-6)</code></pre><p>For extremely <a href="https://en.wikipedia.org/wiki/Smoothness">smooth functions</a> like <span>$\cos(200x)$</span>, even though it is highly oscillatory, <code>quadgk</code> often gives a very accurate result, even more accurate than the minimum accuracy you requested (defaulting to about 8 digits). In this particular case, we know that the exact integral is <span>$\sin(200)/200 \approx -0.004366486486069972908665092105754\ldots$</span>, and <code>integral</code> matches this to about 14 <a href="https://en.wikipedia.org/wiki/Significant_figures">significant digits</a> with the default tolerance and to about 13 digits even for <code>rtol=1e-3</code>.</p><h2 id="Tutorial-examples"><a class="docs-heading-anchor" href="#Tutorial-examples">Tutorial examples</a><a id="Tutorial-examples-1"></a><a class="docs-heading-anchor-permalink" href="#Tutorial-examples" title="Permalink"></a></h2><p>The <a href="quadgk-examples/#quadgk-examples"><code>quadgk</code> examples</a> chapter of this manual presents several other examples, including improper integrals, vector-valued integrands, batched integrand evaluation, improper integrals, singular or near-singular integrands, and Cauchy principal values.</p><h2 id="In-place-operations-for-array-valued-integrands"><a class="docs-heading-anchor" href="#In-place-operations-for-array-valued-integrands">In-place operations for array-valued integrands</a><a id="In-place-operations-for-array-valued-integrands-1"></a><a class="docs-heading-anchor-permalink" href="#In-place-operations-for-array-valued-integrands" title="Permalink"></a></h2><p>For integrands whose values are <em>small</em> arrays whose length is known at compile-time, it is usually most efficient to modify your integrand to return an <code>SVector</code> from the <a href="https://github.com/JuliaArrays/StaticArrays.jl">StaticArrays.jl package</a>.</p><p>However, for integrands that return large or runtime-length arrays, we also provide a function <code>quadgk!(f!, result, a,b...)</code> in order to exploit in-place operations where possible. The <code>result</code> argument is used to store the estimated integral <code>I</code> in-place, and the integrand function is now of the form <code>f!(r, x)</code> and should write <code>f(x)</code> in-place into the result array <code>r</code>. See the <a href="api/#QuadGK.quadgk!"><code>quadgk!</code></a> documentation for more detail.</p><h2 id="API-Reference"><a class="docs-heading-anchor" href="#API-Reference">API Reference</a><a id="API-Reference-1"></a><a class="docs-heading-anchor-permalink" href="#API-Reference" title="Permalink"></a></h2><p>See the <a href="api/#API-reference">API reference</a> chapter for a detailed description of the QuadGK programming interface.</p><h2 id="Other-Julia-quadrature-packages"><a class="docs-heading-anchor" href="#Other-Julia-quadrature-packages">Other Julia quadrature packages</a><a id="Other-Julia-quadrature-packages-1"></a><a class="docs-heading-anchor-permalink" href="#Other-Julia-quadrature-packages" title="Permalink"></a></h2><p>The <a href="https://github.com/ajt60gaibb/FastGaussQuadrature.jl">FastGaussQuadrature.jl</a> package provides non-adaptive Gaussian quadrature variety of built-in weight functions — it is a good choice you need to go to very high orders <span>$N$</span>, e.g. to integrate rapidly oscillating functions, or use weight functions that incorporate some standard singularity in your integrand. QuadGK, on the other hand, keeps the order <span>$N$</span> of the quadrature rule fixed and improves accuracy by subdividing the integration domain, which can be better if fine resolution is required only in a part of your domain (e.g if your integrand has a sharp peak or singularity somewhere that is not known in advance).</p><p>For multidimensional integration, see also the <a href="https://github.com/stevengj/HCubature.jl">HCubature.jl</a>, <a href="https://github.com/stevengj/Cubature.jl">Cubature.jl</a>, and <a href="https://github.com/giordano/Cuba.jl">Cuba.jl</a> packages.</p><p>Note that all of the above quadrature routines assume that you supply you integrand as a <em>function</em> <span>$f(x)$</span> that can be evaluated at <em>arbitrary points</em> inside the integration domain. This is ideal, because then the integration algorithm can choose points so that the accuracy improves rapidly (often exponentially rapidly) with the number of points. However if you only have function values supplied at pre-determined points, such as on a regular grid, then you should use another (probably slower-converging) algorithm in a package such as <a href="https://github.com/francescoalemanno/Trapz.jl">Trapz.jl</a>, <a href="https://github.com/fgasdia/Romberg.jl">Romberg.jl</a>, or <a href="https://github.com/dextorious/NumericalIntegration.jl">NumericalIntegration.jl</a>.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="quadgk-examples/">Examples »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Wednesday 18 September 2024 12:06">Wednesday 18 September 2024</span>. Using Julia version 1.6.7.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
(-0.004366486486069085, 2.569238200052031e-6)</code></pre><p>For extremely <a href="https://en.wikipedia.org/wiki/Smoothness">smooth functions</a> like <span>$\cos(200x)$</span>, even though it is highly oscillatory, <code>quadgk</code> often gives a very accurate result, even more accurate than the minimum accuracy you requested (defaulting to about 8 digits). In this particular case, we know that the exact integral is <span>$\sin(200)/200 \approx -0.004366486486069972908665092105754\ldots$</span>, and <code>integral</code> matches this to about 14 <a href="https://en.wikipedia.org/wiki/Significant_figures">significant digits</a> with the default tolerance and to about 13 digits even for <code>rtol=1e-3</code>.</p><h2 id="Tutorial-examples"><a class="docs-heading-anchor" href="#Tutorial-examples">Tutorial examples</a><a id="Tutorial-examples-1"></a><a class="docs-heading-anchor-permalink" href="#Tutorial-examples" title="Permalink"></a></h2><p>The <a href="quadgk-examples/#quadgk-examples"><code>quadgk</code> examples</a> chapter of this manual presents several other examples, including improper integrals, vector-valued integrands, batched integrand evaluation, improper integrals, singular or near-singular integrands, and Cauchy principal values.</p><h2 id="In-place-operations-for-array-valued-integrands"><a class="docs-heading-anchor" href="#In-place-operations-for-array-valued-integrands">In-place operations for array-valued integrands</a><a id="In-place-operations-for-array-valued-integrands-1"></a><a class="docs-heading-anchor-permalink" href="#In-place-operations-for-array-valued-integrands" title="Permalink"></a></h2><p>For integrands whose values are <em>small</em> arrays whose length is known at compile-time, it is usually most efficient to modify your integrand to return an <code>SVector</code> from the <a href="https://github.com/JuliaArrays/StaticArrays.jl">StaticArrays.jl package</a>.</p><p>However, for integrands that return large or runtime-length arrays, we also provide a function <code>quadgk!(f!, result, a,b...)</code> in order to exploit in-place operations where possible. The <code>result</code> argument is used to store the estimated integral <code>I</code> in-place, and the integrand function is now of the form <code>f!(r, x)</code> and should write <code>f(x)</code> in-place into the result array <code>r</code>. See the <a href="api/#QuadGK.quadgk!"><code>quadgk!</code></a> documentation for more detail.</p><h2 id="API-Reference"><a class="docs-heading-anchor" href="#API-Reference">API Reference</a><a id="API-Reference-1"></a><a class="docs-heading-anchor-permalink" href="#API-Reference" title="Permalink"></a></h2><p>See the <a href="api/#API-reference">API reference</a> chapter for a detailed description of the QuadGK programming interface.</p><h2 id="Other-Julia-quadrature-packages"><a class="docs-heading-anchor" href="#Other-Julia-quadrature-packages">Other Julia quadrature packages</a><a id="Other-Julia-quadrature-packages-1"></a><a class="docs-heading-anchor-permalink" href="#Other-Julia-quadrature-packages" title="Permalink"></a></h2><p>The <a href="https://github.com/ajt60gaibb/FastGaussQuadrature.jl">FastGaussQuadrature.jl</a> package provides non-adaptive Gaussian quadrature variety of built-in weight functions — it is a good choice you need to go to very high orders <span>$N$</span>, e.g. to integrate rapidly oscillating functions, or use weight functions that incorporate some standard singularity in your integrand. QuadGK, on the other hand, keeps the order <span>$N$</span> of the quadrature rule fixed and improves accuracy by subdividing the integration domain, which can be better if fine resolution is required only in a part of your domain (e.g if your integrand has a sharp peak or singularity somewhere that is not known in advance).</p><p>For multidimensional integration, see also the <a href="https://github.com/stevengj/HCubature.jl">HCubature.jl</a>, <a href="https://github.com/stevengj/Cubature.jl">Cubature.jl</a>, and <a href="https://github.com/giordano/Cuba.jl">Cuba.jl</a> packages.</p><p>Note that all of the above quadrature routines assume that you supply you integrand as a <em>function</em> <span>$f(x)$</span> that can be evaluated at <em>arbitrary points</em> inside the integration domain. This is ideal, because then the integration algorithm can choose points so that the accuracy improves rapidly (often exponentially rapidly) with the number of points. However if you only have function values supplied at pre-determined points, such as on a regular grid, then you should use another (probably slower-converging) algorithm in a package such as <a href="https://github.com/francescoalemanno/Trapz.jl">Trapz.jl</a>, <a href="https://github.com/fgasdia/Romberg.jl">Romberg.jl</a>, or <a href="https://github.com/dextorious/NumericalIntegration.jl">NumericalIntegration.jl</a>.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="quadgk-examples/">Examples »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Tuesday 4 February 2025 14:49">Tuesday 4 February 2025</span>. Using Julia version 1.6.7.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 0f6dd57

Please sign in to comment.