Solving a simple equation in SymPy.jl fails

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?

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])

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

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)
1 Like

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.

A MWE that shows a weird behaviour is the following:

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?

I think it is a SymPy.jl bug.

https://github.com/JuliaPy/SymPy.jl/issues/217