Common Solver Options (Solve Keyword Arguments)
solve is the generic SciMLBase interface reexported by Integrals.jl. Integrals.jl implements it for integral problems and the algorithms documented on this site.
CommonSolve.solve — Method
solve(prob::IntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)Solve an integral problem with the specified integration algorithm.
Arguments
prob: Integral problem containing the integrand, domain, parameters, and problem keyword options.alg: Integration algorithm, such asQuadGKJL(),HCubatureJL(), or another subtype ofSciMLBase.AbstractIntegralAlgorithm.
Keyword Arguments
The arguments to solve are common across all of the quadrature methods. These common arguments are:
maxiters: Maximum number of algorithm iterations or backend evaluations.abstol: Absolute tolerance for the integral residual/error estimate.reltol: Relative tolerance for the integral residual/error estimate.verbose: Verbosity control viaIntegralVerbosity. Defaults toIntegralVerbosity().
Returns
Returns a SciMLBase integral solution whose u field is the integral estimate and whose resid field is the backend residual or error estimate when available.
Example
using Integrals
prob = IntegralProblem((x, p) -> sin(x), (0.0, pi))
sol = solve(prob, QuadGKJL(); reltol = 1e-10, abstol = 1e-10)CommonSolve.solve — Method
solve(prob::SampledIntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)Integrate sampled data with a sampled-data quadrature algorithm.
Arguments
prob: Sampled integral problem containing sampled valuesy, sampling pointsx, and the integration dimension.alg: Sampled-data integration algorithm, such asTrapezoidalRule()orSimpsonsRule().
Keyword Arguments
There are no algorithm-independent keyword arguments used to solve SampledIntegralProblems.
Returns
Returns a SciMLBase integral solution whose u field is the sampled integral estimate.
Example
using Integrals
x = range(0, 1, length = 21)
prob = SampledIntegralProblem(x .^ 2, x)
sol = solve(prob, SimpsonsRule())Related SciML interface utilities
init, solve!, isinplace, remake, and ReturnCode are SciMLBase interface utilities reexported by Integrals.jl. Their API is documented by SciMLBase.
CommonSolve.init — Method
init(prob::IntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)Initialize a reusable integral solver cache for prob and alg.
Arguments
prob: Integral problem containing the integrand, domain, parameters, and problem keyword options.alg: Integration algorithm, such asQuadGKJL(),HCubatureJL(), or another subtype ofSciMLBase.AbstractIntegralAlgorithm.
Keyword Arguments
sensealg: Sensitivity algorithm used by automatic differentiation paths. Defaults toReCallVJP(ZygoteVJP()).verbose: Verbosity control viaIntegralVerbosity. Defaults toIntegralVerbosity().do_inf_transformation: Deprecated. Infinite-domain transformations are always applied when needed.- Additional keyword arguments are forwarded to the eventual solve.
Returns
Returns an internal cache object that stores the transformed algorithm, cached backend state, verbosity settings, and solve keyword arguments for reuse with solve!.
Example
using Integrals
prob = IntegralProblem((x, p) -> sin(x), (0.0, pi))
cache = init(prob, QuadGKJL(); reltol = 1e-10)
solve!(cache)CommonSolve.init — Method
init(prob::SampledIntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)Initialize a reusable sampled-data integral solver cache.
Arguments
prob: Sampled integral problem containing sampled values, sampling points, and the integration dimension.alg: Sampled-data integration algorithm, such asTrapezoidalRule()orSimpsonsRule().
Keyword Arguments
verbose: Verbosity control viaIntegralVerbosity. Defaults toIntegralVerbosity().
No other keyword arguments are accepted by this cache initializer.
Returns
Returns an internal cache object that can be reused with solve!. Updating the sample locations marks the cached weights stale so they are recomputed before the next solve.
Example
using Integrals
x = range(0, 1, length = 21)
prob = SampledIntegralProblem(x .^ 2, x)
cache = init(prob, SimpsonsRule())
solve!(cache)CommonSolve.solve! — Method
solve!(cache::IntegralCache)Solve an initialized integral cache.
Arguments
cache: Cache returned byinitfor anIntegralProblem.
Returns
Returns a SciMLBase integral solution whose u field is the integral estimate and whose resid field is the backend residual or error estimate when available.
Example
using Integrals
prob = IntegralProblem((x, p) -> x^2, (0.0, 1.0))
cache = init(prob, QuadGKJL())
sol = solve!(cache)CommonSolve.solve! — Method
solve!(cache::SampledIntegralCache)Solve an initialized sampled-data integral cache.
Arguments
cache: Cache returned byinitfor aSampledIntegralProblem.
Returns
Returns a SciMLBase integral solution whose u field is the sampled integral estimate.
Example
using Integrals
x = range(0, 1, length = 21)
prob = SampledIntegralProblem(x .^ 2, x)
cache = init(prob, TrapezoidalRule())
sol = solve!(cache)SciMLBase.isinplace — Method
isinplace(cache::IntegralCache) -> BoolReturn whether an initialized integral cache wraps an in-place integrand.
Arguments
cache: Cache returned byinitfor anIntegralProblem.
Returns
Returns true when the cached integral function mutates its output argument, and false otherwise.
Example
using Integrals
prob = IntegralProblem((x, p) -> x^2, (0.0, 1.0))
cache = init(prob, QuadGKJL())
isinplace(cache)