Symbolic Integral Using SymbolicNumericIntegration Error Message Reported

I’m trying to do the subsequent symbolic integral following the tutorial of SymbolicNumericIntegration at https://docs.sciml.ai/SymbolicNumericIntegration/stable/

using Symbolics
using SymbolicNumericIntegration
@variables x a b
integrate(3x^3 + 2x - 5)

But I met the following error:

Blockquote
ERROR: Sym doesn’t have a operation or arguments!
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] error_sym()
@ SymbolicUtils ~/.julia/packages/SymbolicUtils/qyMYa/src/types.jl:82
[3] operation(x::SymbolicUtils.BasicSymbolic{Real})
@ SymbolicUtils ~/.julia/packages/SymbolicUtils/qyMYa/src/types.jl:112
[4] (::SymbolicUtils.Rewriters.Walk{…})(x::SymbolicUtils.BasicSymbolic{…})
@ SymbolicUtils.Rewriters ~/.julia/packages/SymbolicUtils/qyMYa/src/rewriters.jl:205
[5] kernel(eq::SymbolicUtils.BasicSymbolic{Real})
@ SymbolicNumericIntegration ~/.julia/packages/SymbolicNumericIntegration/f3wPh/src/rules.jl:95
[6] generate_basis(eq::SymbolicNumericIntegration.ExprCache, x::SymbolicUtils.BasicSymbolic{Real}, try_kernel::Bool)
@ SymbolicNumericIntegration ~/.julia/packages/SymbolicNumericIntegration/f3wPh/src/candidates.jl:15
[7] integrate_term(eq::SymbolicUtils.BasicSymbolic{…}, x::SymbolicUtils.BasicSymbolic{…}; kwargs::@Kwargs{…})
@ SymbolicNumericIntegration ~/.julia/packages/SymbolicNumericIntegration/f3wPh/src/integral.jl:246
[8] integrate_sum(eq::Num, x::SymbolicUtils.BasicSymbolic{…}; bypass::Bool, kwargs::@Kwargs{…})
@ SymbolicNumericIntegration ~/.julia/packages/SymbolicNumericIntegration/f3wPh/src/integral.jl:171
[9] integrate(eq::Num, x::Nothing; abstol::Float64, num_steps::Int64, num_trials::Int64, radius::Float64, show_basis::Bool, opt::DataDrivenSparse.STLSQ{…}, bypass::Bool, symbolic::Bool, max_basis::Int64, verbose::Bool, complex_plane::Bool, homotopy::Bool, use_optim::Bool, detailed::Bool)
@ SymbolicNumericIntegration ~/.julia/packages/SymbolicNumericIntegration/f3wPh/src/integral.jl:102
[10] integrate(eq::Num, x::Nothing)
@ SymbolicNumericIntegration ~/.julia/packages/SymbolicNumericIntegration/f3wPh/src/integral.jl:58
[11] top-level scope
@ REPL[8]:1
Some type information was truncated. Use show(err) to see complete types.
Blockquote

This follows the very basic usage of the tutorial so I suppose it should not report any problems. The version is v1.6.0 for SymbolicNumericIntegration.

I can replicate this with

(jl_LjtgCB) pkg> st
Status `\Temp\jl_LjtgCB\Project.toml`
  [78aadeae] SymbolicNumericIntegration v1.6.0
⌅ [0c5d862f] Symbolics v5.28.0

which appears to match the versions used in the doc build - @ChrisRackauckas looks like something is off here?

Looks like we had a hiccup. Should be fixed on latest now.

2 Likes

Thank you very much! It worked!

I advice using SymPy:

using SymPy

x = symbols(:x)
a = symbols(:a)
b = symbols(:b)

f = 3x^3 + 2x - 5 + log(a + b)

I = integrate(f, x) |> srting

“3x^4/4 + x^2 + x(log(a + b) - 5)”

I converted the result as string since the result is symbolic.

Have fun :slight_smile:

1 Like