0

I'm trying to solve the below simple differential equation with Sympy

import sympy as sp
x, y = sp.symbols('x, y', cls= sp.Function)
t = sp.symbols('t')
m = 5
a = -9.8
eq1, eq2 = sp.Eq(y(t).diff(t,2),m*a), sp.Eq(x(t).diff(t,2),0)
sp.dsolve((eq1,eq2))

But I get an error saying local variable 'gsol1' referenced before assignment. What would be the problem?

Vahid
  • 179
  • 1
  • 9
  • 3
    This is a bug: https://github.com/sympy/sympy/issues/19238 – Oscar Benjamin May 01 '20 at 16:06
  • @OscarBenjamin thanks for your comment. So I have to wait for the next release. – Vahid May 01 '20 at 16:14
  • 1
    If you don't want to wait, you can use `scipy.integrate.solve_ivp`. I believe it will do the same thing. I can also provide an example of how to use it in the solutions if you want. – gnahum May 01 '20 at 16:36
  • @gnahum thanks for your attention. In fact, I would like to implement in analytically for educational purpose. – Vahid May 01 '20 at 19:06

0 Answers0