So for me it also doesn’t work:
julia> Pkg.activate(;temp=true); Pkg.add("Symbolics"); using Symbolics
# ...
Updating `/tmp/jl_PdF79T/Project.toml`
[0c5d862f] + Symbolics v6.4.0
# ...
julia> @variables x
1-element Vector{Num}:
x
julia> solve(x^2-9,x)
ERROR: UndefVarError: `solve` not defined
Stacktrace:
[1] top-level scope
@ REPL[4]:1
julia> Symbolics.sol<Tab>
solve_for
solve_multipoly
solve_multivar
solve_univar
julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × AMD Ryzen 7 4800H with Radeon Graphics
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Should solve
exist? I don’t see it in the docs at first glance. symbolic_solve
which I see in the docs does exist:
julia> symbolic_solve(x^2-9,x)
ERROR: "Nemo is required. Execute `using Nemo` to enable this functionality."
Stacktrace:
[1] factor_use_nemo(poly::Num)
@ Symbolics ~/.julia/packages/Symbolics/e7UFe/src/solver/nemo_stuff.jl:14
[2] solve_univar(expression::Num, x::Num; dropmultiplicity::Bool)
@ Symbolics ~/.julia/packages/Symbolics/e7UFe/src/solver/main.jl:260
[3] symbolic_solve(expr::Num, x::Num; dropmultiplicity::Bool, warns::Bool)
@ Symbolics ~/.julia/packages/Symbolics/e7UFe/src/solver/main.jl:156
[4] symbolic_solve(expr::Num, x::Num)
@ Symbolics ~/.julia/packages/Symbolics/e7UFe/src/solver/main.jl:113
[5] top-level scope
@ REPL[6]:1
The only exported function starting with solv
is solve_for
which is deprecated:
julia> solve_for(x^2-9,x)
┌ Warning: solve_for is deprecated, please use symbolic_linear_solve instead.
│ caller = top-level scope at REPL[7]:1
└ @ Core REPL[7]:1
ERROR: AssertionError: islinear
...
There are some more functions starting with symbolic
:
julia> symbolic
symbolic_linear_solve
symbolic_solve
symbolics_to_sympy
And with Nemo.jl, symbolic_solve
solves the equation:
julia> using Nemo;
julia> symbolic_solve(x^2-9,x)
2-element Vector{BigInt}:
3
-3