imp运行代码输出结果:
ort sympy as sp
x = sp.Symbol('x')
f = sp.Function('f')
y = f(x)
d = sp.Eq(y.diff(x) + 2 * x * y, x * sp.exp(-x ** 2))
diff = sp.dsolve(d, y)
print('微分方程的通解为:%s' % diff)
运行代码输出结果:
import sympy as spx = sp.Symbol('x')
f = sp.Function('f')
y = f(x)
d = sp.Eq(x * y.diff(x) + y - sp.exp(-x), 0)
diff = sp.dsolve(d, y, ics={f(1): 2 * sp.exp(1)})
print('微分方程的特解为:%s' % diff)
运行代码输出结果: