Skip to content Skip to sidebar Skip to footer

Solving Differential Equation Sympy

I haven't been able to find particular solutions to this differential equation. from sympy import * m = float(raw_input('Mass:\n> ')) g = 9.8 k = float(raw_input('Drag Coeffici

Solution 1:

I believe Sympy is not yet able to take into account initial conditions. Although dsolve has the option ics for entering initial conditions (see the documentation), it appears to be of limited use.

Therefore, you need to apply the initial conditions manually. For example:

C1 = Symbol('C1')
C1_ic = solve(equation.rhs.subs({t:0}),C1)[0]

print equation.subs({C1:C1_ic})

Eq(v(t), 49000.0 - 49000.0*exp(-0.0002*t))

Post a Comment for "Solving Differential Equation Sympy"