# SymPy function with 2 variables

**URL:** https://discourse.julialang.org/t/sympy-function-with-2-variables/58538
**Category:** Optimization (Mathematical)
**Created:** [April 4, 2021, 12:10am UTC](https://discourse.julialang.org/t/sympy-function-with-2-variables/58538 "2021-04-04T00:10:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![statspy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statspy/32/26630_2.png) [@statspy](https://discourse.julialang.org/u/statspy)
#### Post date: [April 4, 2021, 12:10am UTC](https://discourse.julialang.org/t/sympy-function-with-2-variables/58538/1 "2021-04-04T00:10:15Z")

</div>

i am trying:

julia\> a=Equality(x^2 + y^3, 31)

i would like to get x=2 and y=3. How ca i do it?

I tried solve(a,[x,y]) and solve(a) but i am getting:  
(-sqrt(31 - y^3), y)  
(sqrt(31 - y^3), y)

---

<div class="post-metadata">

### Author: ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)
#### Post date: [April 4, 2021, 12:41am UTC](https://discourse.julialang.org/t/sympy-function-with-2-variables/58538/2 "2021-04-04T00:41:56Z")

</div>

Please, read [PSA: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757), especially, points 1 and 3.

[From the documentation](https://juliahub.com/docs/SymPy/KzewI/1.0.42/Tutorial/solvers/#A-Note-about-Equations-1) you should use `solveset`, no?

---

<div class="post-metadata">

### Author: ![statspy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statspy/32/26630_2.png) [@statspy](https://discourse.julialang.org/u/statspy)
#### Post date: [April 4, 2021, 1:19am UTC](https://discourse.julialang.org/t/sympy-function-with-2-variables/58538/3 "2021-04-04T01:19:54Z")

</div>

i tried `solveset(a,[x,y])` and it returns ∅  
weird.

---

<div class="post-metadata">

### Author: ![runjaj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/runjaj/32/23628_2.png) [@runjaj](https://discourse.julialang.org/u/runjaj)
#### Post date: [April 4, 2021, 6:49pm UTC](https://discourse.julialang.org/t/sympy-function-with-2-variables/58538/4 "2021-04-04T18:49:13Z")

</div>

I think that you should read this section of the documentation of Sympy: [Diophantine](https://docs.sympy.org/latest/modules/solvers/diophantine.html), about diophantine equations.

---

<div class="post-metadata">

### Author: ![statspy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/statspy/32/26630_2.png) [@statspy](https://discourse.julialang.org/u/statspy)
#### Post date: [April 4, 2021, 7:02pm UTC](https://discourse.julialang.org/t/sympy-function-with-2-variables/58538/5 "2021-04-04T19:02:22Z")

</div>

yeah, problem is cubics are not implemented for diophantines yet. So i am looking for any package able to handle this. I can easily do it in Matlab but I really need a solution using Julia.
