Public API

SymbolicNumericIntegration.integrate — Function
integrate(eq, x; kwargs...)

Compute an indefinite or definite integral of a scalar symbolic expression.

integrate combines symbolic candidate generation with numerical verification. It accepts expressions constructed by Symbolics.jl and returns a detailed result by default so callers can distinguish a complete solution from a partial one.

julia> using Symbolics, SymbolicNumericIntegration

julia> @variables x a

julia> integrate(x * sin(2x))
((1//4)*sin(2x) - (1//2)*x*cos(2x), 0, 0)

julia> integrate(x * sin(a * x), x; symbolic = true, detailed = false)
(sin(a*x) - a*x*cos(a*x)) / (a^2)

julia> integrate(x * sin(a * x), (x, 0, 1); symbolic = true, detailed = false)
(sin(a) - a*cos(a)) / (a^2)

Arguments

  • eq: Scalar symbolic integrand. Arrays are rejected; use broadcasting for elementwise integration.
  • x: Independent symbolic variable. Omit it only for an expression with exactly one variable. Pass (x, lower, upper) to request a definite integral.

Keyword Arguments

  • abstol (default: 1e-6): the desired tolerance
  • num_steps (default: 2): the number of different steps with expanding basis to be tried
  • num_trials (default: 10): the number of trials in each step (no changes to the basis)
  • show_basis (default: false): Print the generated candidate basis.
  • bypass (default: false): Solve the complete expression rather than splitting it into terms.
  • symbolic (default: false): Attempt the symbolic solver first. This is forced when the integrand has symbolic constants.
  • max_basis (default: 100): the maximum number of candidate terms to consider
  • verbose (default: false): Print solver diagnostics.
  • complex_plane (default: true): Sample verification points in the complex plane. Set to false to sample on the real axis.
  • radius (default: 5.0): Radius of the verification-point disk.
  • opt (default: STLSQ(exp.(-10:1:0))): the sparse regression optimizer (from DataDrivenSparse)
  • homotopy (default: true): deprecated, will be removed in a future version
  • use_optim (default: false): deprecated, will be removed in a future version
  • detailed (default: true): Return (solved, unsolved, err). When false, return only a complete solution or nothing.

Returns

When detailed = true, return (solved, unsolved, err), where

solved: the solved integral
unsolved: the residual unsolved portion of the input
err: the numerical error in reaching the solution

When detailed = false, return the complete integral or nothing.

source
SymbolicNumericIntegration.Ei — Function
Ei(z)

Return the exponential integral evaluated at z as a Complex value.

Arguments

  • z: Real or complex evaluation point.

Examples

julia> Ei(1) isa Complex
true
source
SymbolicNumericIntegration.Si — Function
Si(z)

Return the sine integral evaluated at z as a Complex value.

Arguments

  • z: Real or complex evaluation point.

Examples

julia> Si(1) isa Complex
true
source
SymbolicNumericIntegration.Ci — Function
Ci(z)

Return the cosine integral evaluated at z as a Complex value.

Arguments

  • z: Real or complex evaluation point.

Examples

julia> Ci(1) isa Complex
true
source
SymbolicNumericIntegration.Li — Function
Li(z)

Return the logarithmic integral evaluated at z as a Complex value.

Arguments

  • z: Real or complex evaluation point.

Examples

julia> Li(3) isa Complex
true
source
SymbolicNumericIntegration.generate_basis — Function
generate_basis(eq, x, try_kernel = true)

Generate candidate antiderivative terms for a symbolic-numeric integration problem.

Arguments

  • eq: Scalar symbolic integrand.
  • x: Independent symbolic variable.
  • try_kernel: Whether to factor candidate kernels before generating terms.

Returns

A vector of internal cached symbolic expressions. Pass the result to best_hints or use it to inspect the candidate basis; it is not a stable cache representation.

Examples

julia> using Symbolics, SymbolicNumericIntegration

julia> @variables x

julia> !isempty(generate_basis(x^2, x))
true
source
SymbolicNumericIntegration.best_hints — Function
best_hints(eq, x, basis; plan = default_plan(), num_trials = 10)

Select a compact successful candidate basis from repeated numerical trials.

Arguments

  • eq: Scalar symbolic integrand.
  • x: Independent symbolic variable.
  • basis: Candidate terms, typically from generate_basis(eq, x).

Keyword Arguments

  • plan: Numerical verification configuration used for every trial.
  • num_trials: Number of candidate-selection trials.

Returns

The shortest successful vector of basis terms, or nothing when no trial passes the numerical residual tolerance.

source