I had just had a look at sympy’s documentation and it provides good support for solving differential equations. Sample this . Solving a differential equation would be as simple as this

from sympy import Function , Derivative
from sympy.abc import x
f = Function('f')(x) #Creates a function f with respect to x
d = Derivative(f , x ) #Derivative of f wrt to x is stored in d
dsolve(d -f , f)

which gives f(x) == C1*exp(x) as the ouput.

I also tried an example given in my book.

f = Function('f')(x) #Creates a function f with respect to x
d = Derivative(f , x , x)
d_ = Derivative(f , x)
dsolve(d - d_ - 2 * f - 4 * x * x)

which again gives me f(x) == C1*exp(-x) + C2*exp(2*x) – 2*x**2 + 2*x – 3

as the required output.

P.S : I will try to fix a few bugs as soon as my exams get over , wish me luck.

### Like this:

Like Loading...

*Related*

wow awesome work man, you’ve really done a lot! hope your gsoc thing comes through!

Thanks a lot for your wishes 🙂