1
1
# Integrals.jl
2
2
3
3
[ ![ Build Status] ( https://github.com/SciML/Integrals.jl/workflows/CI/badge.svg )] ( https://github.com/SciML/Integrals.jl/actions?query=workflow%3ACI )
4
+ [ ![ Stable] ( https://img.shields.io/badge/docs-stable-blue.svg )] ( http://integrals.sciml.ai/stable/ )
5
+ [ ![ Dev] ( https://img.shields.io/badge/docs-dev-blue.svg )] ( http://integrals.sciml.ai/dev/ )
4
6
5
7
Integrals.jl is an instantiation of the SciML common ` IntegralProblem `
6
8
interface for the common quadrature packages of Julia. By using Integrals.jl,
@@ -9,6 +11,13 @@ standardized throughout the various integrator libraries. This can be useful
9
11
for benchmarking or for library implementations, since libraries which internally
10
12
use a quadrature can easily accept a quadrature method as an argument.
11
13
14
+ ## Tutorials and Documentation
15
+
16
+ For information on using the package,
17
+ [ see the stable documentation] ( https://integrals.sciml.ai/stable/ ) . Use the
18
+ [ in-development documentation] ( https://integrals.sciml.ai/dev/ ) for the version of
19
+ the documentation, which contains the unreleased features.
20
+
12
21
## Examples
13
22
14
23
For basic multidimensional quadrature we can construct and solve a ` IntegralProblem ` :
@@ -41,78 +50,4 @@ the change is a one-argument change:
41
50
``` julia
42
51
using IntegralsCuba
43
52
sol = solve (prob,CubaCuhre (),reltol= 1e-3 ,abstol= 1e-3 )
44
- ```
45
-
46
- ## Differentiability
47
-
48
- Integrals.jl is a fully differentiable quadrature library. Thus, it adds the
49
- ability to perform automatic differentiation over any of the libraries that it
50
- calls. It integrates with ForwardDiff.jl for forward-mode automatic differentiation
51
- and Zygote.jl for reverse-mode automatic differentiation. For example:
52
-
53
- ``` julia
54
- using Integrals, ForwardDiff, FiniteDiff, Zygote, Cuba
55
- f (x,p) = sum (sin .(x .* p))
56
- lb = ones (2 )
57
- ub = 3 ones (2 )
58
- p = [1.5 ,2.0 ]
59
-
60
- function testf (p)
61
- prob = IntegralProblem (f,lb,ub,p)
62
- sin (solve (prob,CubaCuhre (),reltol= 1e-6 ,abstol= 1e-6 )[1 ])
63
- end
64
- dp1 = Zygote. gradient (testf,p)
65
- dp2 = FiniteDiff. finite_difference_gradient (testf,p)
66
- dp3 = ForwardDiff. gradient (testf,p)
67
- dp1[1 ] ≈ dp2 ≈ dp3
68
- ```
69
-
70
- ## IntegralProblem
71
-
72
- To use this package, you always construct a ` IntegralProblem ` . This has a
73
- constructor:
74
-
75
- ``` julia
76
- IntegralProblem (f,lb,ub,p= NullParameters ();
77
- nout= 1 , batch = 0 , kwargs... )
78
- ```
79
-
80
- - ` f ` : Either a function ` f(x,p) ` for out-of-place or ` f(dx,x,p) ` for in-place.
81
- - ` lb ` : Either a number or vector of lower bounds.
82
- - ` ub ` : Either a number or vector of upper bounds.
83
- - ` p ` : The parameters associated with the problem.
84
- - ` nout ` : The output size of the function ` f ` . Defaults to ` 1 ` , i.e., a scalar
85
- integral output.
86
- - ` batch ` : The preferred number of points to batch. This allows user-side
87
- parallelization of the integrand. If ` batch != 0 ` , then each ` x[:,i] ` is a
88
- different point of the integral to calculate, and the output should be
89
- ` nout x batchsize ` . Note that ` batch ` is a suggestion for the number of points,
90
- and it is not necessarily true that ` batch ` is the same as ` batchsize ` in all
91
- algorithms.
92
-
93
- Additionally, we can supply ` iip ` like ` IntegralProblem{iip}(...) ` as true or
94
- false to declare at compile time whether the integrator function is in-place.
95
-
96
- ## Algorithms
97
-
98
- The following algorithms are available:
99
-
100
- - ` QuadGKJL ` : Uses QuadGK.jl. Requires ` nout=1 ` and ` batch=0 ` .
101
- - ` HCubatureJL ` : Uses HCubature.jl. Requires ` batch=0 ` .
102
- - ` VEGAS ` : Uses MonteCarloIntegration.jl. Requires ` nout=1 ` .
103
- - ` CubatureJLh ` : h-Cubature from Cubature.jl. Requires ` using IntegralsCubature ` .
104
- - ` CubatureJLp ` : p-Cubature from Cubature.jl. Requires ` using IntegralsCubature ` .
105
- - ` CubaVegas ` : Vegas from Cuba.jl. Requires ` using IntegralsCuba ` .
106
- - ` CubaSUAVE ` : SUAVE from Cuba.jl. Requires ` using IntegralsCuba ` .
107
- - ` CubaDivonne ` : Divonne from Cuba.jl. Requires ` using IntegralsCuba ` .
108
- - ` CubaCuhre ` : Cuhre from Cuba.jl. Requires ` using IntegralsCuba ` .
109
-
110
- ## Common Solve Keyword Arguments
111
-
112
- - ` reltol ` : Relative tolerance
113
- - ` abstol ` : Absolute tolerance
114
- - ` maxiters ` : The maximum number of iterations
115
-
116
- Additionally, the extra keyword arguments are splatted to the library calls, so
117
- see the documentation of the integrator library for all of the extra details.
118
- These extra keyword arguments are not guaranteed to act uniformly.
53
+ ```
0 commit comments