# Program 02a: A simple separable ODE. See Example 1.
|
|
from sympy import dsolve, Eq, Function, symbols, pprint
|
|
t = symbols('t')
|
|
x = symbols('x', cls=Function)
|
|
dxdt = x(t).diff(t)
|
|
de = Eq(dxdt, -t/x(t))
|
|
print('Program 02a:\n')
|
|
pprint(de)
|
|
sol = dsolve(de, x(t))
|
|
pprint(sol)
|