diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index db9b47d..7fffe62 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.1","generation_timestamp":"2024-02-16T12:08:27","documenter_version":"1.2.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.1","generation_timestamp":"2024-02-18T10:49:24","documenter_version":"1.2.1"}} \ No newline at end of file diff --git a/dev/assets/Manifest.toml b/dev/assets/Manifest.toml index f127d7b..b0c98e4 100644 --- a/dev/assets/Manifest.toml +++ b/dev/assets/Manifest.toml @@ -542,9 +542,9 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.LogExpFunctions]] deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] -git-tree-sha1 = "7d6dd4e9212aebaeed356de34ccf262a3cd415aa" +git-tree-sha1 = "18144f3e9cbe9b15b070288eef858f71b291ce37" uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -version = "0.3.26" +version = "0.3.27" [deps.LogExpFunctions.extensions] LogExpFunctionsChainRulesCoreExt = "ChainRulesCore" @@ -781,9 +781,9 @@ version = "0.7.0" [[deps.SciMLBase]] deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FillArrays", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables", "TruncatedStacktraces"] -git-tree-sha1 = "a123011b1711f3449bc4e5d66746be5725af92fd" +git-tree-sha1 = "33e40003f4ef424e8a8700e0a3a189c6ece2af27" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.26.0" +version = "2.26.1" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" diff --git a/dev/basics/FAQ/index.html b/dev/basics/FAQ/index.html index 38813ac..b64d82e 100644 --- a/dev/basics/FAQ/index.html +++ b/dev/basics/FAQ/index.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Frequently Asked Questions · Integrals.jl</title><meta name="title" content="Frequently Asked Questions · Integrals.jl"/><meta property="og:title" content="Frequently Asked Questions · Integrals.jl"/><meta property="twitter:title" content="Frequently Asked Questions · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/basics/FAQ/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/basics/FAQ/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/basics/FAQ/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../IntegralProblem/">Integral Problems</a></li><li><a class="tocitem" href="../IntegralFunction/">Integral Functions</a></li><li><a class="tocitem" href="../SampledIntegralProblem/">Integrating pre-sampled data</a></li><li><a class="tocitem" href="../solve/">Common Solver Options (Solve Keyword Arguments)</a></li><li class="is-active"><a class="tocitem" href>Frequently Asked Questions</a><ul class="internal"><li><a class="tocitem" href="#How-should-I-use-the-in-place-interface?"><span>How should I use the in-place interface?</span></a></li><li><a class="tocitem" href="#How-should-I-use-the-batch-interface?"><span>How should I use the batch interface?</span></a></li><li><a class="tocitem" href="#What-should-I-do-if-my-solution-is-not-converged?"><span>What should I do if my solution is not converged?</span></a></li><li><a class="tocitem" href="#How-can-I-integrate-arbitrarily-spaced-data?"><span>How can I integrate arbitrarily-spaced data?</span></a></li><li><a class="tocitem" href="#How-can-I-integrate-on-arbitrary-geometries?"><span>How can I integrate on arbitrary geometries?</span></a></li><li><a class="tocitem" href="#I-don't-see-algorithm-X-or-quadrature-scheme-Y-?"><span>I don't see algorithm X or quadrature scheme Y ?</span></a></li><li><a class="tocitem" href="#Can-I-take-derivatives-with-respect-to-the-limits-of-integration?"><span>Can I take derivatives with respect to the limits of integration?</span></a></li></ul></li></ul></li><li><span class="tocitem">Solvers</span><ul><li><a class="tocitem" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Basics</a></li><li class="is-active"><a href>Frequently Asked Questions</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Frequently Asked Questions</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/basics/FAQ.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Frequently-Asked-Questions"><a class="docs-heading-anchor" href="#Frequently-Asked-Questions">Frequently Asked Questions</a><a id="Frequently-Asked-Questions-1"></a><a class="docs-heading-anchor-permalink" href="#Frequently-Asked-Questions" title="Permalink"></a></h1><h2 id="How-should-I-use-the-in-place-interface?"><a class="docs-heading-anchor" href="#How-should-I-use-the-in-place-interface?">How should I use the in-place interface?</a><a id="How-should-I-use-the-in-place-interface?-1"></a><a class="docs-heading-anchor-permalink" href="#How-should-I-use-the-in-place-interface?" title="Permalink"></a></h2><p>The in-place interface allows evaluating vector-valued integrands without allocating an output array. This can be beneficial for reducing allocations when integrating many functions simultaneously or to make use of existing in-place code. However, note that not all algorithms use in-place operations under the hood, i.e. <code>HCubatureJL()</code>, and may still allocate.</p><p>You can construct an <code>IntegralFunction(f, prototype)</code>, where <code>f</code> is of the form <code>f(y, u, p)</code> where <code>prototype</code> is of the desired type and shape of <code>y</code>.</p><p>For small array outputs of a known size, consider using StaticArrays.jl for the return value of your integrand.</p><h2 id="How-should-I-use-the-batch-interface?"><a class="docs-heading-anchor" href="#How-should-I-use-the-batch-interface?">How should I use the batch interface?</a><a id="How-should-I-use-the-batch-interface?-1"></a><a class="docs-heading-anchor-permalink" href="#How-should-I-use-the-batch-interface?" title="Permalink"></a></h2><p>The batch interface allows evaluating one (or more) integrals simultaneously at different points, which maximizes the parallelism for a given algorithm.</p><p>You can construct an out-of-place <code>BatchIntegralFunction(bf)</code> where <code>bf</code> is of the form <code>bf(u, p) = stack(x -> f(x, p), eachslice(u; dims=ndims(u)))</code>, where <code>f</code> is the (unbatched) integrand.</p><p>You can construct an in-place <code>BatchIntegralFunction(bf, prototype)</code>, where <code>bf</code> is of the form <code>bf(y, u, p) = foreach((y,x) -> f(y,x,p), eachslice(y, dims=ndims(y)), eachslice(x, dims=ndims(x)))</code>.</p><p>Note that not all algorithms use in-place batched operations under the hood, i.e. <code>QuadGKJL()</code>.</p><h2 id="What-should-I-do-if-my-solution-is-not-converged?"><a class="docs-heading-anchor" href="#What-should-I-do-if-my-solution-is-not-converged?">What should I do if my solution is not converged?</a><a id="What-should-I-do-if-my-solution-is-not-converged?-1"></a><a class="docs-heading-anchor-permalink" href="#What-should-I-do-if-my-solution-is-not-converged?" title="Permalink"></a></h2><p>Certain algorithms, such as <code>QuadratureRule</code> used a fixed number of points to calculate an integral and cannot provide an error estimate. In this case, you have to increase the number of points and check the convergence yourself, which will depend on the accuracy of the rule you choose.</p><p>For badly-behaved integrands, such as (nearly) singular and highly oscillatory functions, most algorithms will fail to converge and either throw an error or silently return the incorrect result. In some cases Integrals.jl can provide an error code when things go wrong, but otherwise you can always check if the error estimate for the integral is less than the requested tolerance, e.g. <code>sol.resid < max(abstol, reltol*norm(sol.u))</code>. Sometimes using a larger tolerance or higher precision arithmetic may help.</p><h2 id="How-can-I-integrate-arbitrarily-spaced-data?"><a class="docs-heading-anchor" href="#How-can-I-integrate-arbitrarily-spaced-data?">How can I integrate arbitrarily-spaced data?</a><a id="How-can-I-integrate-arbitrarily-spaced-data?-1"></a><a class="docs-heading-anchor-permalink" href="#How-can-I-integrate-arbitrarily-spaced-data?" title="Permalink"></a></h2><p>See <code>SampledIntegralProblem</code>.</p><h2 id="How-can-I-integrate-on-arbitrary-geometries?"><a class="docs-heading-anchor" href="#How-can-I-integrate-on-arbitrary-geometries?">How can I integrate on arbitrary geometries?</a><a id="How-can-I-integrate-on-arbitrary-geometries?-1"></a><a class="docs-heading-anchor-permalink" href="#How-can-I-integrate-on-arbitrary-geometries?" title="Permalink"></a></h2><p>You can't, since Integrals.jl currently supports integration on hypercubes because that is what lower-level packages implement.</p><h2 id="I-don't-see-algorithm-X-or-quadrature-scheme-Y-?"><a class="docs-heading-anchor" href="#I-don't-see-algorithm-X-or-quadrature-scheme-Y-?">I don't see algorithm X or quadrature scheme Y ?</a><a id="I-don't-see-algorithm-X-or-quadrature-scheme-Y-?-1"></a><a class="docs-heading-anchor-permalink" href="#I-don't-see-algorithm-X-or-quadrature-scheme-Y-?" title="Permalink"></a></h2><p>Fixed quadrature rules from other packages can be used with <code>QuadratureRule</code>. Otherwise, feel free to open an issue or pull request.</p><h2 id="Can-I-take-derivatives-with-respect-to-the-limits-of-integration?"><a class="docs-heading-anchor" href="#Can-I-take-derivatives-with-respect-to-the-limits-of-integration?">Can I take derivatives with respect to the limits of integration?</a><a id="Can-I-take-derivatives-with-respect-to-the-limits-of-integration?-1"></a><a class="docs-heading-anchor-permalink" href="#Can-I-take-derivatives-with-respect-to-the-limits-of-integration?" title="Permalink"></a></h2><p>Currently this is not implemented.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../solve/">« Common Solver Options (Solve Keyword Arguments)</a><a class="docs-footer-nextpage" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Frequently Asked Questions · Integrals.jl</title><meta name="title" content="Frequently Asked Questions · Integrals.jl"/><meta property="og:title" content="Frequently Asked Questions · Integrals.jl"/><meta property="twitter:title" content="Frequently Asked Questions · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/basics/FAQ/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/basics/FAQ/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/basics/FAQ/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../IntegralProblem/">Integral Problems</a></li><li><a class="tocitem" href="../IntegralFunction/">Integral Functions</a></li><li><a class="tocitem" href="../SampledIntegralProblem/">Integrating pre-sampled data</a></li><li><a class="tocitem" href="../solve/">Common Solver Options (Solve Keyword Arguments)</a></li><li class="is-active"><a class="tocitem" href>Frequently Asked Questions</a><ul class="internal"><li><a class="tocitem" href="#How-should-I-use-the-in-place-interface?"><span>How should I use the in-place interface?</span></a></li><li><a class="tocitem" href="#How-should-I-use-the-batch-interface?"><span>How should I use the batch interface?</span></a></li><li><a class="tocitem" href="#What-should-I-do-if-my-solution-is-not-converged?"><span>What should I do if my solution is not converged?</span></a></li><li><a class="tocitem" href="#How-can-I-integrate-arbitrarily-spaced-data?"><span>How can I integrate arbitrarily-spaced data?</span></a></li><li><a class="tocitem" href="#How-can-I-integrate-on-arbitrary-geometries?"><span>How can I integrate on arbitrary geometries?</span></a></li><li><a class="tocitem" href="#I-don't-see-algorithm-X-or-quadrature-scheme-Y-?"><span>I don't see algorithm X or quadrature scheme Y ?</span></a></li><li><a class="tocitem" href="#Can-I-take-derivatives-with-respect-to-the-limits-of-integration?"><span>Can I take derivatives with respect to the limits of integration?</span></a></li></ul></li></ul></li><li><span class="tocitem">Solvers</span><ul><li><a class="tocitem" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Basics</a></li><li class="is-active"><a href>Frequently Asked Questions</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Frequently Asked Questions</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/basics/FAQ.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Frequently-Asked-Questions"><a class="docs-heading-anchor" href="#Frequently-Asked-Questions">Frequently Asked Questions</a><a id="Frequently-Asked-Questions-1"></a><a class="docs-heading-anchor-permalink" href="#Frequently-Asked-Questions" title="Permalink"></a></h1><h2 id="How-should-I-use-the-in-place-interface?"><a class="docs-heading-anchor" href="#How-should-I-use-the-in-place-interface?">How should I use the in-place interface?</a><a id="How-should-I-use-the-in-place-interface?-1"></a><a class="docs-heading-anchor-permalink" href="#How-should-I-use-the-in-place-interface?" title="Permalink"></a></h2><p>The in-place interface allows evaluating vector-valued integrands without allocating an output array. This can be beneficial for reducing allocations when integrating many functions simultaneously or to make use of existing in-place code. However, note that not all algorithms use in-place operations under the hood, i.e. <code>HCubatureJL()</code>, and may still allocate.</p><p>You can construct an <code>IntegralFunction(f, prototype)</code>, where <code>f</code> is of the form <code>f(y, u, p)</code> where <code>prototype</code> is of the desired type and shape of <code>y</code>.</p><p>For small array outputs of a known size, consider using StaticArrays.jl for the return value of your integrand.</p><h2 id="How-should-I-use-the-batch-interface?"><a class="docs-heading-anchor" href="#How-should-I-use-the-batch-interface?">How should I use the batch interface?</a><a id="How-should-I-use-the-batch-interface?-1"></a><a class="docs-heading-anchor-permalink" href="#How-should-I-use-the-batch-interface?" title="Permalink"></a></h2><p>The batch interface allows evaluating one (or more) integrals simultaneously at different points, which maximizes the parallelism for a given algorithm.</p><p>You can construct an out-of-place <code>BatchIntegralFunction(bf)</code> where <code>bf</code> is of the form <code>bf(u, p) = stack(x -> f(x, p), eachslice(u; dims=ndims(u)))</code>, where <code>f</code> is the (unbatched) integrand.</p><p>You can construct an in-place <code>BatchIntegralFunction(bf, prototype)</code>, where <code>bf</code> is of the form <code>bf(y, u, p) = foreach((y,x) -> f(y,x,p), eachslice(y, dims=ndims(y)), eachslice(x, dims=ndims(x)))</code>.</p><p>Note that not all algorithms use in-place batched operations under the hood, i.e. <code>QuadGKJL()</code>.</p><h2 id="What-should-I-do-if-my-solution-is-not-converged?"><a class="docs-heading-anchor" href="#What-should-I-do-if-my-solution-is-not-converged?">What should I do if my solution is not converged?</a><a id="What-should-I-do-if-my-solution-is-not-converged?-1"></a><a class="docs-heading-anchor-permalink" href="#What-should-I-do-if-my-solution-is-not-converged?" title="Permalink"></a></h2><p>Certain algorithms, such as <code>QuadratureRule</code> used a fixed number of points to calculate an integral and cannot provide an error estimate. In this case, you have to increase the number of points and check the convergence yourself, which will depend on the accuracy of the rule you choose.</p><p>For badly-behaved integrands, such as (nearly) singular and highly oscillatory functions, most algorithms will fail to converge and either throw an error or silently return the incorrect result. In some cases Integrals.jl can provide an error code when things go wrong, but otherwise you can always check if the error estimate for the integral is less than the requested tolerance, e.g. <code>sol.resid < max(abstol, reltol*norm(sol.u))</code>. Sometimes using a larger tolerance or higher precision arithmetic may help.</p><h2 id="How-can-I-integrate-arbitrarily-spaced-data?"><a class="docs-heading-anchor" href="#How-can-I-integrate-arbitrarily-spaced-data?">How can I integrate arbitrarily-spaced data?</a><a id="How-can-I-integrate-arbitrarily-spaced-data?-1"></a><a class="docs-heading-anchor-permalink" href="#How-can-I-integrate-arbitrarily-spaced-data?" title="Permalink"></a></h2><p>See <code>SampledIntegralProblem</code>.</p><h2 id="How-can-I-integrate-on-arbitrary-geometries?"><a class="docs-heading-anchor" href="#How-can-I-integrate-on-arbitrary-geometries?">How can I integrate on arbitrary geometries?</a><a id="How-can-I-integrate-on-arbitrary-geometries?-1"></a><a class="docs-heading-anchor-permalink" href="#How-can-I-integrate-on-arbitrary-geometries?" title="Permalink"></a></h2><p>You can't, since Integrals.jl currently supports integration on hypercubes because that is what lower-level packages implement.</p><h2 id="I-don't-see-algorithm-X-or-quadrature-scheme-Y-?"><a class="docs-heading-anchor" href="#I-don't-see-algorithm-X-or-quadrature-scheme-Y-?">I don't see algorithm X or quadrature scheme Y ?</a><a id="I-don't-see-algorithm-X-or-quadrature-scheme-Y-?-1"></a><a class="docs-heading-anchor-permalink" href="#I-don't-see-algorithm-X-or-quadrature-scheme-Y-?" title="Permalink"></a></h2><p>Fixed quadrature rules from other packages can be used with <code>QuadratureRule</code>. Otherwise, feel free to open an issue or pull request.</p><h2 id="Can-I-take-derivatives-with-respect-to-the-limits-of-integration?"><a class="docs-heading-anchor" href="#Can-I-take-derivatives-with-respect-to-the-limits-of-integration?">Can I take derivatives with respect to the limits of integration?</a><a id="Can-I-take-derivatives-with-respect-to-the-limits-of-integration?-1"></a><a class="docs-heading-anchor-permalink" href="#Can-I-take-derivatives-with-respect-to-the-limits-of-integration?" title="Permalink"></a></h2><p>Currently this is not implemented.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../solve/">« Common Solver Options (Solve Keyword Arguments)</a><a class="docs-footer-nextpage" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/basics/IntegralFunction/index.html b/dev/basics/IntegralFunction/index.html index 22f7dd0..ad65b53 100644 --- a/dev/basics/IntegralFunction/index.html +++ b/dev/basics/IntegralFunction/index.html @@ -1,3 +1,3 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Integral Functions · Integrals.jl</title><meta name="title" content="Integral Functions · Integrals.jl"/><meta property="og:title" content="Integral Functions · Integrals.jl"/><meta property="twitter:title" content="Integral Functions · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/basics/IntegralFunction/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/basics/IntegralFunction/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/basics/IntegralFunction/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../IntegralProblem/">Integral Problems</a></li><li class="is-active"><a class="tocitem" href>Integral Functions</a></li><li><a class="tocitem" href="../SampledIntegralProblem/">Integrating pre-sampled data</a></li><li><a class="tocitem" href="../solve/">Common Solver Options (Solve Keyword Arguments)</a></li><li><a class="tocitem" href="../FAQ/">Frequently Asked Questions</a></li></ul></li><li><span class="tocitem">Solvers</span><ul><li><a class="tocitem" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Basics</a></li><li class="is-active"><a href>Integral Functions</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Integral Functions</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/basics/IntegralFunction.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="func"><a class="docs-heading-anchor" href="#func">Integral Functions</a><a id="func-1"></a><a class="docs-heading-anchor-permalink" href="#func" title="Permalink"></a></h1><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SciMLBase.IntegralFunction" href="#SciMLBase.IntegralFunction"><code>SciMLBase.IntegralFunction</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">IntegralFunction{iip,specialize,F,T} <: AbstractIntegralFunction{iip}</code></pre><p>A representation of an integrand <code>f</code> defined by:</p><p class="math-container">\[f(u, p)\]</p><p>For an in-place form of <code>f</code> see the <code>iip</code> section below for details on in-place or out-of-place handling.</p><pre><code class="language-julia hljs">IntegralFunction{iip,specialize}(f, [integrand_prototype])</code></pre><p>Note that only <code>f</code> is required, and in the case of inplace integrands a mutable container <code>integrand_prototype</code> to store the result of the integrand. If <code>integrand_prototype</code> is present, <code>f</code> is interpreted as in-place, and otherwise <code>f</code> is assumed to be out-of-place.</p><p><strong>iip: In-Place vs Out-Of-Place</strong></p><p>Out-of-place functions must be of the form <span>$y = f(u, p)$</span> and in-place functions of the form <span>$f(y, u, p)$</span>, where <code>y</code> is a number or array containing the output. Since <code>f</code> is allowed to return any type (e.g. real or complex numbers or arrays), in-place functions must provide a container <code>integrand_prototype</code> that is of the right type and size for the variable <span>$y$</span>, and the result is written to this container in-place. When in-place forms are used, in-place array operations, i.e. broadcasting, may be used by algorithms to reduce allocations. If <code>integrand_prototype</code> is not provided, <code>f</code> is assumed to be out-of-place.</p><p><strong>specialize</strong></p><p>This field is currently unused</p><p><strong>Fields</strong></p><p>The fields of the IntegralFunction type directly match the names of the inputs.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/SciMLBase.jl/blob/v2.26.0/src/scimlfunctions.jl#L2068">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SciMLBase.BatchIntegralFunction" href="#SciMLBase.BatchIntegralFunction"><code>SciMLBase.BatchIntegralFunction</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">BatchIntegralFunction{iip,specialize,F,T} <: AbstractIntegralFunction{iip}</code></pre><p>A batched representation of an (non-batched) integrand <code>f(u, p)</code> that can be evaluated at multiple points simultaneously using threads, the gpu, or distributed memory defined by:</p><p class="math-container">\[by = bf(bu, p)\]</p><p>Here we prefix variables with <code>b</code> to indicate they are batched variables, which implies that they are arrays whose <strong>last</strong> dimension is reserved for batching different evaluation points, or function values, and may be of a variable length. <span>$bu$</span> is an array whose elements correspond to distinct evaluation points to <code>f</code>, and <code>bf</code> is a function to evaluate <code>f</code> 'point-wise' so that <code>f(bu[..., i], p) == bf(bu, p)[..., i]</code>. For example, a simple batching implementation of a scalar, univariate function is via broadcasting: <code>bf(bu, p) = f.(bu, Ref(p))</code>, although this interface exists in order to allow user parallelization. In general, the integration algorithm is allowed to vary the number of evaluation points between subsequent calls to <code>bf</code>.</p><p>For an in-place form of <code>bf</code> see the <code>iip</code> section below for details on in-place or out-of-place handling.</p><pre><code class="language-julia hljs">BatchIntegralFunction{iip,specialize}(bf, [integrand_prototype]; - max_batch=typemax(Int))</code></pre><p>Note that only <code>bf</code> is required, and in the case of inplace integrands a mutable container <code>integrand_prototype</code> to store a batch of integrand evaluations, with a last "batching" dimension.</p><p>The keyword <code>max_batch</code> is used to set a soft limit on the number of points to batch at the same time so that memory usage is controlled.</p><p>If <code>integrand_prototype</code> is present, <code>bf</code> is interpreted as in-place, and otherwise <code>bf</code> is assumed to be out-of-place.</p><p><strong>iip: In-Place vs Out-Of-Place</strong></p><p>Out-of-place functions must be of the form <code>by = bf(bu, p)</code> and in-place functions of the form <code>bf(by, bu, p)</code> where <code>by</code> is a batch array containing the output. Since the algorithm may vary the number of points to batch, the batching dimension can be of any length, including zero, and since <code>bf</code> is allowed to return arrays of any type (e.g. real or complex) or size, in-place functions must provide a container <code>integrand_prototype</code> of the desired type and size for <code>by</code>. If <code>integrand_prototype</code> is not provided, <code>bf</code> is assumed to be out-of-place.</p><p>In the out-of-place case, we require <code>f(bu[..., i], p) == bf(bu, p)[..., i]</code>, and certain algorithms, such as those implemented in C, may infer the type or shape of <code>by</code> by calling <code>bf</code> with an empty array of input points, i.e. <code>bu</code> with <code>size(bu)[end] == 0</code>. Then it is expected for the resulting <code>by</code> to have the same type and <code>size(by)[begin:end-1]</code> for all subsequent calls.</p><p>When the in-place form is used, we require <code>f(by[..., i], bu[..., i], p) == bf(by, bu, p)[..., i]</code> and <code>size(by)[begin:end-1] == size(integrand_prototype)[begin:end-1]</code>. The algorithm should always pass the integrand <code>by</code> arrays that are <code>similar</code> to <code>integrand_prototype</code>, and may use views and in-place array operations to reduce allocations.</p><p><strong>specialize</strong></p><p>This field is currently unused</p><p><strong>Fields</strong></p><p>The fields of the BatchIntegralFunction type are <code>f</code>, corresponding to <code>bf</code> above, and <code>integrand_prototype</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/SciMLBase.jl/blob/v2.26.0/src/scimlfunctions.jl#L2114">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../IntegralProblem/">« Integral Problems</a><a class="docs-footer-nextpage" href="../SampledIntegralProblem/">Integrating pre-sampled data »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Integral Functions · Integrals.jl</title><meta name="title" content="Integral Functions · Integrals.jl"/><meta property="og:title" content="Integral Functions · Integrals.jl"/><meta property="twitter:title" content="Integral Functions · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/basics/IntegralFunction/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/basics/IntegralFunction/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/basics/IntegralFunction/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../IntegralProblem/">Integral Problems</a></li><li class="is-active"><a class="tocitem" href>Integral Functions</a></li><li><a class="tocitem" href="../SampledIntegralProblem/">Integrating pre-sampled data</a></li><li><a class="tocitem" href="../solve/">Common Solver Options (Solve Keyword Arguments)</a></li><li><a class="tocitem" href="../FAQ/">Frequently Asked Questions</a></li></ul></li><li><span class="tocitem">Solvers</span><ul><li><a class="tocitem" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Basics</a></li><li class="is-active"><a href>Integral Functions</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Integral Functions</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/basics/IntegralFunction.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="func"><a class="docs-heading-anchor" href="#func">Integral Functions</a><a id="func-1"></a><a class="docs-heading-anchor-permalink" href="#func" title="Permalink"></a></h1><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SciMLBase.IntegralFunction" href="#SciMLBase.IntegralFunction"><code>SciMLBase.IntegralFunction</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">IntegralFunction{iip,specialize,F,T} <: AbstractIntegralFunction{iip}</code></pre><p>A representation of an integrand <code>f</code> defined by:</p><p class="math-container">\[f(u, p)\]</p><p>For an in-place form of <code>f</code> see the <code>iip</code> section below for details on in-place or out-of-place handling.</p><pre><code class="language-julia hljs">IntegralFunction{iip,specialize}(f, [integrand_prototype])</code></pre><p>Note that only <code>f</code> is required, and in the case of inplace integrands a mutable container <code>integrand_prototype</code> to store the result of the integrand. If <code>integrand_prototype</code> is present, <code>f</code> is interpreted as in-place, and otherwise <code>f</code> is assumed to be out-of-place.</p><p><strong>iip: In-Place vs Out-Of-Place</strong></p><p>Out-of-place functions must be of the form <span>$y = f(u, p)$</span> and in-place functions of the form <span>$f(y, u, p)$</span>, where <code>y</code> is a number or array containing the output. Since <code>f</code> is allowed to return any type (e.g. real or complex numbers or arrays), in-place functions must provide a container <code>integrand_prototype</code> that is of the right type and size for the variable <span>$y$</span>, and the result is written to this container in-place. When in-place forms are used, in-place array operations, i.e. broadcasting, may be used by algorithms to reduce allocations. If <code>integrand_prototype</code> is not provided, <code>f</code> is assumed to be out-of-place.</p><p><strong>specialize</strong></p><p>This field is currently unused</p><p><strong>Fields</strong></p><p>The fields of the IntegralFunction type directly match the names of the inputs.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/SciMLBase.jl/blob/v2.26.1/src/scimlfunctions.jl#L2068">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SciMLBase.BatchIntegralFunction" href="#SciMLBase.BatchIntegralFunction"><code>SciMLBase.BatchIntegralFunction</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">BatchIntegralFunction{iip,specialize,F,T} <: AbstractIntegralFunction{iip}</code></pre><p>A batched representation of an (non-batched) integrand <code>f(u, p)</code> that can be evaluated at multiple points simultaneously using threads, the gpu, or distributed memory defined by:</p><p class="math-container">\[by = bf(bu, p)\]</p><p>Here we prefix variables with <code>b</code> to indicate they are batched variables, which implies that they are arrays whose <strong>last</strong> dimension is reserved for batching different evaluation points, or function values, and may be of a variable length. <span>$bu$</span> is an array whose elements correspond to distinct evaluation points to <code>f</code>, and <code>bf</code> is a function to evaluate <code>f</code> 'point-wise' so that <code>f(bu[..., i], p) == bf(bu, p)[..., i]</code>. For example, a simple batching implementation of a scalar, univariate function is via broadcasting: <code>bf(bu, p) = f.(bu, Ref(p))</code>, although this interface exists in order to allow user parallelization. In general, the integration algorithm is allowed to vary the number of evaluation points between subsequent calls to <code>bf</code>.</p><p>For an in-place form of <code>bf</code> see the <code>iip</code> section below for details on in-place or out-of-place handling.</p><pre><code class="language-julia hljs">BatchIntegralFunction{iip,specialize}(bf, [integrand_prototype]; + max_batch=typemax(Int))</code></pre><p>Note that only <code>bf</code> is required, and in the case of inplace integrands a mutable container <code>integrand_prototype</code> to store a batch of integrand evaluations, with a last "batching" dimension.</p><p>The keyword <code>max_batch</code> is used to set a soft limit on the number of points to batch at the same time so that memory usage is controlled.</p><p>If <code>integrand_prototype</code> is present, <code>bf</code> is interpreted as in-place, and otherwise <code>bf</code> is assumed to be out-of-place.</p><p><strong>iip: In-Place vs Out-Of-Place</strong></p><p>Out-of-place functions must be of the form <code>by = bf(bu, p)</code> and in-place functions of the form <code>bf(by, bu, p)</code> where <code>by</code> is a batch array containing the output. Since the algorithm may vary the number of points to batch, the batching dimension can be of any length, including zero, and since <code>bf</code> is allowed to return arrays of any type (e.g. real or complex) or size, in-place functions must provide a container <code>integrand_prototype</code> of the desired type and size for <code>by</code>. If <code>integrand_prototype</code> is not provided, <code>bf</code> is assumed to be out-of-place.</p><p>In the out-of-place case, we require <code>f(bu[..., i], p) == bf(bu, p)[..., i]</code>, and certain algorithms, such as those implemented in C, may infer the type or shape of <code>by</code> by calling <code>bf</code> with an empty array of input points, i.e. <code>bu</code> with <code>size(bu)[end] == 0</code>. Then it is expected for the resulting <code>by</code> to have the same type and <code>size(by)[begin:end-1]</code> for all subsequent calls.</p><p>When the in-place form is used, we require <code>f(by[..., i], bu[..., i], p) == bf(by, bu, p)[..., i]</code> and <code>size(by)[begin:end-1] == size(integrand_prototype)[begin:end-1]</code>. The algorithm should always pass the integrand <code>by</code> arrays that are <code>similar</code> to <code>integrand_prototype</code>, and may use views and in-place array operations to reduce allocations.</p><p><strong>specialize</strong></p><p>This field is currently unused</p><p><strong>Fields</strong></p><p>The fields of the BatchIntegralFunction type are <code>f</code>, corresponding to <code>bf</code> above, and <code>integrand_prototype</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/SciMLBase.jl/blob/v2.26.1/src/scimlfunctions.jl#L2114">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../IntegralProblem/">« Integral Problems</a><a class="docs-footer-nextpage" href="../SampledIntegralProblem/">Integrating pre-sampled data »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/basics/IntegralProblem/index.html b/dev/basics/IntegralProblem/index.html index 26bb148..d1d1ad8 100644 --- a/dev/basics/IntegralProblem/index.html +++ b/dev/basics/IntegralProblem/index.html @@ -2,4 +2,4 @@ <html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Integral Problems · Integrals.jl</title><meta name="title" content="Integral Problems · Integrals.jl"/><meta property="og:title" content="Integral Problems · Integrals.jl"/><meta property="twitter:title" content="Integral Problems · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/basics/IntegralProblem/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/basics/IntegralProblem/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/basics/IntegralProblem/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li class="is-active"><a class="tocitem" href>Integral Problems</a></li><li><a class="tocitem" href="../IntegralFunction/">Integral Functions</a></li><li><a class="tocitem" href="../SampledIntegralProblem/">Integrating pre-sampled data</a></li><li><a class="tocitem" href="../solve/">Common Solver Options (Solve Keyword Arguments)</a></li><li><a class="tocitem" href="../FAQ/">Frequently Asked Questions</a></li></ul></li><li><span class="tocitem">Solvers</span><ul><li><a class="tocitem" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Basics</a></li><li class="is-active"><a href>Integral Problems</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Integral Problems</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/basics/IntegralProblem.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="prob"><a class="docs-heading-anchor" href="#prob">Integral Problems</a><a id="prob-1"></a><a class="docs-heading-anchor-permalink" href="#prob" title="Permalink"></a></h1><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SciMLBase.IntegralProblem" href="#SciMLBase.IntegralProblem"><code>SciMLBase.IntegralProblem</code></a> — <span class="docstring-category">Type</span></header><section><div><p>Defines an integral problem. Documentation Page: https://docs.sciml.ai/Integrals/stable/</p><p><strong>Mathematical Specification of an Integral Problem</strong></p><p>Integral problems are multi-dimensional integrals defined as:</p><p class="math-container">\[\int_{lb}^{ub} f(u,p) du\]</p><p>where <code>p</code> are parameters. <code>u</code> is a <code>Number</code> or <code>AbstractVector</code> whose geometry matches the space being integrated. This space is bounded by the lowerbound <code>lb</code> and upperbound <code>ub</code>, which are <code>Number</code>s or <code>AbstractVector</code>s with the same geometry as <code>u</code>.</p><p><strong>Problem Type</strong></p><p><strong>Constructors</strong></p><pre><code class="nohighlight hljs">IntegralProblem(f::AbstractIntegralFunction,domain,p=NullParameters(); kwargs...) IntegralProblem(f::AbstractIntegralFunction,lb,ub,p=NullParameters(); kwargs...) IntegralProblem(f,domain,p=NullParameters(); nout=nothing, batch=nothing, kwargs...) -IntegralProblem(f,lb,ub,p=NullParameters(); nout=nothing, batch=nothing, kwargs...)</code></pre><ul><li>f: the integrand, callable function <code>y = f(u,p)</code> for out-of-place (default) or an <code>IntegralFunction</code> or <code>BatchIntegralFunction</code> for inplace and batching optimizations.</li><li>domain: an object representing an integration domain, i.e. the tuple <code>(lb, ub)</code>.</li><li>lb: DEPRECATED: Either a number or vector of lower bounds.</li><li>ub: DEPRECATED: Either a number or vector of upper bounds.</li><li>p: The parameters associated with the problem.</li><li>nout: DEPRECATED (see <code>IntegralFunction</code>): length of the vector output of the integrand (by default the integrand is assumed to be scalar)</li><li>batch: DEPRECATED (see <code>BatchIntegralFunction</code>): number of points the integrand can evaluate simultaneously (by default there is no batching)</li><li>kwargs: Keyword arguments copied to the solvers.</li></ul><p>Additionally, we can supply iip like IntegralProblem{iip}(...) as true or false to declare at compile time whether the integrator function is in-place.</p><p><strong>Fields</strong></p><p>The fields match the names of the constructor arguments.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/SciMLBase.jl/blob/v2.26.0/src/problems/basic_problems.jl#L397">source</a></section></article><p>The correct shape of the variables (inputs) <code>u</code> and the values (outputs) <code>y</code> of the integrand <code>f</code> depends on whether batching is used.</p><p><strong>If <code>batch == 0</code></strong></p><table><tr><th style="text-align: left"></th><th style="text-align: left">single variable <code>f</code></th><th style="text-align: left">multiple variable <code>f</code></th></tr><tr><td style="text-align: left"><strong>scalar valued <code>f</code></strong></td><td style="text-align: left"><code>u</code> is a scalar, <code>y</code> is a scalar</td><td style="text-align: left"><code>u</code> is a vector, <code>y</code> is a scalar</td></tr><tr><td style="text-align: left"><strong>vector valued <code>f</code></strong></td><td style="text-align: left"><code>u</code> is a scalar, <code>y</code> is a vector</td><td style="text-align: left"><code>u</code> is a vector, <code>y</code> is a vector</td></tr></table><p><strong>If <code>batch > 0</code></strong></p><table><tr><th style="text-align: left"></th><th style="text-align: left">single variable <code>f</code></th><th style="text-align: left">multiple variable <code>f</code></th></tr><tr><td style="text-align: left"><strong>scalar valued <code>f</code></strong></td><td style="text-align: left"><code>u</code> is a vector, <code>y</code> is a vector</td><td style="text-align: left"><code>u</code> is a matrix, <code>y</code> is a vector</td></tr><tr><td style="text-align: left"><strong>vector valued <code>f</code></strong></td><td style="text-align: left"><code>u</code> is a vector, <code>y</code> is a matrix</td><td style="text-align: left"><code>u</code> is a matrix, <code>y</code> is a matrix</td></tr></table><p>The last dimension is always used as the batching dimension, e.g., if <code>u</code> is a matrix, then <code>u[:,i]</code> is the <code>i</code>th point where the integrand will be evaluated.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../tutorials/differentiating_integrals/">« Differentiating Integrals</a><a class="docs-footer-nextpage" href="../IntegralFunction/">Integral Functions »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +IntegralProblem(f,lb,ub,p=NullParameters(); nout=nothing, batch=nothing, kwargs...)</code></pre><ul><li>f: the integrand, callable function <code>y = f(u,p)</code> for out-of-place (default) or an <code>IntegralFunction</code> or <code>BatchIntegralFunction</code> for inplace and batching optimizations.</li><li>domain: an object representing an integration domain, i.e. the tuple <code>(lb, ub)</code>.</li><li>lb: DEPRECATED: Either a number or vector of lower bounds.</li><li>ub: DEPRECATED: Either a number or vector of upper bounds.</li><li>p: The parameters associated with the problem.</li><li>nout: DEPRECATED (see <code>IntegralFunction</code>): length of the vector output of the integrand (by default the integrand is assumed to be scalar)</li><li>batch: DEPRECATED (see <code>BatchIntegralFunction</code>): number of points the integrand can evaluate simultaneously (by default there is no batching)</li><li>kwargs: Keyword arguments copied to the solvers.</li></ul><p>Additionally, we can supply iip like IntegralProblem{iip}(...) as true or false to declare at compile time whether the integrator function is in-place.</p><p><strong>Fields</strong></p><p>The fields match the names of the constructor arguments.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/SciMLBase.jl/blob/v2.26.1/src/problems/basic_problems.jl#L397">source</a></section></article><p>The correct shape of the variables (inputs) <code>u</code> and the values (outputs) <code>y</code> of the integrand <code>f</code> depends on whether batching is used.</p><p><strong>If <code>batch == 0</code></strong></p><table><tr><th style="text-align: left"></th><th style="text-align: left">single variable <code>f</code></th><th style="text-align: left">multiple variable <code>f</code></th></tr><tr><td style="text-align: left"><strong>scalar valued <code>f</code></strong></td><td style="text-align: left"><code>u</code> is a scalar, <code>y</code> is a scalar</td><td style="text-align: left"><code>u</code> is a vector, <code>y</code> is a scalar</td></tr><tr><td style="text-align: left"><strong>vector valued <code>f</code></strong></td><td style="text-align: left"><code>u</code> is a scalar, <code>y</code> is a vector</td><td style="text-align: left"><code>u</code> is a vector, <code>y</code> is a vector</td></tr></table><p><strong>If <code>batch > 0</code></strong></p><table><tr><th style="text-align: left"></th><th style="text-align: left">single variable <code>f</code></th><th style="text-align: left">multiple variable <code>f</code></th></tr><tr><td style="text-align: left"><strong>scalar valued <code>f</code></strong></td><td style="text-align: left"><code>u</code> is a vector, <code>y</code> is a vector</td><td style="text-align: left"><code>u</code> is a matrix, <code>y</code> is a vector</td></tr><tr><td style="text-align: left"><strong>vector valued <code>f</code></strong></td><td style="text-align: left"><code>u</code> is a vector, <code>y</code> is a matrix</td><td style="text-align: left"><code>u</code> is a matrix, <code>y</code> is a matrix</td></tr></table><p>The last dimension is always used as the batching dimension, e.g., if <code>u</code> is a matrix, then <code>u[:,i]</code> is the <code>i</code>th point where the integrand will be evaluated.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../tutorials/differentiating_integrals/">« Differentiating Integrals</a><a class="docs-footer-nextpage" href="../IntegralFunction/">Integral Functions »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/basics/SampledIntegralProblem/index.html b/dev/basics/SampledIntegralProblem/index.html index 02b5e7d..8eb49c3 100644 --- a/dev/basics/SampledIntegralProblem/index.html +++ b/dev/basics/SampledIntegralProblem/index.html @@ -24,13 +24,13 @@ 1.0</code></pre><p>Now, we can integrate this data set as follows:</p><pre><code class="language-julia hljs">problem = SampledIntegralProblem(y, x) method = TrapezoidalRule() solve(problem, method)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">retcode: Success -u: 0.33379501385041543</code></pre><p>The exact answer is of course <span>$</span> 1/3 <span>$</span>.</p><h2 id="Details"><a class="docs-heading-anchor" href="#Details">Details</a><a id="Details-1"></a><a class="docs-heading-anchor-permalink" href="#Details" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SciMLBase.SampledIntegralProblem" href="#SciMLBase.SampledIntegralProblem"><code>SciMLBase.SampledIntegralProblem</code></a> — <span class="docstring-category">Type</span></header><section><div><p>Defines a integral problem over pre-sampled data. Documentation Page: https://docs.sciml.ai/Integrals/stable/</p><p><strong>Mathematical Specification of a data Integral Problem</strong></p><p>Sampled integral problems are defined as:</p><p class="math-container">\[\sum_i w_i y_i\]</p><p>where <code>y_i</code> are sampled values of the integrand, and <code>w_i</code> are weights assigned by a quadrature rule, which depend on sampling points <code>x</code>.</p><p><strong>Problem Type</strong></p><p><strong>Constructors</strong></p><pre><code class="nohighlight hljs">SampledIntegralProblem(y::AbstractArray, x::AbstractVector; dim=ndims(y), kwargs...)</code></pre><ul><li>y: The sampled integrand, must be a subtype of <code>AbstractArray</code>. It is assumed that the values of <code>y</code> along dimension <code>dim</code> correspond to the integrand evaluated at sampling points <code>x</code></li><li>x: Sampling points, must be a subtype of <code>AbstractVector</code>.</li><li>dim: Dimension along which to integrate. Defaults to the last dimension of <code>y</code>.</li><li>kwargs: Keyword arguments copied to the solvers.</li></ul><p><strong>Fields</strong></p><p>The fields match the names of the constructor arguments.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/SciMLBase.jl/blob/v2.26.0/src/problems/basic_problems.jl#L515">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="CommonSolve.solve-Tuple{SampledIntegralProblem, SciMLBase.AbstractIntegralAlgorithm}" href="#CommonSolve.solve-Tuple{SampledIntegralProblem, SciMLBase.AbstractIntegralAlgorithm}"><code>CommonSolve.solve</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">solve(prob::SampledIntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)</code></pre><p><strong>Keyword Arguments</strong></p><p>There are no keyword arguments used to solve <code>SampledIntegralProblem</code>s</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/common.jl#L155-L163">source</a></section></article><h3 id="Non-equidistant-grids"><a class="docs-heading-anchor" href="#Non-equidistant-grids">Non-equidistant grids</a><a id="Non-equidistant-grids-1"></a><a class="docs-heading-anchor-permalink" href="#Non-equidistant-grids" title="Permalink"></a></h3><p>If the sampling points <code>x</code> are provided as an <code>AbstractRange</code> (constructed with the <code>range</code> function for example), faster methods are used that take advantage of the fact that the points are equidistantly spaced. Otherwise, general methods are used for non-uniform grids.</p><p>Example:</p><pre><code class="language-julia hljs">f = x -> x^7 +u: 0.33379501385041543</code></pre><p>The exact answer is of course <span>$</span> 1/3 <span>$</span>.</p><h2 id="Details"><a class="docs-heading-anchor" href="#Details">Details</a><a id="Details-1"></a><a class="docs-heading-anchor-permalink" href="#Details" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SciMLBase.SampledIntegralProblem" href="#SciMLBase.SampledIntegralProblem"><code>SciMLBase.SampledIntegralProblem</code></a> — <span class="docstring-category">Type</span></header><section><div><p>Defines a integral problem over pre-sampled data. Documentation Page: https://docs.sciml.ai/Integrals/stable/</p><p><strong>Mathematical Specification of a data Integral Problem</strong></p><p>Sampled integral problems are defined as:</p><p class="math-container">\[\sum_i w_i y_i\]</p><p>where <code>y_i</code> are sampled values of the integrand, and <code>w_i</code> are weights assigned by a quadrature rule, which depend on sampling points <code>x</code>.</p><p><strong>Problem Type</strong></p><p><strong>Constructors</strong></p><pre><code class="nohighlight hljs">SampledIntegralProblem(y::AbstractArray, x::AbstractVector; dim=ndims(y), kwargs...)</code></pre><ul><li>y: The sampled integrand, must be a subtype of <code>AbstractArray</code>. It is assumed that the values of <code>y</code> along dimension <code>dim</code> correspond to the integrand evaluated at sampling points <code>x</code></li><li>x: Sampling points, must be a subtype of <code>AbstractVector</code>.</li><li>dim: Dimension along which to integrate. Defaults to the last dimension of <code>y</code>.</li><li>kwargs: Keyword arguments copied to the solvers.</li></ul><p><strong>Fields</strong></p><p>The fields match the names of the constructor arguments.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/SciMLBase.jl/blob/v2.26.1/src/problems/basic_problems.jl#L515">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="CommonSolve.solve-Tuple{SampledIntegralProblem, SciMLBase.AbstractIntegralAlgorithm}" href="#CommonSolve.solve-Tuple{SampledIntegralProblem, SciMLBase.AbstractIntegralAlgorithm}"><code>CommonSolve.solve</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">solve(prob::SampledIntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)</code></pre><p><strong>Keyword Arguments</strong></p><p>There are no keyword arguments used to solve <code>SampledIntegralProblem</code>s</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/common.jl#L155-L163">source</a></section></article><h3 id="Non-equidistant-grids"><a class="docs-heading-anchor" href="#Non-equidistant-grids">Non-equidistant grids</a><a id="Non-equidistant-grids-1"></a><a class="docs-heading-anchor-permalink" href="#Non-equidistant-grids" title="Permalink"></a></h3><p>If the sampling points <code>x</code> are provided as an <code>AbstractRange</code> (constructed with the <code>range</code> function for example), faster methods are used that take advantage of the fact that the points are equidistantly spaced. Otherwise, general methods are used for non-uniform grids.</p><p>Example:</p><pre><code class="language-julia hljs">f = x -> x^7 x = [0.0; sort(rand(1000)); 1.0] y = f.(x) problem = SampledIntegralProblem(y, x) method = TrapezoidalRule() solve(problem, method)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">retcode: Success -u: 0.12500306514378107</code></pre><h3 id="Evaluating-multiple-integrals-at-once"><a class="docs-heading-anchor" href="#Evaluating-multiple-integrals-at-once">Evaluating multiple integrals at once</a><a id="Evaluating-multiple-integrals-at-once-1"></a><a class="docs-heading-anchor-permalink" href="#Evaluating-multiple-integrals-at-once" title="Permalink"></a></h3><p>If the provided data set <code>y</code> is a multidimensional array, the integrals are evaluated across only one of its axes. For performance reasons, the last axis of the array <code>y</code> is chosen by default, but this can be modified with the <code>dim</code> keyword argument to the problem definition.</p><pre><code class="language-julia hljs">f1 = x -> x^2 +u: 0.12500272117860228</code></pre><h3 id="Evaluating-multiple-integrals-at-once"><a class="docs-heading-anchor" href="#Evaluating-multiple-integrals-at-once">Evaluating multiple integrals at once</a><a id="Evaluating-multiple-integrals-at-once-1"></a><a class="docs-heading-anchor-permalink" href="#Evaluating-multiple-integrals-at-once" title="Permalink"></a></h3><p>If the provided data set <code>y</code> is a multidimensional array, the integrals are evaluated across only one of its axes. For performance reasons, the last axis of the array <code>y</code> is chosen by default, but this can be modified with the <code>dim</code> keyword argument to the problem definition.</p><pre><code class="language-julia hljs">f1 = x -> x^2 f2 = x -> x^3 f3 = x -> x^4 x = range(0, 1, length=20) @@ -47,10 +47,10 @@ y = f.(x) problem = SampledIntegralProblem(y, x) method = TrapezoidalRule() -solve(problem, method)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L130-L147">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.SimpsonsRule" href="#Integrals.SimpsonsRule"><code>Integrals.SimpsonsRule</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">SimpsonsRule</code></pre><p>Struct for evaluating an integral via the Simpson's composite 1/3-3/8 rule over <code>AbstractRange</code>s (evenly spaced points) and Simpson's composite 1/3 rule for non-equidistant grids.</p><p>Example with equidistant data:</p><pre><code class="nohighlight hljs">using Integrals +solve(problem, method)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_sampled.jl#L3-L20">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.SimpsonsRule" href="#Integrals.SimpsonsRule"><code>Integrals.SimpsonsRule</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">SimpsonsRule</code></pre><p>Struct for evaluating an integral via the Simpson's composite 1/3-3/8 rule over <code>AbstractRange</code>s (evenly spaced points) and Simpson's composite 1/3 rule for non-equidistant grids.</p><p>Example with equidistant data:</p><pre><code class="nohighlight hljs">using Integrals f = x -> x^2 x = range(0, 1, length=20) y = f.(x) problem = SampledIntegralProblem(y, x) method = SimpsonsRule() -solve(problem, method)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L151-L170">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../IntegralFunction/">« Integral Functions</a><a class="docs-footer-nextpage" href="../solve/">Common Solver Options (Solve Keyword Arguments) »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +solve(problem, method)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_sampled.jl#L23-L42">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../IntegralFunction/">« Integral Functions</a><a class="docs-footer-nextpage" href="../solve/">Common Solver Options (Solve Keyword Arguments) »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/basics/solve/index.html b/dev/basics/solve/index.html index 3fb3045..dcc3959 100644 --- a/dev/basics/solve/index.html +++ b/dev/basics/solve/index.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Common Solver Options (Solve Keyword Arguments) · Integrals.jl</title><meta name="title" content="Common Solver Options (Solve Keyword Arguments) · Integrals.jl"/><meta property="og:title" content="Common Solver Options (Solve Keyword Arguments) · Integrals.jl"/><meta property="twitter:title" content="Common Solver Options (Solve Keyword Arguments) · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/basics/solve/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/basics/solve/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/basics/solve/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../IntegralProblem/">Integral Problems</a></li><li><a class="tocitem" href="../IntegralFunction/">Integral Functions</a></li><li><a class="tocitem" href="../SampledIntegralProblem/">Integrating pre-sampled data</a></li><li class="is-active"><a class="tocitem" href>Common Solver Options (Solve Keyword Arguments)</a></li><li><a class="tocitem" href="../FAQ/">Frequently Asked Questions</a></li></ul></li><li><span class="tocitem">Solvers</span><ul><li><a class="tocitem" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Basics</a></li><li class="is-active"><a href>Common Solver Options (Solve Keyword Arguments)</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Common Solver Options (Solve Keyword Arguments)</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/basics/solve.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Common-Solver-Options-(Solve-Keyword-Arguments)"><a class="docs-heading-anchor" href="#Common-Solver-Options-(Solve-Keyword-Arguments)">Common Solver Options (Solve Keyword Arguments)</a><a id="Common-Solver-Options-(Solve-Keyword-Arguments)-1"></a><a class="docs-heading-anchor-permalink" href="#Common-Solver-Options-(Solve-Keyword-Arguments)" title="Permalink"></a></h1><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="CommonSolve.solve-Tuple{IntegralProblem, SciMLBase.AbstractIntegralAlgorithm}" href="#CommonSolve.solve-Tuple{IntegralProblem, SciMLBase.AbstractIntegralAlgorithm}"><code>CommonSolve.solve</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">solve(prob::IntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)</code></pre><p><strong>Keyword Arguments</strong></p><p>The arguments to <code>solve</code> are common across all of the quadrature methods. These common arguments are:</p><ul><li><code>maxiters</code> (the maximum number of iterations)</li><li><code>abstol</code> (absolute tolerance in changes of the objective value)</li><li><code>reltol</code> (relative tolerance in changes of the objective value)</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/common.jl#L84-L97">source</a></section></article><p>Additionally, the extra keyword arguments are splatted to the library calls, so see the documentation of the integrator library for all the extra details. These extra keyword arguments are not guaranteed to act uniformly.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../SampledIntegralProblem/">« Integrating pre-sampled data</a><a class="docs-footer-nextpage" href="../FAQ/">Frequently Asked Questions »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Common Solver Options (Solve Keyword Arguments) · Integrals.jl</title><meta name="title" content="Common Solver Options (Solve Keyword Arguments) · Integrals.jl"/><meta property="og:title" content="Common Solver Options (Solve Keyword Arguments) · Integrals.jl"/><meta property="twitter:title" content="Common Solver Options (Solve Keyword Arguments) · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/basics/solve/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/basics/solve/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/basics/solve/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../IntegralProblem/">Integral Problems</a></li><li><a class="tocitem" href="../IntegralFunction/">Integral Functions</a></li><li><a class="tocitem" href="../SampledIntegralProblem/">Integrating pre-sampled data</a></li><li class="is-active"><a class="tocitem" href>Common Solver Options (Solve Keyword Arguments)</a></li><li><a class="tocitem" href="../FAQ/">Frequently Asked Questions</a></li></ul></li><li><span class="tocitem">Solvers</span><ul><li><a class="tocitem" href="../../solvers/IntegralSolvers/">Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Basics</a></li><li class="is-active"><a href>Common Solver Options (Solve Keyword Arguments)</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Common Solver Options (Solve Keyword Arguments)</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/basics/solve.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Common-Solver-Options-(Solve-Keyword-Arguments)"><a class="docs-heading-anchor" href="#Common-Solver-Options-(Solve-Keyword-Arguments)">Common Solver Options (Solve Keyword Arguments)</a><a id="Common-Solver-Options-(Solve-Keyword-Arguments)-1"></a><a class="docs-heading-anchor-permalink" href="#Common-Solver-Options-(Solve-Keyword-Arguments)" title="Permalink"></a></h1><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="CommonSolve.solve-Tuple{IntegralProblem, SciMLBase.AbstractIntegralAlgorithm}" href="#CommonSolve.solve-Tuple{IntegralProblem, SciMLBase.AbstractIntegralAlgorithm}"><code>CommonSolve.solve</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">solve(prob::IntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)</code></pre><p><strong>Keyword Arguments</strong></p><p>The arguments to <code>solve</code> are common across all of the quadrature methods. These common arguments are:</p><ul><li><code>maxiters</code> (the maximum number of iterations)</li><li><code>abstol</code> (absolute tolerance in changes of the objective value)</li><li><code>reltol</code> (relative tolerance in changes of the objective value)</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/common.jl#L84-L97">source</a></section></article><p>Additionally, the extra keyword arguments are splatted to the library calls, so see the documentation of the integrator library for all the extra details. These extra keyword arguments are not guaranteed to act uniformly.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../SampledIntegralProblem/">« Integrating pre-sampled data</a><a class="docs-footer-nextpage" href="../FAQ/">Frequently Asked Questions »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/index.html b/dev/index.html index 4048dff..fbdcd79 100644 --- a/dev/index.html +++ b/dev/index.html @@ -74,7 +74,7 @@ [73f95e8e] LatticeRules v0.0.1 [0e77f7df] LazilyInitializedFields v1.2.2 [50d2b5c4] Lazy v0.15.1 - [2ab3a3ac] LogExpFunctions v0.3.26 + [2ab3a3ac] LogExpFunctions v0.3.27 [1914dd2f] MacroTools v0.5.13 [d0879d2d] MarkdownAST v0.1.2 [e1d29d7a] Missings v1.1.0 @@ -96,7 +96,7 @@ [ae029012] Requires v1.3.0 [79098fc4] Rmath v0.7.1 [7e49a35a] RuntimeGeneratedFunctions v0.5.12 - [0bca4576] SciMLBase v2.26.0 + [0bca4576] SciMLBase v2.26.1 [c0aeaf25] SciMLOperators v0.3.7 [efcf1570] Setfield v1.1.1 [ed01d8cd] Sobol v1.5.0 @@ -171,4 +171,4 @@ [83775a58] Zlib_jll v1.2.13+1 [8e850b90] libblastrampoline_jll v5.8.0+1 [8e850ede] nghttp2_jll v1.52.0+1 - [3f19e933] p7zip_jll v17.4.0+2</code></pre></details><p>You can also download the <a href="https://github.com/SciML/Integrals.jl/tree/gh-pages/v4.3.0/assets/Manifest.toml">manifest</a> file and the <a href="https://github.com/SciML/Integrals.jl/tree/gh-pages/v4.3.0/assets/Project.toml">project</a> file.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="tutorials/numerical_integrals/">Numerically Solving Integrals »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> + [3f19e933] p7zip_jll v17.4.0+2</code></pre></details><p>You can also download the <a href="https://github.com/SciML/Integrals.jl/tree/gh-pages/v4.3.0/assets/Manifest.toml">manifest</a> file and the <a href="https://github.com/SciML/Integrals.jl/tree/gh-pages/v4.3.0/assets/Project.toml">project</a> file.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="tutorials/numerical_integrals/">Numerically Solving Integrals »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/search_index.js b/dev/search_index.js index 684597e..e49cbcd 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"basics/SampledIntegralProblem/#Integrating-pre-sampled-data","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"In some cases, instead of a function that acts as integrand, one only possesses a list of data points y at a set of sampling locations x, that must be integrated. This package contains functionality for doing that.","category":"page"},{"location":"basics/SampledIntegralProblem/#Example","page":"Integrating pre-sampled data","title":"Example","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"Say, by some means we have generated a dataset x and y:","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"using Integrals # hide\nf = x -> x^2\nx = range(0, 1, length=20)\ny = f.(x)","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"Now, we can integrate this data set as follows:","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"problem = SampledIntegralProblem(y, x)\nmethod = TrapezoidalRule()\nsolve(problem, method)","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"The exact answer is of course $ 1/3 $.","category":"page"},{"location":"basics/SampledIntegralProblem/#Details","page":"Integrating pre-sampled data","title":"Details","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"SciMLBase.SampledIntegralProblem\nsolve(::SampledIntegralProblem, ::SciMLBase.AbstractIntegralAlgorithm)","category":"page"},{"location":"basics/SampledIntegralProblem/#SciMLBase.SampledIntegralProblem","page":"Integrating pre-sampled data","title":"SciMLBase.SampledIntegralProblem","text":"Defines a integral problem over pre-sampled data. Documentation Page: https://docs.sciml.ai/Integrals/stable/\n\nMathematical Specification of a data Integral Problem\n\nSampled integral problems are defined as:\n\nsum_i w_i y_i\n\nwhere y_i are sampled values of the integrand, and w_i are weights assigned by a quadrature rule, which depend on sampling points x.\n\nProblem Type\n\nConstructors\n\nSampledIntegralProblem(y::AbstractArray, x::AbstractVector; dim=ndims(y), kwargs...)\n\ny: The sampled integrand, must be a subtype of AbstractArray. It is assumed that the values of y along dimension dim correspond to the integrand evaluated at sampling points x\nx: Sampling points, must be a subtype of AbstractVector.\ndim: Dimension along which to integrate. Defaults to the last dimension of y.\nkwargs: Keyword arguments copied to the solvers.\n\nFields\n\nThe fields match the names of the constructor arguments.\n\n\n\n\n\n","category":"type"},{"location":"basics/SampledIntegralProblem/#CommonSolve.solve-Tuple{SampledIntegralProblem, SciMLBase.AbstractIntegralAlgorithm}","page":"Integrating pre-sampled data","title":"CommonSolve.solve","text":"solve(prob::SampledIntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)\n\nKeyword Arguments\n\nThere are no keyword arguments used to solve SampledIntegralProblems\n\n\n\n\n\n","category":"method"},{"location":"basics/SampledIntegralProblem/#Non-equidistant-grids","page":"Integrating pre-sampled data","title":"Non-equidistant grids","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"If the sampling points x are provided as an AbstractRange (constructed with the range function for example), faster methods are used that take advantage of the fact that the points are equidistantly spaced. Otherwise, general methods are used for non-uniform grids.","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"Example:","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"using Integrals # hide\nf = x -> x^7\nx = [0.0; sort(rand(1000)); 1.0]\ny = f.(x)\nproblem = SampledIntegralProblem(y, x)\nmethod = TrapezoidalRule()\nsolve(problem, method)","category":"page"},{"location":"basics/SampledIntegralProblem/#Evaluating-multiple-integrals-at-once","page":"Integrating pre-sampled data","title":"Evaluating multiple integrals at once","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"If the provided data set y is a multidimensional array, the integrals are evaluated across only one of its axes. For performance reasons, the last axis of the array y is chosen by default, but this can be modified with the dim keyword argument to the problem definition.","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"using Integrals # hide\nf1 = x -> x^2\nf2 = x -> x^3\nf3 = x -> x^4\nx = range(0, 1, length=20)\ny = [f1.(x) f2.(x) f3.(x)]\nproblem = SampledIntegralProblem(y, x; dim=1)\nmethod = SimpsonsRule()\nsolve(problem, method)","category":"page"},{"location":"basics/SampledIntegralProblem/#Supported-methods","page":"Integrating pre-sampled data","title":"Supported methods","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"Right now, only the TrapezoidalRule and SimpsonsRule are supported.","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"TrapezoidalRule\nSimpsonsRule","category":"page"},{"location":"basics/SampledIntegralProblem/#Integrals.TrapezoidalRule","page":"Integrating pre-sampled data","title":"Integrals.TrapezoidalRule","text":"TrapezoidalRule\n\nStruct for evaluating an integral via the trapezoidal rule.\n\nExample with sampled data:\n\nusing Integrals\nf = x -> x^2\nx = range(0, 1, length=20)\ny = f.(x)\nproblem = SampledIntegralProblem(y, x)\nmethod = TrapezoidalRule()\nsolve(problem, method)\n\n\n\n\n\n","category":"type"},{"location":"basics/SampledIntegralProblem/#Integrals.SimpsonsRule","page":"Integrating pre-sampled data","title":"Integrals.SimpsonsRule","text":"SimpsonsRule\n\nStruct for evaluating an integral via the Simpson's composite 1/3-3/8 rule over AbstractRanges (evenly spaced points) and Simpson's composite 1/3 rule for non-equidistant grids.\n\nExample with equidistant data:\n\nusing Integrals \nf = x -> x^2\nx = range(0, 1, length=20)\ny = f.(x)\nproblem = SampledIntegralProblem(y, x)\nmethod = SimpsonsRule()\nsolve(problem, method)\n\n\n\n\n\n","category":"type"},{"location":"tutorials/caching_interface/#Integrals-with-Caching-Interface","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"","category":"section"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"Often, integral solvers allocate memory or reuse quadrature rules for solving different problems. For example, if one is going to solve the same integral for several parameters","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using Integrals\n\nprob = IntegralProblem((x, p) -> sin(x * p), (0, 1), 14.0)\nalg = QuadGKJL()\n\nsolve(prob, alg)\n\nprob = remake(prob, p = 15.0)\nsolve(prob, alg)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"then it would be more efficient to allocate the heap used by quadgk across several calls, shown below by directly calling the library","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using QuadGK\nsegbuf = QuadGK.alloc_segbuf()\nquadgk(x -> sin(14x), 0, 1, segbuf = segbuf)\nquadgk(x -> sin(15x), 0, 1, segbuf = segbuf)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"Integrals.jl's caching interface automates this process to reuse resources if an algorithm supports it and if the necessary types to build the cache can be inferred from prob. To do this with Integrals.jl, you simply init a cache, solve!, replace p, and solve again. This uses the SciML init interface","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using Integrals\n\nprob = IntegralProblem((x, p) -> sin(x * p), (0, 1), 14.0)\nalg = QuadGKJL()\n\ncache = init(prob, alg)\nsol1 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"cache.p = 15.0\nsol2 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"The caching interface is intended for updating p and domain. Note that the types of these variables is not allowed to change. If it is necessary to change the integrand f instead of defining a new IntegralProblem, consider using FunctionWrappers.jl.","category":"page"},{"location":"tutorials/caching_interface/#Caching-for-sampled-integral-problems","page":"Integrals with Caching Interface","title":"Caching for sampled integral problems","text":"","category":"section"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"For sampled integral problems, it is possible to cache the weights and reuse them for multiple data sets.","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using Integrals\n\nx = 0.0:0.1:1.0\ny = sin.(x)\n\nprob = SampledIntegralProblem(y, x)\nalg = TrapezoidalRule()\n\ncache = init(prob, alg)\nsol1 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"cache.y = cos.(x) # use .= to update in-place\nsol2 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"If the grid is modified, the weights are recomputed.","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"cache.x = 0.0:0.2:2.0\ncache.y = sin.(cache.x)\nsol3 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"For multi-dimensional datasets, the integration dimension can also be changed","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using Integrals\n\nx = 0.0:0.1:1.0\ny = sin.(x) .* cos.(x')\n\nprob = SampledIntegralProblem(y, x)\nalg = TrapezoidalRule()\n\ncache = init(prob, alg)\nsol1 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"cache.dim = 1\nsol2 = solve!(cache)","category":"page"},{"location":"tutorials/numerical_integrals/#Numerically-Solving-Integrals","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"","category":"section"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"For basic multidimensional quadrature, we can construct and solve a IntegralProblem. The integral we want to evaluate is:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"int_1^3int_1^3int_1^3 sum_1^3 sin(u_i) du_1du_2du_3","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"We can numerically approximate this integral:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals\nf(u, p) = sum(sin.(u))\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(f, domain)\nsol = solve(prob, HCubatureJL(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"where the first argument of IntegralProblem is the integrand, the second argument is the lower bound, and the third argument is the upper bound. p are the parameters of the integrand. In this case, there are no parameters, but still f must be defined as f(x,p) and not f(x). For an example with parameters, see the next tutorial. The first argument of solve is the problem we are solving, the second is an algorithm to solve the problem with. Then there are keywords which provides details how the algorithm should work, in this case tolerances how precise the numerical approximation should be.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"We can also evaluate multiple integrals at once. We could create two IntegralProblems for this, but that is wasteful if the integrands share a lot of computation. For example, we also want to evaluate:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"int_1^3int_1^3int_1^3 sum_1^3 cos(u_i) du_1du_2du_3","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals\nf(u, p) = [sum(sin.(u)), sum(cos.(u))]\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(f, domain)\nsol = solve(prob, HCubatureJL(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Another way to think about this is that the integrand is now a vector valued function. In general, we should be able to integrate any type that is in a vector space and supports addition and scalar multiplication, although Integrals.jl allows scalars and arrays. In the above example, the integrand was defined out-of-position. This means that a new output vector is created every time the function f is called. If we do not want these allocations, we can also define f in-position.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals, Cubature\nfunction f(y, u, p)\n y[1] = sum(sin.(u))\n y[2] = sum(cos.(u))\nend\nprototype = zeros(2)\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(IntegralFunction(f, prototype), domain)\nsol = solve(prob, CubatureJLh(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"where y is a cache to store the evaluation of the integrand and prototype is an instance of y with the desired type and shape. We needed to change the algorithm to CubatureJLh() because HCubatureJL() does not support in-position under the hood. f evaluates the integrand at a certain point, but most adaptive quadrature algorithms need to evaluate the integrand at multiple points in each step of the algorithm. We would thus often like to parallelize the computation. The batch interface allows us to compute multiple points at once. For example, here we do allocation-free multithreading with Cubature.jl:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals, Cubature, Base.Threads\nfunction f(y, u, p)\n Threads.@threads for i in 1:size(u, 2)\n y[1, i] = sum(sin, @view(u[:, i]))\n y[2, i] = sum(cos, @view(u[:, i]))\n end\nend\nprototype = zeros(2, 0)\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(BatchIntegralFunction(f, prototype), domain)\nsol = solve(prob, CubatureJLh(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Both u and y changed from vectors to matrices, where each column is respectively a point the integrand is evaluated at or the evaluation of the integrand at the corresponding point. The prototype now has an extra dimension for batching that can be of size zero. Try to create yourself an out-of-position version of the above problem. For the full details of the batching interface, see the problem page.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"If we would like to compare the results against Cuba.jl's Cuhre method, then the change is a one-argument change:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals\nusing Cuba\nf(u, p) = sum(sin.(u))\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(f, domain)\nsol = solve(prob, CubaCuhre(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"However, Cuhre does not support vector valued integrands. The solvers page gives an overview of which arguments each algorithm can handle.","category":"page"},{"location":"tutorials/numerical_integrals/#One-dimensional-integrals","page":"Numerically Solving Integrals","title":"One-dimensional integrals","text":"","category":"section"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Integrals.jl also has specific solvers for integrals in a single dimension, such as QuadGKJL. For example, we can create our own sine function by integrating the cosine function from 0 to x.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals\nmy_sin(x) = solve(IntegralProblem((x, p) -> cos(x), (0.0, x)), QuadGKJL()).u\nx = 0:0.1:(2 * pi)\n@. my_sin(x) ≈ sin(x)","category":"page"},{"location":"tutorials/numerical_integrals/#Infinity-handling","page":"Numerically Solving Integrals","title":"Infinity handling","text":"","category":"section"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Integrals.jl can also handle infinite integration bounds. For infinite upper bounds u is substituted with a+fract1-t, and the integral is thus transformed to:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"int_a^infty f(u)du = int_0^1 fleft(a+fract1-tright)frac1(1-t)^2dt","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Integrals with an infinite lower bound are handled in the same way. If both upper and lower bound are infinite, u is substituted with fract1-t^2,","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"int_-infty^infty f(u)du = int_-1^1 fleft(fract1-t^2right)frac1+t^2(1-t^2)^2dt","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"For multidimensional integrals, each variable with infinite bounds is substituted the same way. The details of the math behind these transforms can be found here.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"As an example, let us integrate the standard bivariate normal probability distribution over the area above the horizontal axis, which should be equal to 05.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Distributions\nusing Integrals\ndist = MvNormal(ones(2))\nf = (x, p) -> pdf(dist, x)\ndomain = ([-Inf, 0.0], [Inf, Inf]) # (lb, ub)\nprob = IntegralProblem(f, domain)\nsolve(prob, HCubatureJL(), reltol = 1e-3, abstol = 1e-3)","category":"page"},{"location":"basics/IntegralProblem/#prob","page":"Integral Problems","title":"Integral Problems","text":"","category":"section"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"SciMLBase.IntegralProblem","category":"page"},{"location":"basics/IntegralProblem/#SciMLBase.IntegralProblem","page":"Integral Problems","title":"SciMLBase.IntegralProblem","text":"Defines an integral problem. Documentation Page: https://docs.sciml.ai/Integrals/stable/\n\nMathematical Specification of an Integral Problem\n\nIntegral problems are multi-dimensional integrals defined as:\n\nint_lb^ub f(up) du\n\nwhere p are parameters. u is a Number or AbstractVector whose geometry matches the space being integrated. This space is bounded by the lowerbound lb and upperbound ub, which are Numbers or AbstractVectors with the same geometry as u.\n\nProblem Type\n\nConstructors\n\nIntegralProblem(f::AbstractIntegralFunction,domain,p=NullParameters(); kwargs...)\nIntegralProblem(f::AbstractIntegralFunction,lb,ub,p=NullParameters(); kwargs...)\nIntegralProblem(f,domain,p=NullParameters(); nout=nothing, batch=nothing, kwargs...)\nIntegralProblem(f,lb,ub,p=NullParameters(); nout=nothing, batch=nothing, kwargs...)\n\nf: the integrand, callable function y = f(u,p) for out-of-place (default) or an IntegralFunction or BatchIntegralFunction for inplace and batching optimizations.\ndomain: an object representing an integration domain, i.e. the tuple (lb, ub).\nlb: DEPRECATED: Either a number or vector of lower bounds.\nub: DEPRECATED: Either a number or vector of upper bounds.\np: The parameters associated with the problem.\nnout: DEPRECATED (see IntegralFunction): length of the vector output of the integrand (by default the integrand is assumed to be scalar)\nbatch: DEPRECATED (see BatchIntegralFunction): number of points the integrand can evaluate simultaneously (by default there is no batching)\nkwargs: Keyword arguments copied to the solvers.\n\nAdditionally, we can supply iip like IntegralProblem{iip}(...) as true or false to declare at compile time whether the integrator function is in-place.\n\nFields\n\nThe fields match the names of the constructor arguments.\n\n\n\n\n\n","category":"type"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"The correct shape of the variables (inputs) u and the values (outputs) y of the integrand f depends on whether batching is used.","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"If batch == 0","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":" single variable f multiple variable f\nscalar valued f u is a scalar, y is a scalar u is a vector, y is a scalar\nvector valued f u is a scalar, y is a vector u is a vector, y is a vector","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"If batch > 0","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":" single variable f multiple variable f\nscalar valued f u is a vector, y is a vector u is a matrix, y is a vector\nvector valued f u is a vector, y is a matrix u is a matrix, y is a matrix","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"The last dimension is always used as the batching dimension, e.g., if u is a matrix, then u[:,i] is the ith point where the integrand will be evaluated.","category":"page"},{"location":"basics/solve/#Common-Solver-Options-(Solve-Keyword-Arguments)","page":"Common Solver Options (Solve Keyword Arguments)","title":"Common Solver Options (Solve Keyword Arguments)","text":"","category":"section"},{"location":"basics/solve/","page":"Common Solver Options (Solve Keyword Arguments)","title":"Common Solver Options (Solve Keyword Arguments)","text":"solve(prob::IntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm)","category":"page"},{"location":"basics/solve/#CommonSolve.solve-Tuple{IntegralProblem, SciMLBase.AbstractIntegralAlgorithm}","page":"Common Solver Options (Solve Keyword Arguments)","title":"CommonSolve.solve","text":"solve(prob::IntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)\n\nKeyword Arguments\n\nThe arguments to solve are common across all of the quadrature methods. These common arguments are:\n\nmaxiters (the maximum number of iterations)\nabstol (absolute tolerance in changes of the objective value)\nreltol (relative tolerance in changes of the objective value)\n\n\n\n\n\n","category":"method"},{"location":"basics/solve/","page":"Common Solver Options (Solve Keyword Arguments)","title":"Common Solver Options (Solve Keyword Arguments)","text":"Additionally, the extra keyword arguments are splatted to the library calls, so see the documentation of the integrator library for all the extra details. These extra keyword arguments are not guaranteed to act uniformly.","category":"page"},{"location":"tutorials/differentiating_integrals/#Differentiating-Integrals","page":"Differentiating Integrals","title":"Differentiating Integrals","text":"","category":"section"},{"location":"tutorials/differentiating_integrals/","page":"Differentiating Integrals","title":"Differentiating Integrals","text":"Integrals.jl is a fully differentiable quadrature library. Thus, it adds the ability to perform automatic differentiation over any of the libraries that it calls. It integrates with ForwardDiff.jl for forward-mode automatic differentiation and Zygote.jl for reverse-mode automatic differentiation. For example:","category":"page"},{"location":"tutorials/differentiating_integrals/","page":"Differentiating Integrals","title":"Differentiating Integrals","text":"using Integrals, ForwardDiff, FiniteDiff, Zygote, Cuba\nf(x, p) = sum(sin.(x .* p))\ndomain = (ones(2), 3ones(2)) # (lb, ub)\np = ones(2)\n\nfunction testf(p)\n prob = IntegralProblem(f, domain, p)\n sin(solve(prob, CubaCuhre(), reltol = 1e-6, abstol = 1e-6)[1])\nend\ntestf(p)\ndp1 = Zygote.gradient(testf,p)\ndp2 = FiniteDiff.finite_difference_gradient(testf, p)\ndp3 = ForwardDiff.gradient(testf, p)\ndp1[1] ≈ dp2 ≈ dp3","category":"page"},{"location":"basics/FAQ/#Frequently-Asked-Questions","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"","category":"section"},{"location":"basics/FAQ/#How-should-I-use-the-in-place-interface?","page":"Frequently Asked Questions","title":"How should I use the in-place interface?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"The in-place interface allows evaluating vector-valued integrands without allocating an output array. This can be beneficial for reducing allocations when integrating many functions simultaneously or to make use of existing in-place code. However, note that not all algorithms use in-place operations under the hood, i.e. HCubatureJL(), and may still allocate.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"You can construct an IntegralFunction(f, prototype), where f is of the form f(y, u, p) where prototype is of the desired type and shape of y.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"For small array outputs of a known size, consider using StaticArrays.jl for the return value of your integrand.","category":"page"},{"location":"basics/FAQ/#How-should-I-use-the-batch-interface?","page":"Frequently Asked Questions","title":"How should I use the batch interface?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"The batch interface allows evaluating one (or more) integrals simultaneously at different points, which maximizes the parallelism for a given algorithm.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"You can construct an out-of-place BatchIntegralFunction(bf) where bf is of the form bf(u, p) = stack(x -> f(x, p), eachslice(u; dims=ndims(u))), where f is the (unbatched) integrand.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"You can construct an in-place BatchIntegralFunction(bf, prototype), where bf is of the form bf(y, u, p) = foreach((y,x) -> f(y,x,p), eachslice(y, dims=ndims(y)), eachslice(x, dims=ndims(x))).","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"Note that not all algorithms use in-place batched operations under the hood, i.e. QuadGKJL().","category":"page"},{"location":"basics/FAQ/#What-should-I-do-if-my-solution-is-not-converged?","page":"Frequently Asked Questions","title":"What should I do if my solution is not converged?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"Certain algorithms, such as QuadratureRule used a fixed number of points to calculate an integral and cannot provide an error estimate. In this case, you have to increase the number of points and check the convergence yourself, which will depend on the accuracy of the rule you choose.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"For badly-behaved integrands, such as (nearly) singular and highly oscillatory functions, most algorithms will fail to converge and either throw an error or silently return the incorrect result. In some cases Integrals.jl can provide an error code when things go wrong, but otherwise you can always check if the error estimate for the integral is less than the requested tolerance, e.g. sol.resid < max(abstol, reltol*norm(sol.u)). Sometimes using a larger tolerance or higher precision arithmetic may help.","category":"page"},{"location":"basics/FAQ/#How-can-I-integrate-arbitrarily-spaced-data?","page":"Frequently Asked Questions","title":"How can I integrate arbitrarily-spaced data?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"See SampledIntegralProblem.","category":"page"},{"location":"basics/FAQ/#How-can-I-integrate-on-arbitrary-geometries?","page":"Frequently Asked Questions","title":"How can I integrate on arbitrary geometries?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"You can't, since Integrals.jl currently supports integration on hypercubes because that is what lower-level packages implement.","category":"page"},{"location":"basics/FAQ/#I-don't-see-algorithm-X-or-quadrature-scheme-Y-?","page":"Frequently Asked Questions","title":"I don't see algorithm X or quadrature scheme Y ?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"Fixed quadrature rules from other packages can be used with QuadratureRule. Otherwise, feel free to open an issue or pull request.","category":"page"},{"location":"basics/FAQ/#Can-I-take-derivatives-with-respect-to-the-limits-of-integration?","page":"Frequently Asked Questions","title":"Can I take derivatives with respect to the limits of integration?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"Currently this is not implemented.","category":"page"},{"location":"#Integrals.jl:-Unified-Integral-Approximation-Interface","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"","category":"section"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"Integrals.jl is a unified interface for the numerical approximation of integrals (quadrature) in Julia. It interfaces with other packages of the Julia ecosystem to make it easy to test alternative solver packages and pass small types to control algorithm swapping.","category":"page"},{"location":"#Installation","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Installation","text":"","category":"section"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"To install Integrals.jl, use the Julia package manager:","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using Pkg\nPkg.add(\"Integrals\")","category":"page"},{"location":"#Contributing","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Contributing","text":"","category":"section"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"Please refer to the SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages for guidance on PRs, issues, and other matters relating to contributing to SciML.\nSee the SciML Style Guide for common coding practices and other style decisions.\nThere are a few community forums:\nThe #diffeq-bridged and #sciml-bridged channels in the Julia Slack\nThe #diffeq-bridged and #sciml-bridged channels in the Julia Zulip\nOn the Julia Discourse forums\nSee also SciML Community page","category":"page"},{"location":"#Reproducibility","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Reproducibility","text":"","category":"section"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"<details><summary>The documentation of this SciML package was built using these direct dependencies,</summary>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using Pkg # hide\nPkg.status() # hide","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"</details>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"<details><summary>and using this machine and Julia version.</summary>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using InteractiveUtils # hide\nversioninfo() # hide","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"</details>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"<details><summary>A more complete overview of all dependencies and their versions is also provided.</summary>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using Pkg # hide\nPkg.status(; mode = PKGMODE_MANIFEST) # hide","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"</details>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using TOML\nusing Markdown\nversion = TOML.parse(read(\"../../Project.toml\", String))[\"version\"]\nname = TOML.parse(read(\"../../Project.toml\", String))[\"name\"]\nlink_manifest = \"https://github.com/SciML/\" * name * \".jl/tree/gh-pages/v\" * version *\n \"/assets/Manifest.toml\"\nlink_project = \"https://github.com/SciML/\" * name * \".jl/tree/gh-pages/v\" * version *\n \"/assets/Project.toml\"\nMarkdown.parse(\"\"\"You can also download the\n[manifest]($link_manifest)\nfile and the\n[project]($link_project)\nfile.\n\"\"\")","category":"page"},{"location":"basics/IntegralFunction/#func","page":"Integral Functions","title":"Integral Functions","text":"","category":"section"},{"location":"basics/IntegralFunction/","page":"Integral Functions","title":"Integral Functions","text":"SciMLBase.IntegralFunction\nSciMLBase.BatchIntegralFunction","category":"page"},{"location":"basics/IntegralFunction/#SciMLBase.IntegralFunction","page":"Integral Functions","title":"SciMLBase.IntegralFunction","text":"IntegralFunction{iip,specialize,F,T} <: AbstractIntegralFunction{iip}\n\nA representation of an integrand f defined by:\n\nf(u p)\n\nFor an in-place form of f see the iip section below for details on in-place or out-of-place handling.\n\nIntegralFunction{iip,specialize}(f, [integrand_prototype])\n\nNote that only f is required, and in the case of inplace integrands a mutable container integrand_prototype to store the result of the integrand. If integrand_prototype is present, f is interpreted as in-place, and otherwise f is assumed to be out-of-place.\n\niip: In-Place vs Out-Of-Place\n\nOut-of-place functions must be of the form y = f(u p) and in-place functions of the form f(y u p), where y is a number or array containing the output. Since f is allowed to return any type (e.g. real or complex numbers or arrays), in-place functions must provide a container integrand_prototype that is of the right type and size for the variable y, and the result is written to this container in-place. When in-place forms are used, in-place array operations, i.e. broadcasting, may be used by algorithms to reduce allocations. If integrand_prototype is not provided, f is assumed to be out-of-place.\n\nspecialize\n\nThis field is currently unused\n\nFields\n\nThe fields of the IntegralFunction type directly match the names of the inputs.\n\n\n\n\n\n","category":"type"},{"location":"basics/IntegralFunction/#SciMLBase.BatchIntegralFunction","page":"Integral Functions","title":"SciMLBase.BatchIntegralFunction","text":"BatchIntegralFunction{iip,specialize,F,T} <: AbstractIntegralFunction{iip}\n\nA batched representation of an (non-batched) integrand f(u, p) that can be evaluated at multiple points simultaneously using threads, the gpu, or distributed memory defined by:\n\nby = bf(bu p)\n\nHere we prefix variables with b to indicate they are batched variables, which implies that they are arrays whose last dimension is reserved for batching different evaluation points, or function values, and may be of a variable length. bu is an array whose elements correspond to distinct evaluation points to f, and bf is a function to evaluate f 'point-wise' so that f(bu[..., i], p) == bf(bu, p)[..., i]. For example, a simple batching implementation of a scalar, univariate function is via broadcasting: bf(bu, p) = f.(bu, Ref(p)), although this interface exists in order to allow user parallelization. In general, the integration algorithm is allowed to vary the number of evaluation points between subsequent calls to bf.\n\nFor an in-place form of bf see the iip section below for details on in-place or out-of-place handling.\n\nBatchIntegralFunction{iip,specialize}(bf, [integrand_prototype];\n max_batch=typemax(Int))\n\nNote that only bf is required, and in the case of inplace integrands a mutable container integrand_prototype to store a batch of integrand evaluations, with a last \"batching\" dimension.\n\nThe keyword max_batch is used to set a soft limit on the number of points to batch at the same time so that memory usage is controlled.\n\nIf integrand_prototype is present, bf is interpreted as in-place, and otherwise bf is assumed to be out-of-place.\n\niip: In-Place vs Out-Of-Place\n\nOut-of-place functions must be of the form by = bf(bu, p) and in-place functions of the form bf(by, bu, p) where by is a batch array containing the output. Since the algorithm may vary the number of points to batch, the batching dimension can be of any length, including zero, and since bf is allowed to return arrays of any type (e.g. real or complex) or size, in-place functions must provide a container integrand_prototype of the desired type and size for by. If integrand_prototype is not provided, bf is assumed to be out-of-place.\n\nIn the out-of-place case, we require f(bu[..., i], p) == bf(bu, p)[..., i], and certain algorithms, such as those implemented in C, may infer the type or shape of by by calling bf with an empty array of input points, i.e. bu with size(bu)[end] == 0. Then it is expected for the resulting by to have the same type and size(by)[begin:end-1] for all subsequent calls.\n\nWhen the in-place form is used, we require f(by[..., i], bu[..., i], p) == bf(by, bu, p)[..., i] and size(by)[begin:end-1] == size(integrand_prototype)[begin:end-1]. The algorithm should always pass the integrand by arrays that are similar to integrand_prototype, and may use views and in-place array operations to reduce allocations.\n\nspecialize\n\nThis field is currently unused\n\nFields\n\nThe fields of the BatchIntegralFunction type are f, corresponding to bf above, and integrand_prototype.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#solvers","page":"Integral Solver Algorithms","title":"Integral Solver Algorithms","text":"","category":"section"},{"location":"solvers/IntegralSolvers/","page":"Integral Solver Algorithms","title":"Integral Solver Algorithms","text":"The following algorithms are available:","category":"page"},{"location":"solvers/IntegralSolvers/","page":"Integral Solver Algorithms","title":"Integral Solver Algorithms","text":"QuadGKJL: Uses QuadGK.jl, which supports one-dimensional integration of scalar and array-valued integrands with in-place or batched forms. Integrands that are both in-place and batched are implemented in the wrapper but are not supported under the hood.\nHCubatureJL: Uses HCubature.jl, which supports scalar and array-valued integrands and works best in low dimensions, e.g. ≤ 8. In-place integrands are implemented in the wrapper but are not supported under the hood. Batching is not supported.\nVEGAS: Uses MonteCarloIntegration.jl, which requires scalar, Float64-valued integrands and works in any number of dimensions.\nVEGASMC: Uses MCIntegration.jl. Requires using MCIntegration. Doesn't support batching.\nCubatureJLh: h-Cubature from Cubature.jl. Requires using Cubature.\nCubatureJLp: p-Cubature from Cubature.jl. Requires using Cubature.\nCubaVegas: Vegas from Cuba.jl. Requires using Cuba.\nCubaSUAVE: SUAVE from Cuba.jl. Requires using Cuba.\nCubaDivonne: Divonne from Cuba.jl. Requires using Cuba. Works only for >1-dimensional integrations.\nCubaCuhre: Cuhre from Cuba.jl. Requires using Cuba. Works only for >1-dimensional integrations.\nGaussLegendre: Performs fixed-order Gauss-Legendre quadrature. Requires using FastGaussQuadrature.\nQuadratureRule: Accepts a user-defined function that returns nodes and weights.\nArblibJL: real- and complex-valued univariate integration of holomorphic and meromorphic functions from Arblib.jl. Requires using Arblib.","category":"page"},{"location":"solvers/IntegralSolvers/","page":"Integral Solver Algorithms","title":"Integral Solver Algorithms","text":"QuadGKJL\nHCubatureJL\nCubatureJLp\nCubatureJLh\nVEGAS\nVEGASMC\nCubaVegas\nCubaSUAVE\nCubaDivonne\nCubaCuhre\nGaussLegendre\nQuadratureRule\nArblibJL","category":"page"},{"location":"solvers/IntegralSolvers/#Integrals.QuadGKJL","page":"Integral Solver Algorithms","title":"Integrals.QuadGKJL","text":"QuadGKJL(; order = 7, norm=norm)\n\nOne-dimensional Gauss-Kronrod integration from QuadGK.jl. This method also takes the optional arguments order and norm. Which are the order of the integration rule and the norm for calculating the error, respectively\n\nReferences\n\n@article{laurie1997calculation, title={Calculation of Gauss-Kronrod quadrature rules}, author={Laurie, Dirk}, journal={Mathematics of Computation}, volume={66}, number={219}, pages={1133–1145}, year={1997} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.HCubatureJL","page":"Integral Solver Algorithms","title":"Integrals.HCubatureJL","text":"HCubatureJL(; norm=norm, initdiv=1)\n\nMultidimensional \"h-adaptive\" integration from HCubature.jl. This method also takes the optional arguments initdiv and norm. Which are the initial number of segments each dimension of the integration domain is divided into, and the norm for calculating the error, respectively.\n\nReferences\n\n@article{genz1980remarks, title={Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region}, author={Genz, Alan C and Malik, Aftab Ahmad}, journal={Journal of Computational and Applied mathematics}, volume={6}, number={4}, pages={295–302}, year={1980}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubatureJLp","page":"Integral Solver Algorithms","title":"Integrals.CubatureJLp","text":"CubatureJLp()\n\nMultidimensional p-adaptive integration from Cubature.jl. This method is based on repeatedly doubling the degree of the cubature rules, until convergence is achieved. The used cubature rule is a tensor product of Clenshaw–Curtis quadrature rules. error_norm specifies the convergence criterion for vector valued integrands. Defaults to Cubature.INDIVIDUAL, other options are Cubature.PAIRED, Cubature.L1, Cubature.L2, or Cubature.LINF.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubatureJLh","page":"Integral Solver Algorithms","title":"Integrals.CubatureJLh","text":"CubatureJLh()\n\nMultidimensional h-adaptive integration from Cubature.jl. error_norm specifies the convergence criterion for vector valued integrands. Defaults to Cubature.INDIVIDUAL, other options are Cubature.PAIRED, Cubature.L1, Cubature.L2, or Cubature.LINF.\n\nReferences\n\n@article{genz1980remarks, title={Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region}, author={Genz, Alan C and Malik, Aftab Ahmad}, journal={Journal of Computational and Applied mathematics}, volume={6}, number={4}, pages={295–302}, year={1980}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.VEGAS","page":"Integral Solver Algorithms","title":"Integrals.VEGAS","text":"VEGAS(; nbins = 100, ncalls = 1000, debug=false)\n\nMultidimensional adaptive Monte Carlo integration from MonteCarloIntegration.jl. Importance sampling is used to reduce variance. This method also takes three optional arguments nbins, ncalls and debug which are the initial number of bins each dimension of the integration domain is divided into, the number of function calls per iteration of the algorithm, and whether debug info should be printed, respectively.\n\nLimitations\n\nThis algorithm can only integrate Float64-valued functions\n\nReferences\n\n@article{lepage1978new, title={A new algorithm for adaptive multidimensional integration}, author={Lepage, G Peter}, journal={Journal of Computational Physics}, volume={27}, number={2}, pages={192–203}, year={1978}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.VEGASMC","page":"Integral Solver Algorithms","title":"Integrals.VEGASMC","text":"VEGASMC(; kws...)\n\nMarkov-chain based Vegas algorithm from MCIntegration.jl\n\nRefer to MCIntegration.integrate for documentation on the keywords, which are passed directly to the solver with a set of defaults that works for conforming integrands.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubaVegas","page":"Integral Solver Algorithms","title":"Integrals.CubaVegas","text":"CubaVegas()\n\nMultidimensional adaptive Monte Carlo integration from Cuba.jl. Importance sampling is used to reduce variance.\n\nReferences\n\n@article{lepage1978new, title={A new algorithm for adaptive multidimensional integration}, author={Lepage, G Peter}, journal={Journal of Computational Physics}, volume={27}, number={2}, pages={192–203}, year={1978}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubaSUAVE","page":"Integral Solver Algorithms","title":"Integrals.CubaSUAVE","text":"CubaSUAVE()\n\nMultidimensional adaptive Monte Carlo integration from Cuba.jl. Suave stands for subregion-adaptive VEGAS. Importance sampling and subdivision are thus used to reduce variance.\n\nReferences\n\n@article{hahn2005cuba, title={Cuba—a library for multidimensional numerical integration}, author={Hahn, Thomas}, journal={Computer Physics Communications}, volume={168}, number={2}, pages={78–95}, year={2005}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubaDivonne","page":"Integral Solver Algorithms","title":"Integrals.CubaDivonne","text":"CubaDivonne()\n\nMultidimensional adaptive Monte Carlo integration from Cuba.jl. Stratified sampling is used to reduce variance.\n\nReferences\n\n@article{friedman1981nested, title={A nested partitioning procedure for numerical multiple integration}, author={Friedman, Jerome H and Wright, Margaret H}, journal={ACM Transactions on Mathematical Software (TOMS)}, volume={7}, number={1}, pages={76–92}, year={1981}, publisher={ACM New York, NY, USA} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubaCuhre","page":"Integral Solver Algorithms","title":"Integrals.CubaCuhre","text":"CubaCuhre()\n\nMultidimensional h-adaptive integration from Cuba.jl.\n\nReferences\n\n@article{berntsen1991adaptive, title={An adaptive algorithm for the approximate calculation of multiple integrals}, author={Berntsen, Jarle and Espelid, Terje O and Genz, Alan}, journal={ACM Transactions on Mathematical Software (TOMS)}, volume={17}, number={4}, pages={437–451}, year={1991}, publisher={ACM New York, NY, USA} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.GaussLegendre","page":"Integral Solver Algorithms","title":"Integrals.GaussLegendre","text":"GaussLegendre{C, N, W}\n\nStruct for evaluating an integral via (composite) Gauss-Legendre quadrature. The field C will be true if subintervals > 1, and false otherwise.\n\nThe fields nodes::N and weights::W are defined by nodes, weights = gausslegendre(n) for a given number of nodes n.\n\nThe field subintervals::Int64 = 1 (with default value 1) defines the number of intervals to partition the original interval of integration [a, b] into, splitting it into [xⱼ, xⱼ₊₁] for j = 1,…,subintervals, where xⱼ = a + (j-1)h and h = (b-a)/subintervals. Gauss-Legendre quadrature is then applied on each subinterval. For example, if [a, b] = [-1, 1] and subintervals = 2, then Gauss-Legendre quadrature will be applied separately on [-1, 0] and [0, 1], summing the two results.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.QuadratureRule","page":"Integral Solver Algorithms","title":"Integrals.QuadratureRule","text":"QuadratureRule(q; n=250)\n\nAlgorithm to construct and evaluate a quadrature rule q of n points computed from the inputs as x, w = q(n). It assumes the nodes and weights are for the standard interval [-1, 1]^d in d dimensions, and rescales the nodes to the specific hypercube being solved. The nodes x may be scalars in 1d or vectors in arbitrary dimensions, and the weights w must be scalar. The algorithm computes the quadrature rule sum(w .* f.(x)) and the caller must check that the result is converged with respect to n.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.ArblibJL","page":"Integral Solver Algorithms","title":"Integrals.ArblibJL","text":"ArblibJL(; check_analytic=false, take_prec=false, warn_on_no_convergence=false, opts=C_NULL)\n\nOne-dimensional adaptive Gauss-Legendre integration using rigorous error bounds and precision ball arithmetic. Generally this assumes the integrand is holomorphic or meromorphic, which is the user's responsibility to verify. The result of the integral is not guaranteed to satisfy the requested tolerances, however the result is guaranteed to be within the error estimate.\n\nArblib.jl only supports integration of univariate real- and complex-valued functions with both inplace and out-of-place forms. See their documentation for additional details the algorithm arguments and on implementing high-precision integrands. Additionally, the error estimate is included in the return value of the integral, representing a ball.\n\n\n\n\n\n","category":"type"}] +[{"location":"basics/SampledIntegralProblem/#Integrating-pre-sampled-data","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"In some cases, instead of a function that acts as integrand, one only possesses a list of data points y at a set of sampling locations x, that must be integrated. This package contains functionality for doing that.","category":"page"},{"location":"basics/SampledIntegralProblem/#Example","page":"Integrating pre-sampled data","title":"Example","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"Say, by some means we have generated a dataset x and y:","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"using Integrals # hide\nf = x -> x^2\nx = range(0, 1, length=20)\ny = f.(x)","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"Now, we can integrate this data set as follows:","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"problem = SampledIntegralProblem(y, x)\nmethod = TrapezoidalRule()\nsolve(problem, method)","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"The exact answer is of course $ 1/3 $.","category":"page"},{"location":"basics/SampledIntegralProblem/#Details","page":"Integrating pre-sampled data","title":"Details","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"SciMLBase.SampledIntegralProblem\nsolve(::SampledIntegralProblem, ::SciMLBase.AbstractIntegralAlgorithm)","category":"page"},{"location":"basics/SampledIntegralProblem/#SciMLBase.SampledIntegralProblem","page":"Integrating pre-sampled data","title":"SciMLBase.SampledIntegralProblem","text":"Defines a integral problem over pre-sampled data. Documentation Page: https://docs.sciml.ai/Integrals/stable/\n\nMathematical Specification of a data Integral Problem\n\nSampled integral problems are defined as:\n\nsum_i w_i y_i\n\nwhere y_i are sampled values of the integrand, and w_i are weights assigned by a quadrature rule, which depend on sampling points x.\n\nProblem Type\n\nConstructors\n\nSampledIntegralProblem(y::AbstractArray, x::AbstractVector; dim=ndims(y), kwargs...)\n\ny: The sampled integrand, must be a subtype of AbstractArray. It is assumed that the values of y along dimension dim correspond to the integrand evaluated at sampling points x\nx: Sampling points, must be a subtype of AbstractVector.\ndim: Dimension along which to integrate. Defaults to the last dimension of y.\nkwargs: Keyword arguments copied to the solvers.\n\nFields\n\nThe fields match the names of the constructor arguments.\n\n\n\n\n\n","category":"type"},{"location":"basics/SampledIntegralProblem/#CommonSolve.solve-Tuple{SampledIntegralProblem, SciMLBase.AbstractIntegralAlgorithm}","page":"Integrating pre-sampled data","title":"CommonSolve.solve","text":"solve(prob::SampledIntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)\n\nKeyword Arguments\n\nThere are no keyword arguments used to solve SampledIntegralProblems\n\n\n\n\n\n","category":"method"},{"location":"basics/SampledIntegralProblem/#Non-equidistant-grids","page":"Integrating pre-sampled data","title":"Non-equidistant grids","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"If the sampling points x are provided as an AbstractRange (constructed with the range function for example), faster methods are used that take advantage of the fact that the points are equidistantly spaced. Otherwise, general methods are used for non-uniform grids.","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"Example:","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"using Integrals # hide\nf = x -> x^7\nx = [0.0; sort(rand(1000)); 1.0]\ny = f.(x)\nproblem = SampledIntegralProblem(y, x)\nmethod = TrapezoidalRule()\nsolve(problem, method)","category":"page"},{"location":"basics/SampledIntegralProblem/#Evaluating-multiple-integrals-at-once","page":"Integrating pre-sampled data","title":"Evaluating multiple integrals at once","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"If the provided data set y is a multidimensional array, the integrals are evaluated across only one of its axes. For performance reasons, the last axis of the array y is chosen by default, but this can be modified with the dim keyword argument to the problem definition.","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"using Integrals # hide\nf1 = x -> x^2\nf2 = x -> x^3\nf3 = x -> x^4\nx = range(0, 1, length=20)\ny = [f1.(x) f2.(x) f3.(x)]\nproblem = SampledIntegralProblem(y, x; dim=1)\nmethod = SimpsonsRule()\nsolve(problem, method)","category":"page"},{"location":"basics/SampledIntegralProblem/#Supported-methods","page":"Integrating pre-sampled data","title":"Supported methods","text":"","category":"section"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"Right now, only the TrapezoidalRule and SimpsonsRule are supported.","category":"page"},{"location":"basics/SampledIntegralProblem/","page":"Integrating pre-sampled data","title":"Integrating pre-sampled data","text":"TrapezoidalRule\nSimpsonsRule","category":"page"},{"location":"basics/SampledIntegralProblem/#Integrals.TrapezoidalRule","page":"Integrating pre-sampled data","title":"Integrals.TrapezoidalRule","text":"TrapezoidalRule\n\nStruct for evaluating an integral via the trapezoidal rule.\n\nExample with sampled data:\n\nusing Integrals\nf = x -> x^2\nx = range(0, 1, length=20)\ny = f.(x)\nproblem = SampledIntegralProblem(y, x)\nmethod = TrapezoidalRule()\nsolve(problem, method)\n\n\n\n\n\n","category":"type"},{"location":"basics/SampledIntegralProblem/#Integrals.SimpsonsRule","page":"Integrating pre-sampled data","title":"Integrals.SimpsonsRule","text":"SimpsonsRule\n\nStruct for evaluating an integral via the Simpson's composite 1/3-3/8 rule over AbstractRanges (evenly spaced points) and Simpson's composite 1/3 rule for non-equidistant grids.\n\nExample with equidistant data:\n\nusing Integrals\nf = x -> x^2\nx = range(0, 1, length=20)\ny = f.(x)\nproblem = SampledIntegralProblem(y, x)\nmethod = SimpsonsRule()\nsolve(problem, method)\n\n\n\n\n\n","category":"type"},{"location":"tutorials/caching_interface/#Integrals-with-Caching-Interface","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"","category":"section"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"Often, integral solvers allocate memory or reuse quadrature rules for solving different problems. For example, if one is going to solve the same integral for several parameters","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using Integrals\n\nprob = IntegralProblem((x, p) -> sin(x * p), (0, 1), 14.0)\nalg = QuadGKJL()\n\nsolve(prob, alg)\n\nprob = remake(prob, p = 15.0)\nsolve(prob, alg)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"then it would be more efficient to allocate the heap used by quadgk across several calls, shown below by directly calling the library","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using QuadGK\nsegbuf = QuadGK.alloc_segbuf()\nquadgk(x -> sin(14x), 0, 1, segbuf = segbuf)\nquadgk(x -> sin(15x), 0, 1, segbuf = segbuf)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"Integrals.jl's caching interface automates this process to reuse resources if an algorithm supports it and if the necessary types to build the cache can be inferred from prob. To do this with Integrals.jl, you simply init a cache, solve!, replace p, and solve again. This uses the SciML init interface","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using Integrals\n\nprob = IntegralProblem((x, p) -> sin(x * p), (0, 1), 14.0)\nalg = QuadGKJL()\n\ncache = init(prob, alg)\nsol1 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"cache.p = 15.0\nsol2 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"The caching interface is intended for updating p and domain. Note that the types of these variables is not allowed to change. If it is necessary to change the integrand f instead of defining a new IntegralProblem, consider using FunctionWrappers.jl.","category":"page"},{"location":"tutorials/caching_interface/#Caching-for-sampled-integral-problems","page":"Integrals with Caching Interface","title":"Caching for sampled integral problems","text":"","category":"section"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"For sampled integral problems, it is possible to cache the weights and reuse them for multiple data sets.","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using Integrals\n\nx = 0.0:0.1:1.0\ny = sin.(x)\n\nprob = SampledIntegralProblem(y, x)\nalg = TrapezoidalRule()\n\ncache = init(prob, alg)\nsol1 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"cache.y = cos.(x) # use .= to update in-place\nsol2 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"If the grid is modified, the weights are recomputed.","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"cache.x = 0.0:0.2:2.0\ncache.y = sin.(cache.x)\nsol3 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"For multi-dimensional datasets, the integration dimension can also be changed","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"using Integrals\n\nx = 0.0:0.1:1.0\ny = sin.(x) .* cos.(x')\n\nprob = SampledIntegralProblem(y, x)\nalg = TrapezoidalRule()\n\ncache = init(prob, alg)\nsol1 = solve!(cache)","category":"page"},{"location":"tutorials/caching_interface/","page":"Integrals with Caching Interface","title":"Integrals with Caching Interface","text":"cache.dim = 1\nsol2 = solve!(cache)","category":"page"},{"location":"tutorials/numerical_integrals/#Numerically-Solving-Integrals","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"","category":"section"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"For basic multidimensional quadrature, we can construct and solve a IntegralProblem. The integral we want to evaluate is:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"int_1^3int_1^3int_1^3 sum_1^3 sin(u_i) du_1du_2du_3","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"We can numerically approximate this integral:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals\nf(u, p) = sum(sin.(u))\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(f, domain)\nsol = solve(prob, HCubatureJL(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"where the first argument of IntegralProblem is the integrand, the second argument is the lower bound, and the third argument is the upper bound. p are the parameters of the integrand. In this case, there are no parameters, but still f must be defined as f(x,p) and not f(x). For an example with parameters, see the next tutorial. The first argument of solve is the problem we are solving, the second is an algorithm to solve the problem with. Then there are keywords which provides details how the algorithm should work, in this case tolerances how precise the numerical approximation should be.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"We can also evaluate multiple integrals at once. We could create two IntegralProblems for this, but that is wasteful if the integrands share a lot of computation. For example, we also want to evaluate:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"int_1^3int_1^3int_1^3 sum_1^3 cos(u_i) du_1du_2du_3","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals\nf(u, p) = [sum(sin.(u)), sum(cos.(u))]\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(f, domain)\nsol = solve(prob, HCubatureJL(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Another way to think about this is that the integrand is now a vector valued function. In general, we should be able to integrate any type that is in a vector space and supports addition and scalar multiplication, although Integrals.jl allows scalars and arrays. In the above example, the integrand was defined out-of-position. This means that a new output vector is created every time the function f is called. If we do not want these allocations, we can also define f in-position.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals, Cubature\nfunction f(y, u, p)\n y[1] = sum(sin.(u))\n y[2] = sum(cos.(u))\nend\nprototype = zeros(2)\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(IntegralFunction(f, prototype), domain)\nsol = solve(prob, CubatureJLh(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"where y is a cache to store the evaluation of the integrand and prototype is an instance of y with the desired type and shape. We needed to change the algorithm to CubatureJLh() because HCubatureJL() does not support in-position under the hood. f evaluates the integrand at a certain point, but most adaptive quadrature algorithms need to evaluate the integrand at multiple points in each step of the algorithm. We would thus often like to parallelize the computation. The batch interface allows us to compute multiple points at once. For example, here we do allocation-free multithreading with Cubature.jl:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals, Cubature, Base.Threads\nfunction f(y, u, p)\n Threads.@threads for i in 1:size(u, 2)\n y[1, i] = sum(sin, @view(u[:, i]))\n y[2, i] = sum(cos, @view(u[:, i]))\n end\nend\nprototype = zeros(2, 0)\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(BatchIntegralFunction(f, prototype), domain)\nsol = solve(prob, CubatureJLh(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Both u and y changed from vectors to matrices, where each column is respectively a point the integrand is evaluated at or the evaluation of the integrand at the corresponding point. The prototype now has an extra dimension for batching that can be of size zero. Try to create yourself an out-of-position version of the above problem. For the full details of the batching interface, see the problem page.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"If we would like to compare the results against Cuba.jl's Cuhre method, then the change is a one-argument change:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals\nusing Cuba\nf(u, p) = sum(sin.(u))\ndomain = (ones(3), 3ones(3)) # (lb, ub)\nprob = IntegralProblem(f, domain)\nsol = solve(prob, CubaCuhre(); reltol = 1e-3, abstol = 1e-3)\nsol.u","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"However, Cuhre does not support vector valued integrands. The solvers page gives an overview of which arguments each algorithm can handle.","category":"page"},{"location":"tutorials/numerical_integrals/#One-dimensional-integrals","page":"Numerically Solving Integrals","title":"One-dimensional integrals","text":"","category":"section"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Integrals.jl also has specific solvers for integrals in a single dimension, such as QuadGKJL. For example, we can create our own sine function by integrating the cosine function from 0 to x.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Integrals\nmy_sin(x) = solve(IntegralProblem((x, p) -> cos(x), (0.0, x)), QuadGKJL()).u\nx = 0:0.1:(2 * pi)\n@. my_sin(x) ≈ sin(x)","category":"page"},{"location":"tutorials/numerical_integrals/#Infinity-handling","page":"Numerically Solving Integrals","title":"Infinity handling","text":"","category":"section"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Integrals.jl can also handle infinite integration bounds. For infinite upper bounds u is substituted with a+fract1-t, and the integral is thus transformed to:","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"int_a^infty f(u)du = int_0^1 fleft(a+fract1-tright)frac1(1-t)^2dt","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"Integrals with an infinite lower bound are handled in the same way. If both upper and lower bound are infinite, u is substituted with fract1-t^2,","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"int_-infty^infty f(u)du = int_-1^1 fleft(fract1-t^2right)frac1+t^2(1-t^2)^2dt","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"For multidimensional integrals, each variable with infinite bounds is substituted the same way. The details of the math behind these transforms can be found here.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"As an example, let us integrate the standard bivariate normal probability distribution over the area above the horizontal axis, which should be equal to 05.","category":"page"},{"location":"tutorials/numerical_integrals/","page":"Numerically Solving Integrals","title":"Numerically Solving Integrals","text":"using Distributions\nusing Integrals\ndist = MvNormal(ones(2))\nf = (x, p) -> pdf(dist, x)\ndomain = ([-Inf, 0.0], [Inf, Inf]) # (lb, ub)\nprob = IntegralProblem(f, domain)\nsolve(prob, HCubatureJL(), reltol = 1e-3, abstol = 1e-3)","category":"page"},{"location":"basics/IntegralProblem/#prob","page":"Integral Problems","title":"Integral Problems","text":"","category":"section"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"SciMLBase.IntegralProblem","category":"page"},{"location":"basics/IntegralProblem/#SciMLBase.IntegralProblem","page":"Integral Problems","title":"SciMLBase.IntegralProblem","text":"Defines an integral problem. Documentation Page: https://docs.sciml.ai/Integrals/stable/\n\nMathematical Specification of an Integral Problem\n\nIntegral problems are multi-dimensional integrals defined as:\n\nint_lb^ub f(up) du\n\nwhere p are parameters. u is a Number or AbstractVector whose geometry matches the space being integrated. This space is bounded by the lowerbound lb and upperbound ub, which are Numbers or AbstractVectors with the same geometry as u.\n\nProblem Type\n\nConstructors\n\nIntegralProblem(f::AbstractIntegralFunction,domain,p=NullParameters(); kwargs...)\nIntegralProblem(f::AbstractIntegralFunction,lb,ub,p=NullParameters(); kwargs...)\nIntegralProblem(f,domain,p=NullParameters(); nout=nothing, batch=nothing, kwargs...)\nIntegralProblem(f,lb,ub,p=NullParameters(); nout=nothing, batch=nothing, kwargs...)\n\nf: the integrand, callable function y = f(u,p) for out-of-place (default) or an IntegralFunction or BatchIntegralFunction for inplace and batching optimizations.\ndomain: an object representing an integration domain, i.e. the tuple (lb, ub).\nlb: DEPRECATED: Either a number or vector of lower bounds.\nub: DEPRECATED: Either a number or vector of upper bounds.\np: The parameters associated with the problem.\nnout: DEPRECATED (see IntegralFunction): length of the vector output of the integrand (by default the integrand is assumed to be scalar)\nbatch: DEPRECATED (see BatchIntegralFunction): number of points the integrand can evaluate simultaneously (by default there is no batching)\nkwargs: Keyword arguments copied to the solvers.\n\nAdditionally, we can supply iip like IntegralProblem{iip}(...) as true or false to declare at compile time whether the integrator function is in-place.\n\nFields\n\nThe fields match the names of the constructor arguments.\n\n\n\n\n\n","category":"type"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"The correct shape of the variables (inputs) u and the values (outputs) y of the integrand f depends on whether batching is used.","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"If batch == 0","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":" single variable f multiple variable f\nscalar valued f u is a scalar, y is a scalar u is a vector, y is a scalar\nvector valued f u is a scalar, y is a vector u is a vector, y is a vector","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"If batch > 0","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":" single variable f multiple variable f\nscalar valued f u is a vector, y is a vector u is a matrix, y is a vector\nvector valued f u is a vector, y is a matrix u is a matrix, y is a matrix","category":"page"},{"location":"basics/IntegralProblem/","page":"Integral Problems","title":"Integral Problems","text":"The last dimension is always used as the batching dimension, e.g., if u is a matrix, then u[:,i] is the ith point where the integrand will be evaluated.","category":"page"},{"location":"basics/solve/#Common-Solver-Options-(Solve-Keyword-Arguments)","page":"Common Solver Options (Solve Keyword Arguments)","title":"Common Solver Options (Solve Keyword Arguments)","text":"","category":"section"},{"location":"basics/solve/","page":"Common Solver Options (Solve Keyword Arguments)","title":"Common Solver Options (Solve Keyword Arguments)","text":"solve(prob::IntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm)","category":"page"},{"location":"basics/solve/#CommonSolve.solve-Tuple{IntegralProblem, SciMLBase.AbstractIntegralAlgorithm}","page":"Common Solver Options (Solve Keyword Arguments)","title":"CommonSolve.solve","text":"solve(prob::IntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)\n\nKeyword Arguments\n\nThe arguments to solve are common across all of the quadrature methods. These common arguments are:\n\nmaxiters (the maximum number of iterations)\nabstol (absolute tolerance in changes of the objective value)\nreltol (relative tolerance in changes of the objective value)\n\n\n\n\n\n","category":"method"},{"location":"basics/solve/","page":"Common Solver Options (Solve Keyword Arguments)","title":"Common Solver Options (Solve Keyword Arguments)","text":"Additionally, the extra keyword arguments are splatted to the library calls, so see the documentation of the integrator library for all the extra details. These extra keyword arguments are not guaranteed to act uniformly.","category":"page"},{"location":"tutorials/differentiating_integrals/#Differentiating-Integrals","page":"Differentiating Integrals","title":"Differentiating Integrals","text":"","category":"section"},{"location":"tutorials/differentiating_integrals/","page":"Differentiating Integrals","title":"Differentiating Integrals","text":"Integrals.jl is a fully differentiable quadrature library. Thus, it adds the ability to perform automatic differentiation over any of the libraries that it calls. It integrates with ForwardDiff.jl for forward-mode automatic differentiation and Zygote.jl for reverse-mode automatic differentiation. For example:","category":"page"},{"location":"tutorials/differentiating_integrals/","page":"Differentiating Integrals","title":"Differentiating Integrals","text":"using Integrals, ForwardDiff, FiniteDiff, Zygote, Cuba\nf(x, p) = sum(sin.(x .* p))\ndomain = (ones(2), 3ones(2)) # (lb, ub)\np = ones(2)\n\nfunction testf(p)\n prob = IntegralProblem(f, domain, p)\n sin(solve(prob, CubaCuhre(), reltol = 1e-6, abstol = 1e-6)[1])\nend\ntestf(p)\ndp1 = Zygote.gradient(testf,p)\ndp2 = FiniteDiff.finite_difference_gradient(testf, p)\ndp3 = ForwardDiff.gradient(testf, p)\ndp1[1] ≈ dp2 ≈ dp3","category":"page"},{"location":"basics/FAQ/#Frequently-Asked-Questions","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"","category":"section"},{"location":"basics/FAQ/#How-should-I-use-the-in-place-interface?","page":"Frequently Asked Questions","title":"How should I use the in-place interface?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"The in-place interface allows evaluating vector-valued integrands without allocating an output array. This can be beneficial for reducing allocations when integrating many functions simultaneously or to make use of existing in-place code. However, note that not all algorithms use in-place operations under the hood, i.e. HCubatureJL(), and may still allocate.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"You can construct an IntegralFunction(f, prototype), where f is of the form f(y, u, p) where prototype is of the desired type and shape of y.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"For small array outputs of a known size, consider using StaticArrays.jl for the return value of your integrand.","category":"page"},{"location":"basics/FAQ/#How-should-I-use-the-batch-interface?","page":"Frequently Asked Questions","title":"How should I use the batch interface?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"The batch interface allows evaluating one (or more) integrals simultaneously at different points, which maximizes the parallelism for a given algorithm.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"You can construct an out-of-place BatchIntegralFunction(bf) where bf is of the form bf(u, p) = stack(x -> f(x, p), eachslice(u; dims=ndims(u))), where f is the (unbatched) integrand.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"You can construct an in-place BatchIntegralFunction(bf, prototype), where bf is of the form bf(y, u, p) = foreach((y,x) -> f(y,x,p), eachslice(y, dims=ndims(y)), eachslice(x, dims=ndims(x))).","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"Note that not all algorithms use in-place batched operations under the hood, i.e. QuadGKJL().","category":"page"},{"location":"basics/FAQ/#What-should-I-do-if-my-solution-is-not-converged?","page":"Frequently Asked Questions","title":"What should I do if my solution is not converged?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"Certain algorithms, such as QuadratureRule used a fixed number of points to calculate an integral and cannot provide an error estimate. In this case, you have to increase the number of points and check the convergence yourself, which will depend on the accuracy of the rule you choose.","category":"page"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"For badly-behaved integrands, such as (nearly) singular and highly oscillatory functions, most algorithms will fail to converge and either throw an error or silently return the incorrect result. In some cases Integrals.jl can provide an error code when things go wrong, but otherwise you can always check if the error estimate for the integral is less than the requested tolerance, e.g. sol.resid < max(abstol, reltol*norm(sol.u)). Sometimes using a larger tolerance or higher precision arithmetic may help.","category":"page"},{"location":"basics/FAQ/#How-can-I-integrate-arbitrarily-spaced-data?","page":"Frequently Asked Questions","title":"How can I integrate arbitrarily-spaced data?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"See SampledIntegralProblem.","category":"page"},{"location":"basics/FAQ/#How-can-I-integrate-on-arbitrary-geometries?","page":"Frequently Asked Questions","title":"How can I integrate on arbitrary geometries?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"You can't, since Integrals.jl currently supports integration on hypercubes because that is what lower-level packages implement.","category":"page"},{"location":"basics/FAQ/#I-don't-see-algorithm-X-or-quadrature-scheme-Y-?","page":"Frequently Asked Questions","title":"I don't see algorithm X or quadrature scheme Y ?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"Fixed quadrature rules from other packages can be used with QuadratureRule. Otherwise, feel free to open an issue or pull request.","category":"page"},{"location":"basics/FAQ/#Can-I-take-derivatives-with-respect-to-the-limits-of-integration?","page":"Frequently Asked Questions","title":"Can I take derivatives with respect to the limits of integration?","text":"","category":"section"},{"location":"basics/FAQ/","page":"Frequently Asked Questions","title":"Frequently Asked Questions","text":"Currently this is not implemented.","category":"page"},{"location":"#Integrals.jl:-Unified-Integral-Approximation-Interface","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"","category":"section"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"Integrals.jl is a unified interface for the numerical approximation of integrals (quadrature) in Julia. It interfaces with other packages of the Julia ecosystem to make it easy to test alternative solver packages and pass small types to control algorithm swapping.","category":"page"},{"location":"#Installation","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Installation","text":"","category":"section"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"To install Integrals.jl, use the Julia package manager:","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using Pkg\nPkg.add(\"Integrals\")","category":"page"},{"location":"#Contributing","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Contributing","text":"","category":"section"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"Please refer to the SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages for guidance on PRs, issues, and other matters relating to contributing to SciML.\nSee the SciML Style Guide for common coding practices and other style decisions.\nThere are a few community forums:\nThe #diffeq-bridged and #sciml-bridged channels in the Julia Slack\nThe #diffeq-bridged and #sciml-bridged channels in the Julia Zulip\nOn the Julia Discourse forums\nSee also SciML Community page","category":"page"},{"location":"#Reproducibility","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Reproducibility","text":"","category":"section"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"<details><summary>The documentation of this SciML package was built using these direct dependencies,</summary>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using Pkg # hide\nPkg.status() # hide","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"</details>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"<details><summary>and using this machine and Julia version.</summary>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using InteractiveUtils # hide\nversioninfo() # hide","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"</details>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"<details><summary>A more complete overview of all dependencies and their versions is also provided.</summary>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using Pkg # hide\nPkg.status(; mode = PKGMODE_MANIFEST) # hide","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"</details>","category":"page"},{"location":"","page":"Integrals.jl: Unified Integral Approximation Interface","title":"Integrals.jl: Unified Integral Approximation Interface","text":"using TOML\nusing Markdown\nversion = TOML.parse(read(\"../../Project.toml\", String))[\"version\"]\nname = TOML.parse(read(\"../../Project.toml\", String))[\"name\"]\nlink_manifest = \"https://github.com/SciML/\" * name * \".jl/tree/gh-pages/v\" * version *\n \"/assets/Manifest.toml\"\nlink_project = \"https://github.com/SciML/\" * name * \".jl/tree/gh-pages/v\" * version *\n \"/assets/Project.toml\"\nMarkdown.parse(\"\"\"You can also download the\n[manifest]($link_manifest)\nfile and the\n[project]($link_project)\nfile.\n\"\"\")","category":"page"},{"location":"basics/IntegralFunction/#func","page":"Integral Functions","title":"Integral Functions","text":"","category":"section"},{"location":"basics/IntegralFunction/","page":"Integral Functions","title":"Integral Functions","text":"SciMLBase.IntegralFunction\nSciMLBase.BatchIntegralFunction","category":"page"},{"location":"basics/IntegralFunction/#SciMLBase.IntegralFunction","page":"Integral Functions","title":"SciMLBase.IntegralFunction","text":"IntegralFunction{iip,specialize,F,T} <: AbstractIntegralFunction{iip}\n\nA representation of an integrand f defined by:\n\nf(u p)\n\nFor an in-place form of f see the iip section below for details on in-place or out-of-place handling.\n\nIntegralFunction{iip,specialize}(f, [integrand_prototype])\n\nNote that only f is required, and in the case of inplace integrands a mutable container integrand_prototype to store the result of the integrand. If integrand_prototype is present, f is interpreted as in-place, and otherwise f is assumed to be out-of-place.\n\niip: In-Place vs Out-Of-Place\n\nOut-of-place functions must be of the form y = f(u p) and in-place functions of the form f(y u p), where y is a number or array containing the output. Since f is allowed to return any type (e.g. real or complex numbers or arrays), in-place functions must provide a container integrand_prototype that is of the right type and size for the variable y, and the result is written to this container in-place. When in-place forms are used, in-place array operations, i.e. broadcasting, may be used by algorithms to reduce allocations. If integrand_prototype is not provided, f is assumed to be out-of-place.\n\nspecialize\n\nThis field is currently unused\n\nFields\n\nThe fields of the IntegralFunction type directly match the names of the inputs.\n\n\n\n\n\n","category":"type"},{"location":"basics/IntegralFunction/#SciMLBase.BatchIntegralFunction","page":"Integral Functions","title":"SciMLBase.BatchIntegralFunction","text":"BatchIntegralFunction{iip,specialize,F,T} <: AbstractIntegralFunction{iip}\n\nA batched representation of an (non-batched) integrand f(u, p) that can be evaluated at multiple points simultaneously using threads, the gpu, or distributed memory defined by:\n\nby = bf(bu p)\n\nHere we prefix variables with b to indicate they are batched variables, which implies that they are arrays whose last dimension is reserved for batching different evaluation points, or function values, and may be of a variable length. bu is an array whose elements correspond to distinct evaluation points to f, and bf is a function to evaluate f 'point-wise' so that f(bu[..., i], p) == bf(bu, p)[..., i]. For example, a simple batching implementation of a scalar, univariate function is via broadcasting: bf(bu, p) = f.(bu, Ref(p)), although this interface exists in order to allow user parallelization. In general, the integration algorithm is allowed to vary the number of evaluation points between subsequent calls to bf.\n\nFor an in-place form of bf see the iip section below for details on in-place or out-of-place handling.\n\nBatchIntegralFunction{iip,specialize}(bf, [integrand_prototype];\n max_batch=typemax(Int))\n\nNote that only bf is required, and in the case of inplace integrands a mutable container integrand_prototype to store a batch of integrand evaluations, with a last \"batching\" dimension.\n\nThe keyword max_batch is used to set a soft limit on the number of points to batch at the same time so that memory usage is controlled.\n\nIf integrand_prototype is present, bf is interpreted as in-place, and otherwise bf is assumed to be out-of-place.\n\niip: In-Place vs Out-Of-Place\n\nOut-of-place functions must be of the form by = bf(bu, p) and in-place functions of the form bf(by, bu, p) where by is a batch array containing the output. Since the algorithm may vary the number of points to batch, the batching dimension can be of any length, including zero, and since bf is allowed to return arrays of any type (e.g. real or complex) or size, in-place functions must provide a container integrand_prototype of the desired type and size for by. If integrand_prototype is not provided, bf is assumed to be out-of-place.\n\nIn the out-of-place case, we require f(bu[..., i], p) == bf(bu, p)[..., i], and certain algorithms, such as those implemented in C, may infer the type or shape of by by calling bf with an empty array of input points, i.e. bu with size(bu)[end] == 0. Then it is expected for the resulting by to have the same type and size(by)[begin:end-1] for all subsequent calls.\n\nWhen the in-place form is used, we require f(by[..., i], bu[..., i], p) == bf(by, bu, p)[..., i] and size(by)[begin:end-1] == size(integrand_prototype)[begin:end-1]. The algorithm should always pass the integrand by arrays that are similar to integrand_prototype, and may use views and in-place array operations to reduce allocations.\n\nspecialize\n\nThis field is currently unused\n\nFields\n\nThe fields of the BatchIntegralFunction type are f, corresponding to bf above, and integrand_prototype.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#solvers","page":"Integral Solver Algorithms","title":"Integral Solver Algorithms","text":"","category":"section"},{"location":"solvers/IntegralSolvers/","page":"Integral Solver Algorithms","title":"Integral Solver Algorithms","text":"The following algorithms are available:","category":"page"},{"location":"solvers/IntegralSolvers/","page":"Integral Solver Algorithms","title":"Integral Solver Algorithms","text":"QuadGKJL: Uses QuadGK.jl, which supports one-dimensional integration of scalar and array-valued integrands with in-place or batched forms. Integrands that are both in-place and batched are implemented in the wrapper but are not supported under the hood.\nHCubatureJL: Uses HCubature.jl, which supports scalar and array-valued integrands and works best in low dimensions, e.g. ≤ 8. In-place integrands are implemented in the wrapper but are not supported under the hood. Batching is not supported.\nVEGAS: Uses MonteCarloIntegration.jl, which requires scalar, Float64-valued integrands and works in any number of dimensions.\nVEGASMC: Uses MCIntegration.jl. Requires using MCIntegration. Doesn't support batching.\nCubatureJLh: h-Cubature from Cubature.jl. Requires using Cubature.\nCubatureJLp: p-Cubature from Cubature.jl. Requires using Cubature.\nCubaVegas: Vegas from Cuba.jl. Requires using Cuba.\nCubaSUAVE: SUAVE from Cuba.jl. Requires using Cuba.\nCubaDivonne: Divonne from Cuba.jl. Requires using Cuba. Works only for >1-dimensional integrations.\nCubaCuhre: Cuhre from Cuba.jl. Requires using Cuba. Works only for >1-dimensional integrations.\nGaussLegendre: Performs fixed-order Gauss-Legendre quadrature. Requires using FastGaussQuadrature.\nQuadratureRule: Accepts a user-defined function that returns nodes and weights.\nArblibJL: real- and complex-valued univariate integration of holomorphic and meromorphic functions from Arblib.jl. Requires using Arblib.","category":"page"},{"location":"solvers/IntegralSolvers/","page":"Integral Solver Algorithms","title":"Integral Solver Algorithms","text":"QuadGKJL\nHCubatureJL\nCubatureJLp\nCubatureJLh\nVEGAS\nVEGASMC\nCubaVegas\nCubaSUAVE\nCubaDivonne\nCubaCuhre\nGaussLegendre\nQuadratureRule\nArblibJL","category":"page"},{"location":"solvers/IntegralSolvers/#Integrals.QuadGKJL","page":"Integral Solver Algorithms","title":"Integrals.QuadGKJL","text":"QuadGKJL(; order = 7, norm=norm)\n\nOne-dimensional Gauss-Kronrod integration from QuadGK.jl. This method also takes the optional arguments order and norm. Which are the order of the integration rule and the norm for calculating the error, respectively\n\nReferences\n\n@article{laurie1997calculation, title={Calculation of Gauss-Kronrod quadrature rules}, author={Laurie, Dirk}, journal={Mathematics of Computation}, volume={66}, number={219}, pages={1133–1145}, year={1997} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.HCubatureJL","page":"Integral Solver Algorithms","title":"Integrals.HCubatureJL","text":"HCubatureJL(; norm=norm, initdiv=1)\n\nMultidimensional \"h-adaptive\" integration from HCubature.jl. This method also takes the optional arguments initdiv and norm. Which are the initial number of segments each dimension of the integration domain is divided into, and the norm for calculating the error, respectively.\n\nReferences\n\n@article{genz1980remarks, title={Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region}, author={Genz, Alan C and Malik, Aftab Ahmad}, journal={Journal of Computational and Applied mathematics}, volume={6}, number={4}, pages={295–302}, year={1980}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubatureJLp","page":"Integral Solver Algorithms","title":"Integrals.CubatureJLp","text":"CubatureJLp(; error_norm=Cubature.INDIVIDUAL)\n\nMultidimensional p-adaptive integration from Cubature.jl. This method is based on repeatedly doubling the degree of the cubature rules, until convergence is achieved. The used cubature rule is a tensor product of Clenshaw–Curtis quadrature rules. error_norm specifies the convergence criterion for vector valued integrands. Defaults to Cubature.INDIVIDUAL, other options are Cubature.PAIRED, Cubature.L1, Cubature.L2, or Cubature.LINF.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubatureJLh","page":"Integral Solver Algorithms","title":"Integrals.CubatureJLh","text":"CubatureJLh(; error_norm=Cubature.INDIVIDUAL)\n\nMultidimensional h-adaptive integration from Cubature.jl. error_norm specifies the convergence criterion for vector valued integrands. Defaults to Cubature.INDIVIDUAL, other options are Cubature.PAIRED, Cubature.L1, Cubature.L2, or Cubature.LINF.\n\nReferences\n\n@article{genz1980remarks, title={Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region}, author={Genz, Alan C and Malik, Aftab Ahmad}, journal={Journal of Computational and Applied mathematics}, volume={6}, number={4}, pages={295–302}, year={1980}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.VEGAS","page":"Integral Solver Algorithms","title":"Integrals.VEGAS","text":"VEGAS(; nbins = 100, ncalls = 1000, debug=false)\n\nMultidimensional adaptive Monte Carlo integration from MonteCarloIntegration.jl. Importance sampling is used to reduce variance. This method also takes three optional arguments nbins, ncalls and debug which are the initial number of bins each dimension of the integration domain is divided into, the number of function calls per iteration of the algorithm, and whether debug info should be printed, respectively.\n\nLimitations\n\nThis algorithm can only integrate Float64-valued functions\n\nReferences\n\n@article{lepage1978new, title={A new algorithm for adaptive multidimensional integration}, author={Lepage, G Peter}, journal={Journal of Computational Physics}, volume={27}, number={2}, pages={192–203}, year={1978}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.VEGASMC","page":"Integral Solver Algorithms","title":"Integrals.VEGASMC","text":"VEGASMC(; kws...)\n\nMarkov-chain based Vegas algorithm from MCIntegration.jl\n\nRefer to MCIntegration.integrate for documentation on the keywords, which are passed directly to the solver with a set of defaults that works for conforming integrands.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubaVegas","page":"Integral Solver Algorithms","title":"Integrals.CubaVegas","text":"CubaVegas()\n\nMultidimensional adaptive Monte Carlo integration from Cuba.jl. Importance sampling is used to reduce variance.\n\nReferences\n\n@article{lepage1978new, title={A new algorithm for adaptive multidimensional integration}, author={Lepage, G Peter}, journal={Journal of Computational Physics}, volume={27}, number={2}, pages={192–203}, year={1978}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubaSUAVE","page":"Integral Solver Algorithms","title":"Integrals.CubaSUAVE","text":"CubaSUAVE()\n\nMultidimensional adaptive Monte Carlo integration from Cuba.jl. Suave stands for subregion-adaptive VEGAS. Importance sampling and subdivision are thus used to reduce variance.\n\nReferences\n\n@article{hahn2005cuba, title={Cuba—a library for multidimensional numerical integration}, author={Hahn, Thomas}, journal={Computer Physics Communications}, volume={168}, number={2}, pages={78–95}, year={2005}, publisher={Elsevier} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubaDivonne","page":"Integral Solver Algorithms","title":"Integrals.CubaDivonne","text":"CubaDivonne()\n\nMultidimensional adaptive Monte Carlo integration from Cuba.jl. Stratified sampling is used to reduce variance.\n\nReferences\n\n@article{friedman1981nested, title={A nested partitioning procedure for numerical multiple integration}, author={Friedman, Jerome H and Wright, Margaret H}, journal={ACM Transactions on Mathematical Software (TOMS)}, volume={7}, number={1}, pages={76–92}, year={1981}, publisher={ACM New York, NY, USA} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.CubaCuhre","page":"Integral Solver Algorithms","title":"Integrals.CubaCuhre","text":"CubaCuhre()\n\nMultidimensional h-adaptive integration from Cuba.jl.\n\nReferences\n\n@article{berntsen1991adaptive, title={An adaptive algorithm for the approximate calculation of multiple integrals}, author={Berntsen, Jarle and Espelid, Terje O and Genz, Alan}, journal={ACM Transactions on Mathematical Software (TOMS)}, volume={17}, number={4}, pages={437–451}, year={1991}, publisher={ACM New York, NY, USA} }\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.GaussLegendre","page":"Integral Solver Algorithms","title":"Integrals.GaussLegendre","text":"GaussLegendre{C, N, W}\n\nStruct for evaluating an integral via (composite) Gauss-Legendre quadrature. The field C will be true if subintervals > 1, and false otherwise.\n\nThe fields nodes::N and weights::W are defined by nodes, weights = gausslegendre(n) for a given number of nodes n.\n\nThe field subintervals::Int64 = 1 (with default value 1) defines the number of intervals to partition the original interval of integration [a, b] into, splitting it into [xⱼ, xⱼ₊₁] for j = 1,…,subintervals, where xⱼ = a + (j-1)h and h = (b-a)/subintervals. Gauss-Legendre quadrature is then applied on each subinterval. For example, if [a, b] = [-1, 1] and subintervals = 2, then Gauss-Legendre quadrature will be applied separately on [-1, 0] and [0, 1], summing the two results.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.QuadratureRule","page":"Integral Solver Algorithms","title":"Integrals.QuadratureRule","text":"QuadratureRule(q; n=250)\n\nAlgorithm to construct and evaluate a quadrature rule q of n points computed from the inputs as x, w = q(n). It assumes the nodes and weights are for the standard interval [-1, 1]^d in d dimensions, and rescales the nodes to the specific hypercube being solved. The nodes x may be scalars in 1d or vectors in arbitrary dimensions, and the weights w must be scalar. The algorithm computes the quadrature rule sum(w .* f.(x)) and the caller must check that the result is converged with respect to n.\n\n\n\n\n\n","category":"type"},{"location":"solvers/IntegralSolvers/#Integrals.ArblibJL","page":"Integral Solver Algorithms","title":"Integrals.ArblibJL","text":"ArblibJL(; check_analytic=false, take_prec=false, warn_on_no_convergence=false, opts=C_NULL)\n\nOne-dimensional adaptive Gauss-Legendre integration using rigorous error bounds and precision ball arithmetic. Generally this assumes the integrand is holomorphic or meromorphic, which is the user's responsibility to verify. The result of the integral is not guaranteed to satisfy the requested tolerances, however the result is guaranteed to be within the error estimate.\n\nArblib.jl only supports integration of univariate real- and complex-valued functions with both inplace and out-of-place forms. See their documentation for additional details the algorithm arguments and on implementing high-precision integrands. Additionally, the error estimate is included in the return value of the integral, representing a ball.\n\n\n\n\n\n","category":"type"}] } diff --git a/dev/solvers/IntegralSolvers/index.html b/dev/solvers/IntegralSolvers/index.html index 5e2db14..9514d0d 100644 --- a/dev/solvers/IntegralSolvers/index.html +++ b/dev/solvers/IntegralSolvers/index.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Integral Solver Algorithms · Integrals.jl</title><meta name="title" content="Integral Solver Algorithms · Integrals.jl"/><meta property="og:title" content="Integral Solver Algorithms · Integrals.jl"/><meta property="twitter:title" content="Integral Solver Algorithms · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/solvers/IntegralSolvers/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/solvers/IntegralSolvers/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/solvers/IntegralSolvers/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../../basics/IntegralProblem/">Integral Problems</a></li><li><a class="tocitem" href="../../basics/IntegralFunction/">Integral Functions</a></li><li><a class="tocitem" href="../../basics/SampledIntegralProblem/">Integrating pre-sampled data</a></li><li><a class="tocitem" href="../../basics/solve/">Common Solver Options (Solve Keyword Arguments)</a></li><li><a class="tocitem" href="../../basics/FAQ/">Frequently Asked Questions</a></li></ul></li><li><span class="tocitem">Solvers</span><ul><li class="is-active"><a class="tocitem" href>Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Solvers</a></li><li class="is-active"><a href>Integral Solver Algorithms</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Integral Solver Algorithms</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/solvers/IntegralSolvers.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="solvers"><a class="docs-heading-anchor" href="#solvers">Integral Solver Algorithms</a><a id="solvers-1"></a><a class="docs-heading-anchor-permalink" href="#solvers" title="Permalink"></a></h1><p>The following algorithms are available:</p><ul><li><code>QuadGKJL</code>: Uses QuadGK.jl, which supports one-dimensional integration of scalar and array-valued integrands with in-place or batched forms. Integrands that are both in-place and batched are implemented in the wrapper but are not supported under the hood.</li><li><code>HCubatureJL</code>: Uses HCubature.jl, which supports scalar and array-valued integrands and works best in low dimensions, e.g. ≤ 8. In-place integrands are implemented in the wrapper but are not supported under the hood. Batching is not supported.</li><li><code>VEGAS</code>: Uses MonteCarloIntegration.jl, which requires scalar, <code>Float64</code>-valued integrands and works in any number of dimensions.</li><li><code>VEGASMC</code>: Uses MCIntegration.jl. Requires <code>using MCIntegration</code>. Doesn't support batching.</li><li><code>CubatureJLh</code>: h-Cubature from Cubature.jl. Requires <code>using Cubature</code>.</li><li><code>CubatureJLp</code>: p-Cubature from Cubature.jl. Requires <code>using Cubature</code>.</li><li><code>CubaVegas</code>: Vegas from Cuba.jl. Requires <code>using Cuba</code>.</li><li><code>CubaSUAVE</code>: SUAVE from Cuba.jl. Requires <code>using Cuba</code>.</li><li><code>CubaDivonne</code>: Divonne from Cuba.jl. Requires <code>using Cuba</code>. Works only for <code>>1</code>-dimensional integrations.</li><li><code>CubaCuhre</code>: Cuhre from Cuba.jl. Requires <code>using Cuba</code>. Works only for <code>>1</code>-dimensional integrations.</li><li><code>GaussLegendre</code>: Performs fixed-order Gauss-Legendre quadrature. Requires <code>using FastGaussQuadrature</code>.</li><li><code>QuadratureRule</code>: Accepts a user-defined function that returns nodes and weights.</li><li><code>ArblibJL</code>: real- and complex-valued univariate integration of holomorphic and meromorphic functions from Arblib.jl. Requires <code>using Arblib</code>.</li></ul><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.QuadGKJL" href="#Integrals.QuadGKJL"><code>Integrals.QuadGKJL</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">QuadGKJL(; order = 7, norm=norm)</code></pre><p>One-dimensional Gauss-Kronrod integration from QuadGK.jl. This method also takes the optional arguments <code>order</code> and <code>norm</code>. Which are the order of the integration rule and the norm for calculating the error, respectively</p><p><strong>References</strong></p><p>@article{laurie1997calculation, title={Calculation of Gauss-Kronrod quadrature rules}, author={Laurie, Dirk}, journal={Mathematics of Computation}, volume={66}, number={219}, pages={1133–1145}, year={1997} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L1-L20">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.HCubatureJL" href="#Integrals.HCubatureJL"><code>Integrals.HCubatureJL</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">HCubatureJL(; norm=norm, initdiv=1)</code></pre><p>Multidimensional "h-adaptive" integration from HCubature.jl. This method also takes the optional arguments <code>initdiv</code> and <code>norm</code>. Which are the initial number of segments each dimension of the integration domain is divided into, and the norm for calculating the error, respectively.</p><p><strong>References</strong></p><p>@article{genz1980remarks, title={Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region}, author={Genz, Alan C and Malik, Aftab Ahmad}, journal={Journal of Computational and Applied mathematics}, volume={6}, number={4}, pages={295–302}, year={1980}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L27-L48">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubatureJLp" href="#Integrals.CubatureJLp"><code>Integrals.CubatureJLp</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubatureJLp()</code></pre><p>Multidimensional p-adaptive integration from Cubature.jl. This method is based on repeatedly doubling the degree of the cubature rules, until convergence is achieved. The used cubature rule is a tensor product of Clenshaw–Curtis quadrature rules. <code>error_norm</code> specifies the convergence criterion for vector valued integrands. Defaults to <code>Cubature.INDIVIDUAL</code>, other options are <code>Cubature.PAIRED</code>, <code>Cubature.L1</code>, <code>Cubature.L2</code>, or <code>Cubature.LINF</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L357-L367">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubatureJLh" href="#Integrals.CubatureJLh"><code>Integrals.CubatureJLh</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubatureJLh()</code></pre><p>Multidimensional h-adaptive integration from Cubature.jl. <code>error_norm</code> specifies the convergence criterion for vector valued integrands. Defaults to <code>Cubature.INDIVIDUAL</code>, other options are <code>Cubature.PAIRED</code>, <code>Cubature.L1</code>, <code>Cubature.L2</code>, or <code>Cubature.LINF</code>.</p><p><strong>References</strong></p><p>@article{genz1980remarks, title={Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region}, author={Genz, Alan C and Malik, Aftab Ahmad}, journal={Journal of Computational and Applied mathematics}, volume={6}, number={4}, pages={295–302}, year={1980}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L332-L352">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.VEGAS" href="#Integrals.VEGAS"><code>Integrals.VEGAS</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">VEGAS(; nbins = 100, ncalls = 1000, debug=false)</code></pre><p>Multidimensional adaptive Monte Carlo integration from MonteCarloIntegration.jl. Importance sampling is used to reduce variance. This method also takes three optional arguments <code>nbins</code>, <code>ncalls</code> and <code>debug</code> which are the initial number of bins each dimension of the integration domain is divided into, the number of function calls per iteration of the algorithm, and whether debug info should be printed, respectively.</p><p><strong>Limitations</strong></p><p>This algorithm can only integrate <code>Float64</code>-valued functions</p><p><strong>References</strong></p><p>@article{lepage1978new, title={A new algorithm for adaptive multidimensional integration}, author={Lepage, G Peter}, journal={Journal of Computational Physics}, volume={27}, number={2}, pages={192–203}, year={1978}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L55-L82">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.VEGASMC" href="#Integrals.VEGASMC"><code>Integrals.VEGASMC</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">VEGASMC(; kws...)</code></pre><p>Markov-chain based Vegas algorithm from MCIntegration.jl</p><p>Refer to <a href="https://numericaleft.github.io/MCIntegration.jl/dev/lib/montecarlo/#MCIntegration.integrate-Tuple{Function}"><code>MCIntegration.integrate</code></a> for documentation on the keywords, which are passed directly to the solver with a set of defaults that works for conforming integrands.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L398-L407">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubaVegas" href="#Integrals.CubaVegas"><code>Integrals.CubaVegas</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubaVegas()</code></pre><p>Multidimensional adaptive Monte Carlo integration from Cuba.jl. Importance sampling is used to reduce variance.</p><p><strong>References</strong></p><p>@article{lepage1978new, title={A new algorithm for adaptive multidimensional integration}, author={Lepage, G Peter}, journal={Journal of Computational Physics}, volume={27}, number={2}, pages={192–203}, year={1978}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L199-L217">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubaSUAVE" href="#Integrals.CubaSUAVE"><code>Integrals.CubaSUAVE</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubaSUAVE()</code></pre><p>Multidimensional adaptive Monte Carlo integration from Cuba.jl. Suave stands for subregion-adaptive VEGAS. Importance sampling and subdivision are thus used to reduce variance.</p><p><strong>References</strong></p><p>@article{hahn2005cuba, title={Cuba—a library for multidimensional numerical integration}, author={Hahn, Thomas}, journal={Computer Physics Communications}, volume={168}, number={2}, pages={78–95}, year={2005}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L226-L245">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubaDivonne" href="#Integrals.CubaDivonne"><code>Integrals.CubaDivonne</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubaDivonne()</code></pre><p>Multidimensional adaptive Monte Carlo integration from Cuba.jl. Stratified sampling is used to reduce variance.</p><p><strong>References</strong></p><p>@article{friedman1981nested, title={A nested partitioning procedure for numerical multiple integration}, author={Friedman, Jerome H and Wright, Margaret H}, journal={ACM Transactions on Mathematical Software (TOMS)}, volume={7}, number={1}, pages={76–92}, year={1981}, publisher={ACM New York, NY, USA} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L254-L272">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubaCuhre" href="#Integrals.CubaCuhre"><code>Integrals.CubaCuhre</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubaCuhre()</code></pre><p>Multidimensional h-adaptive integration from Cuba.jl.</p><p><strong>References</strong></p><p>@article{berntsen1991adaptive, title={An adaptive algorithm for the approximate calculation of multiple integrals}, author={Berntsen, Jarle and Espelid, Terje O and Genz, Alan}, journal={ACM Transactions on Mathematical Software (TOMS)}, volume={17}, number={4}, pages={437–451}, year={1991}, publisher={ACM New York, NY, USA} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L289-L306">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.GaussLegendre" href="#Integrals.GaussLegendre"><code>Integrals.GaussLegendre</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">GaussLegendre{C, N, W}</code></pre><p>Struct for evaluating an integral via (composite) Gauss-Legendre quadrature. The field <code>C</code> will be <code>true</code> if <code>subintervals > 1</code>, and <code>false</code> otherwise.</p><p>The fields <code>nodes::N</code> and <code>weights::W</code> are defined by <code>nodes, weights = gausslegendre(n)</code> for a given number of nodes <code>n</code>.</p><p>The field <code>subintervals::Int64 = 1</code> (with default value <code>1</code>) defines the number of intervals to partition the original interval of integration <code>[a, b]</code> into, splitting it into <code>[xⱼ, xⱼ₊₁]</code> for <code>j = 1,…,subintervals</code>, where <code>xⱼ = a + (j-1)h</code> and <code>h = (b-a)/subintervals</code>. Gauss-Legendre quadrature is then applied on each subinterval. For example, if <code>[a, b] = [-1, 1]</code> and <code>subintervals = 2</code>, then Gauss-Legendre quadrature will be applied separately on <code>[-1, 0]</code> and <code>[0, 1]</code>, summing the two results.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L90-L107">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.QuadratureRule" href="#Integrals.QuadratureRule"><code>Integrals.QuadratureRule</code></a> — <span class="docstring-category">Type</span></header><section><div><p>QuadratureRule(q; n=250)</p><p>Algorithm to construct and evaluate a quadrature rule <code>q</code> of <code>n</code> points computed from the inputs as <code>x, w = q(n)</code>. It assumes the nodes and weights are for the standard interval <code>[-1, 1]^d</code> in <code>d</code> dimensions, and rescales the nodes to the specific hypercube being solved. The nodes <code>x</code> may be scalars in 1d or vectors in arbitrary dimensions, and the weights <code>w</code> must be scalar. The algorithm computes the quadrature rule <code>sum(w .* f.(x))</code> and the caller must check that the result is converged with respect to <code>n</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L175-L184">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.ArblibJL" href="#Integrals.ArblibJL"><code>Integrals.ArblibJL</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">ArblibJL(; check_analytic=false, take_prec=false, warn_on_no_convergence=false, opts=C_NULL)</code></pre><p>One-dimensional adaptive Gauss-Legendre integration using rigorous error bounds and precision ball arithmetic. Generally this assumes the integrand is holomorphic or meromorphic, which is the user's responsibility to verify. The result of the integral is not guaranteed to satisfy the requested tolerances, however the result is guaranteed to be within the error estimate.</p><p><a href="https://github.com/kalmarek/Arblib.jl">Arblib.jl</a> only supports integration of univariate real- and complex-valued functions with both inplace and out-of-place forms. See their documentation for additional details the algorithm arguments and on implementing high-precision integrands. Additionally, the error estimate is included in the return value of the integral, representing a ball.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/a4476c0773b0970bd91e08aee329a1558734f5df/src/algorithms.jl#L373-L387">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../basics/FAQ/">« Frequently Asked Questions</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Integral Solver Algorithms · Integrals.jl</title><meta name="title" content="Integral Solver Algorithms · Integrals.jl"/><meta property="og:title" content="Integral Solver Algorithms · Integrals.jl"/><meta property="twitter:title" content="Integral Solver Algorithms · Integrals.jl"/><meta name="description" content="Documentation for Integrals.jl."/><meta property="og:description" content="Documentation for Integrals.jl."/><meta property="twitter:description" content="Documentation for Integrals.jl."/><meta property="og:url" content="https://docs.sciml.ai/Integrals/stable/solvers/IntegralSolvers/"/><meta property="twitter:url" content="https://docs.sciml.ai/Integrals/stable/solvers/IntegralSolvers/"/><link rel="canonical" href="https://docs.sciml.ai/Integrals/stable/solvers/IntegralSolvers/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.png" alt="Integrals.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Integrals.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Integrals.jl: Unified Integral Approximation Interface</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../../tutorials/numerical_integrals/">Numerically Solving Integrals</a></li><li><a class="tocitem" href="../../tutorials/differentiating_integrals/">Differentiating Integrals</a></li></ul></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../../basics/IntegralProblem/">Integral Problems</a></li><li><a class="tocitem" href="../../basics/IntegralFunction/">Integral Functions</a></li><li><a class="tocitem" href="../../basics/SampledIntegralProblem/">Integrating pre-sampled data</a></li><li><a class="tocitem" href="../../basics/solve/">Common Solver Options (Solve Keyword Arguments)</a></li><li><a class="tocitem" href="../../basics/FAQ/">Frequently Asked Questions</a></li></ul></li><li><span class="tocitem">Solvers</span><ul><li class="is-active"><a class="tocitem" href>Integral Solver Algorithms</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Solvers</a></li><li class="is-active"><a href>Integral Solver Algorithms</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Integral Solver Algorithms</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/SciML/Integrals.jl/blob/master/docs/src/solvers/IntegralSolvers.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="solvers"><a class="docs-heading-anchor" href="#solvers">Integral Solver Algorithms</a><a id="solvers-1"></a><a class="docs-heading-anchor-permalink" href="#solvers" title="Permalink"></a></h1><p>The following algorithms are available:</p><ul><li><code>QuadGKJL</code>: Uses QuadGK.jl, which supports one-dimensional integration of scalar and array-valued integrands with in-place or batched forms. Integrands that are both in-place and batched are implemented in the wrapper but are not supported under the hood.</li><li><code>HCubatureJL</code>: Uses HCubature.jl, which supports scalar and array-valued integrands and works best in low dimensions, e.g. ≤ 8. In-place integrands are implemented in the wrapper but are not supported under the hood. Batching is not supported.</li><li><code>VEGAS</code>: Uses MonteCarloIntegration.jl, which requires scalar, <code>Float64</code>-valued integrands and works in any number of dimensions.</li><li><code>VEGASMC</code>: Uses MCIntegration.jl. Requires <code>using MCIntegration</code>. Doesn't support batching.</li><li><code>CubatureJLh</code>: h-Cubature from Cubature.jl. Requires <code>using Cubature</code>.</li><li><code>CubatureJLp</code>: p-Cubature from Cubature.jl. Requires <code>using Cubature</code>.</li><li><code>CubaVegas</code>: Vegas from Cuba.jl. Requires <code>using Cuba</code>.</li><li><code>CubaSUAVE</code>: SUAVE from Cuba.jl. Requires <code>using Cuba</code>.</li><li><code>CubaDivonne</code>: Divonne from Cuba.jl. Requires <code>using Cuba</code>. Works only for <code>>1</code>-dimensional integrations.</li><li><code>CubaCuhre</code>: Cuhre from Cuba.jl. Requires <code>using Cuba</code>. Works only for <code>>1</code>-dimensional integrations.</li><li><code>GaussLegendre</code>: Performs fixed-order Gauss-Legendre quadrature. Requires <code>using FastGaussQuadrature</code>.</li><li><code>QuadratureRule</code>: Accepts a user-defined function that returns nodes and weights.</li><li><code>ArblibJL</code>: real- and complex-valued univariate integration of holomorphic and meromorphic functions from Arblib.jl. Requires <code>using Arblib</code>.</li></ul><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.QuadGKJL" href="#Integrals.QuadGKJL"><code>Integrals.QuadGKJL</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">QuadGKJL(; order = 7, norm=norm)</code></pre><p>One-dimensional Gauss-Kronrod integration from QuadGK.jl. This method also takes the optional arguments <code>order</code> and <code>norm</code>. Which are the order of the integration rule and the norm for calculating the error, respectively</p><p><strong>References</strong></p><p>@article{laurie1997calculation, title={Calculation of Gauss-Kronrod quadrature rules}, author={Laurie, Dirk}, journal={Mathematics of Computation}, volume={66}, number={219}, pages={1133–1145}, year={1997} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms.jl#L1-L20">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.HCubatureJL" href="#Integrals.HCubatureJL"><code>Integrals.HCubatureJL</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">HCubatureJL(; norm=norm, initdiv=1)</code></pre><p>Multidimensional "h-adaptive" integration from HCubature.jl. This method also takes the optional arguments <code>initdiv</code> and <code>norm</code>. Which are the initial number of segments each dimension of the integration domain is divided into, and the norm for calculating the error, respectively.</p><p><strong>References</strong></p><p>@article{genz1980remarks, title={Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region}, author={Genz, Alan C and Malik, Aftab Ahmad}, journal={Journal of Computational and Applied mathematics}, volume={6}, number={4}, pages={295–302}, year={1980}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms.jl#L27-L48">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubatureJLp" href="#Integrals.CubatureJLp"><code>Integrals.CubatureJLp</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubatureJLp(; error_norm=Cubature.INDIVIDUAL)</code></pre><p>Multidimensional p-adaptive integration from Cubature.jl. This method is based on repeatedly doubling the degree of the cubature rules, until convergence is achieved. The used cubature rule is a tensor product of Clenshaw–Curtis quadrature rules. <code>error_norm</code> specifies the convergence criterion for vector valued integrands. Defaults to <code>Cubature.INDIVIDUAL</code>, other options are <code>Cubature.PAIRED</code>, <code>Cubature.L1</code>, <code>Cubature.L2</code>, or <code>Cubature.LINF</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_extension.jl#L182-L192">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubatureJLh" href="#Integrals.CubatureJLh"><code>Integrals.CubatureJLh</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubatureJLh(; error_norm=Cubature.INDIVIDUAL)</code></pre><p>Multidimensional h-adaptive integration from Cubature.jl. <code>error_norm</code> specifies the convergence criterion for vector valued integrands. Defaults to <code>Cubature.INDIVIDUAL</code>, other options are <code>Cubature.PAIRED</code>, <code>Cubature.L1</code>, <code>Cubature.L2</code>, or <code>Cubature.LINF</code>.</p><p><strong>References</strong></p><p>@article{genz1980remarks, title={Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region}, author={Genz, Alan C and Malik, Aftab Ahmad}, journal={Journal of Computational and Applied mathematics}, volume={6}, number={4}, pages={295–302}, year={1980}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_extension.jl#L153-L173">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.VEGAS" href="#Integrals.VEGAS"><code>Integrals.VEGAS</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">VEGAS(; nbins = 100, ncalls = 1000, debug=false)</code></pre><p>Multidimensional adaptive Monte Carlo integration from MonteCarloIntegration.jl. Importance sampling is used to reduce variance. This method also takes three optional arguments <code>nbins</code>, <code>ncalls</code> and <code>debug</code> which are the initial number of bins each dimension of the integration domain is divided into, the number of function calls per iteration of the algorithm, and whether debug info should be printed, respectively.</p><p><strong>Limitations</strong></p><p>This algorithm can only integrate <code>Float64</code>-valued functions</p><p><strong>References</strong></p><p>@article{lepage1978new, title={A new algorithm for adaptive multidimensional integration}, author={Lepage, G Peter}, journal={Journal of Computational Physics}, volume={27}, number={2}, pages={192–203}, year={1978}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms.jl#L55-L82">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.VEGASMC" href="#Integrals.VEGASMC"><code>Integrals.VEGASMC</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">VEGASMC(; kws...)</code></pre><p>Markov-chain based Vegas algorithm from MCIntegration.jl</p><p>Refer to <a href="https://numericaleft.github.io/MCIntegration.jl/dev/lib/montecarlo/#MCIntegration.integrate-Tuple{Function}"><code>MCIntegration.integrate</code></a> for documentation on the keywords, which are passed directly to the solver with a set of defaults that works for conforming integrands.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_extension.jl#L229-L238">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubaVegas" href="#Integrals.CubaVegas"><code>Integrals.CubaVegas</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubaVegas()</code></pre><p>Multidimensional adaptive Monte Carlo integration from Cuba.jl. Importance sampling is used to reduce variance.</p><p><strong>References</strong></p><p>@article{lepage1978new, title={A new algorithm for adaptive multidimensional integration}, author={Lepage, G Peter}, journal={Journal of Computational Physics}, volume={27}, number={2}, pages={192–203}, year={1978}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_extension.jl#L7-L25">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubaSUAVE" href="#Integrals.CubaSUAVE"><code>Integrals.CubaSUAVE</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubaSUAVE()</code></pre><p>Multidimensional adaptive Monte Carlo integration from Cuba.jl. Suave stands for subregion-adaptive VEGAS. Importance sampling and subdivision are thus used to reduce variance.</p><p><strong>References</strong></p><p>@article{hahn2005cuba, title={Cuba—a library for multidimensional numerical integration}, author={Hahn, Thomas}, journal={Computer Physics Communications}, volume={168}, number={2}, pages={78–95}, year={2005}, publisher={Elsevier} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_extension.jl#L35-L54">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubaDivonne" href="#Integrals.CubaDivonne"><code>Integrals.CubaDivonne</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubaDivonne()</code></pre><p>Multidimensional adaptive Monte Carlo integration from Cuba.jl. Stratified sampling is used to reduce variance.</p><p><strong>References</strong></p><p>@article{friedman1981nested, title={A nested partitioning procedure for numerical multiple integration}, author={Friedman, Jerome H and Wright, Margaret H}, journal={ACM Transactions on Mathematical Software (TOMS)}, volume={7}, number={1}, pages={76–92}, year={1981}, publisher={ACM New York, NY, USA} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_extension.jl#L64-L82">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.CubaCuhre" href="#Integrals.CubaCuhre"><code>Integrals.CubaCuhre</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CubaCuhre()</code></pre><p>Multidimensional h-adaptive integration from Cuba.jl.</p><p><strong>References</strong></p><p>@article{berntsen1991adaptive, title={An adaptive algorithm for the approximate calculation of multiple integrals}, author={Berntsen, Jarle and Espelid, Terje O and Genz, Alan}, journal={ACM Transactions on Mathematical Software (TOMS)}, volume={17}, number={4}, pages={437–451}, year={1991}, publisher={ACM New York, NY, USA} }</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_extension.jl#L100-L117">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.GaussLegendre" href="#Integrals.GaussLegendre"><code>Integrals.GaussLegendre</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">GaussLegendre{C, N, W}</code></pre><p>Struct for evaluating an integral via (composite) Gauss-Legendre quadrature. The field <code>C</code> will be <code>true</code> if <code>subintervals > 1</code>, and <code>false</code> otherwise.</p><p>The fields <code>nodes::N</code> and <code>weights::W</code> are defined by <code>nodes, weights = gausslegendre(n)</code> for a given number of nodes <code>n</code>.</p><p>The field <code>subintervals::Int64 = 1</code> (with default value <code>1</code>) defines the number of intervals to partition the original interval of integration <code>[a, b]</code> into, splitting it into <code>[xⱼ, xⱼ₊₁]</code> for <code>j = 1,…,subintervals</code>, where <code>xⱼ = a + (j-1)h</code> and <code>h = (b-a)/subintervals</code>. Gauss-Legendre quadrature is then applied on each subinterval. For example, if <code>[a, b] = [-1, 1]</code> and <code>subintervals = 2</code>, then Gauss-Legendre quadrature will be applied separately on <code>[-1, 0]</code> and <code>[0, 1]</code>, summing the two results.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms.jl#L90-L107">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.QuadratureRule" href="#Integrals.QuadratureRule"><code>Integrals.QuadratureRule</code></a> — <span class="docstring-category">Type</span></header><section><div><p>QuadratureRule(q; n=250)</p><p>Algorithm to construct and evaluate a quadrature rule <code>q</code> of <code>n</code> points computed from the inputs as <code>x, w = q(n)</code>. It assumes the nodes and weights are for the standard interval <code>[-1, 1]^d</code> in <code>d</code> dimensions, and rescales the nodes to the specific hypercube being solved. The nodes <code>x</code> may be scalars in 1d or vectors in arbitrary dimensions, and the weights <code>w</code> must be scalar. The algorithm computes the quadrature rule <code>sum(w .* f.(x))</code> and the caller must check that the result is converged with respect to <code>n</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms.jl#L131-L140">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Integrals.ArblibJL" href="#Integrals.ArblibJL"><code>Integrals.ArblibJL</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">ArblibJL(; check_analytic=false, take_prec=false, warn_on_no_convergence=false, opts=C_NULL)</code></pre><p>One-dimensional adaptive Gauss-Legendre integration using rigorous error bounds and precision ball arithmetic. Generally this assumes the integrand is holomorphic or meromorphic, which is the user's responsibility to verify. The result of the integral is not guaranteed to satisfy the requested tolerances, however the result is guaranteed to be within the error estimate.</p><p><a href="https://github.com/kalmarek/Arblib.jl">Arblib.jl</a> only supports integration of univariate real- and complex-valued functions with both inplace and out-of-place forms. See their documentation for additional details the algorithm arguments and on implementing high-precision integrands. Additionally, the error estimate is included in the return value of the integral, representing a ball.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/Integrals.jl/blob/0286acb5863d1ba77d55b6808f08833b776f8d2e/src/algorithms_extension.jl#L203-L217">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../basics/FAQ/">« Frequently Asked Questions</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/tutorials/caching_interface/index.html b/dev/tutorials/caching_interface/index.html index 4be4c64..eca5b3b 100644 --- a/dev/tutorials/caching_interface/index.html +++ b/dev/tutorials/caching_interface/index.html @@ -68,4 +68,4 @@ 0.35130314420012265 0.32000752789011855 0.28551450214186125 - 0.24816870986674897</code></pre></article><nav class="docs-footer"><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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> + 0.24816870986674897</code></pre></article><nav class="docs-footer"><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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/tutorials/differentiating_integrals/index.html b/dev/tutorials/differentiating_integrals/index.html index 455cca1..67ead2d 100644 --- a/dev/tutorials/differentiating_integrals/index.html +++ b/dev/tutorials/differentiating_integrals/index.html @@ -12,4 +12,4 @@ dp1 = Zygote.gradient(testf,p) dp2 = FiniteDiff.finite_difference_gradient(testf, p) dp3 = ForwardDiff.gradient(testf, p) -dp1[1] ≈ dp2 ≈ dp3</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">true</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../numerical_integrals/">« Numerically Solving Integrals</a><a class="docs-footer-nextpage" href="../../basics/IntegralProblem/">Integral Problems »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +dp1[1] ≈ dp2 ≈ dp3</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">true</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../numerical_integrals/">« Numerically Solving Integrals</a><a class="docs-footer-nextpage" href="../../basics/IntegralProblem/">Integral Problems »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/tutorials/numerical_integrals/index.html b/dev/tutorials/numerical_integrals/index.html index 1f40221..2cbd641 100644 --- a/dev/tutorials/numerical_integrals/index.html +++ b/dev/tutorials/numerical_integrals/index.html @@ -71,4 +71,4 @@ domain = ([-Inf, 0.0], [Inf, Inf]) # (lb, ub) prob = IntegralProblem(f, domain) solve(prob, HCubatureJL(), reltol = 1e-3, abstol = 1e-3)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">retcode: Success -u: 0.49995156348205083</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../">« Integrals.jl: Unified Integral Approximation Interface</a><a class="docs-footer-nextpage" href="../differentiating_integrals/">Differentiating Integrals »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Friday 16 February 2024 12:08">Friday 16 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +u: 0.49995156348205083</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../">« Integrals.jl: Unified Integral Approximation Interface</a><a class="docs-footer-nextpage" href="../differentiating_integrals/">Differentiating Integrals »</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><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Sunday 18 February 2024 10:49">Sunday 18 February 2024</span>. Using Julia version 1.10.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>