# Solving a simple equation in SymPy.jl fails

**URL:** https://discourse.julialang.org/t/solving-a-simple-equation-in-sympy-jl-fails/11146
**Category:** Numerics
**Created:** [May 25, 2018, 1:53pm UTC](https://discourse.julialang.org/t/solving-a-simple-equation-in-sympy-jl-fails/11146 "2018-05-25T13:53:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [May 25, 2018, 1:53pm UTC](https://discourse.julialang.org/t/solving-a-simple-equation-in-sympy-jl-fails/11146/1 "2018-05-25T13:53:41Z")

</div>

Hello,  
I tried to use SymPy.jl to solve a simple equation, but it fails. It eats more and more memory until the computer stalls.  
Two questions:  
a) where can I file a bug report?  
b) how can I solve this equation in Julia?

```julia
using SymPy

@syms pressure_ground positive=true pressure_air positive=true temperature positive=true height positive=true
eqn = ((pressure_ground / pressure_air) ^ (1.0 / 5.257) - 1.0) * (temperature + 273.15) / 0.0065 - height
solve([eqn], [temperature])

```

---

<div class="post-metadata">

### Author: ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)
#### Post date: [May 25, 2018, 2:53pm UTC](https://discourse.julialang.org/t/solving-a-simple-equation-in-sympy-jl-fails/11146/2 "2018-05-25T14:53:43Z")

</div>

I am not sure why it does not work with the numerical values. Symbolic algebra works fine:

```julia
pg, pa, t, h = symbols("pg, pa, t, h", positive=true)
α, T0, s = symbols("alpha, T0, s", positive=true)
eqn = ((pg / pa) ^ α - 1) * (t + T0) / s - h
solve(eqn, t)

```

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [May 25, 2018, 7:11pm UTC](https://discourse.julialang.org/t/solving-a-simple-equation-in-sympy-jl-fails/11146/3 "2018-05-25T19:11:45Z")

</div>

Thanks a lot for your work-around!

Nevertheless its a bug that solving the original problem doesn’t work. I will investigate, if the same problem happens in Python, then I will do a bug report on SymPi.

---

<div class="post-metadata">

### Author: ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)
#### Post date: [May 26, 2018, 9:08am UTC](https://discourse.julialang.org/t/solving-a-simple-equation-in-sympy-jl-fails/11146/4 "2018-05-26T09:08:01Z")

</div>

A MWE that shows a weird behaviour is the following:

```julia
using SymPy
t, s = symbols("t, s")
eqn = t / Sym("0.0065") - s
sol = solve(eqn, t)[1] # -> 0.00649999999999999⋅s
subs(eqn, t, sol) # -> -9.99200722162641e-16⋅s

```

It looks like divisions on non-integer numbers are performed as Float64 and then converted back into SymPy.Sym. Maybe you would like to look into this first?

---

<div class="post-metadata">

### Author: ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)
#### Post date: [May 29, 2018, 9:02pm UTC](https://discourse.julialang.org/t/solving-a-simple-equation-in-sympy-jl-fails/11146/5 "2018-05-29T21:02:54Z")

</div>

I think it is a SymPy.jl bug.

[https://github.com/JuliaPy/SymPy.jl/issues/217](https://github.com/JuliaPy/SymPy.jl/issues/217)
