# Symbolics.jl - solve\_for not defined

**URL:** <https://discourse.julialang.org/t/symbolics-jl-solve-for-not-defined/57292>\
**Category:** General Usage\
**Created:** [March 16, 2021, 10:34am UTC](https://discourse.julialang.org/t/symbolics-jl-solve-for-not-defined/57292 "2021-03-16T10:34:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [March 16, 2021, 10:34am UTC](https://discourse.julialang.org/t/symbolics-jl-solve-for-not-defined/57292/1 "2021-03-16T10:34:38Z")

</div>

When I tried to use Symbolics.jl to sovle a simple equation, I ran into the error saying that `solve_for` was not defined. Below you can see the package status and a screenshot from [the docs](https://symbolics.juliasymbolics.org/stable/manual/expression_manipulation/). Am I wrong, or is something not adding up?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/c/cc27c0aacb33806781068ef94713ea3d9582e4b9.png)  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/f/af095c0999e3977d4223218393e943fb92fcbd46.png)

A more general question - can this function only solve linear equations? Are there plans to make it able to solve more general equations?

---

<div class="post-metadata">

**Author:** ![Syx\_Pek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/syx_pek/32/6364_2.png) [@Syx\_Pek](https://discourse.julialang.org/u/Syx_Pek)\
**Post date:** [March 16, 2021, 2:40pm UTC](https://discourse.julialang.org/t/symbolics-jl-solve-for-not-defined/57292/2 "2021-03-16T14:40:23Z")

</div>

I am not very sure what the future plans are, but I can answer some of the concrete questions.

`solve_for` is not exported, so to call it, it requires to be called as `Symbolics.solve_for` as follows

```julia
julia> using Symbolics

julia> @variables x y
(x, y)

julia> Symbolics.solve_for([x + y ~ 3, x - y ~ 1], [x, y])
2-element Array{Num,1}:
 2.0
 1.0

julia> Symbolics.solve_for([x^2 ~ 1], [x])
ERROR: AssertionError: islinear(ex, vars)
Stacktrace:
 [1] A_b(::Array{Equation,1}, ::Array{Num,1}, ::Bool) at /home/syx/.julia/packages/Symbolics/knY95/src/linear_algebra.jl:62
 [2] solve_for(::Array{Equation,1}, ::Array{Num,1}; simplify::Bool, check::Bool) at /home/syx/.julia/packages/Symbolics/knY95/src/linear_algebra.jl:88
 [3] solve_for(::Array{Equation,1}, ::Array{Num,1}) at /home/syx/.julia/packages/Symbolics/knY95/src/linear_algebra.jl:88
 [4] top-level scope at REPL[4]:1
 [5] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

```

as you can see, it currently only works on Linear equations.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 16, 2021, 3:09pm UTC](https://discourse.julialang.org/t/symbolics-jl-solve-for-not-defined/57292/3 "2021-03-16T15:09:17Z")

</div>

Needs more work for nonlinear. It’s planned.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 26, 2021, 3:43pm UTC](https://discourse.julialang.org/t/symbolics-jl-solve-for-not-defined/57292/4 "2021-03-26T15:43:35Z")

</div>

I’m looking into a problem (WENO reconstruction) where I have, say, 5 linear equations and 3 unknowns. The solution exists and is unique, though.

Since `solver_for` appears to require the same number of equations and unknowns (statement above), would it be better for now to write a simple function for setting this in matrix form, and solve it using the LinearAlgebra package?
