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.solveMethod
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 as QuadGKJL(), HCubatureJL(), or another subtype of SciMLBase.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 via IntegralVerbosity. Defaults to IntegralVerbosity().

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)
source
CommonSolve.solveMethod
solve(prob::SampledIntegralProblem, alg::SciMLBase.AbstractIntegralAlgorithm; kwargs...)

Integrate sampled data with a sampled-data quadrature algorithm.

Arguments

  • prob: Sampled integral problem containing sampled values y, sampling points x, and the integration dimension.
  • alg: Sampled-data integration algorithm, such as TrapezoidalRule() or SimpsonsRule().

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())
source

init, solve!, isinplace, remake, and ReturnCode are SciMLBase interface utilities reexported by Integrals.jl. Their API is documented by SciMLBase.

CommonSolve.initMethod
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 as QuadGKJL(), HCubatureJL(), or another subtype of SciMLBase.AbstractIntegralAlgorithm.

Keyword Arguments

  • sensealg: Sensitivity algorithm used by automatic differentiation paths. Defaults to ReCallVJP(ZygoteVJP()).
  • verbose: Verbosity control via IntegralVerbosity. Defaults to IntegralVerbosity().
  • 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)
source
CommonSolve.initMethod
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 as TrapezoidalRule() or SimpsonsRule().

Keyword Arguments

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)
source
CommonSolve.solve!Method
solve!(cache::IntegralCache)

Solve an initialized integral cache.

Arguments

  • cache: Cache returned by init for an IntegralProblem.

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)
source
CommonSolve.solve!Method
solve!(cache::SampledIntegralCache)

Solve an initialized sampled-data integral cache.

Arguments

  • cache: Cache returned by init for a SampledIntegralProblem.

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)
source
SciMLBase.isinplaceMethod
isinplace(cache::IntegralCache) -> Bool

Return whether an initialized integral cache wraps an in-place integrand.

Arguments

  • cache: Cache returned by init for an IntegralProblem.

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)
source