[sympy] new to sympy : trying out the Lane Emden equation, but fail

2009-03-05 Thread johannct
Hello, here is for the background : http://en.wikipedia.org/wiki/Lane-Emden_equation and indeed checking for n=1 that sin(x)/x is a solution : In [16]: diff(sin(x)/x, x,2)+2/x*diff(sin(x)/x,x)+sin(x)/x works like a charm. But: In [14]: dsolve(f(x).diff(x, x)+2/x*f(x).diff(x)+f(x),f(x)) Out[14]: C

[sympy] Re: new to sympy : trying out the Lane Emden equation, but fail

2009-03-05 Thread Ondrej Certik
Hi Johann On Thu, Mar 5, 2009 at 6:28 AM, johannct wrote: > > Hello, > here is for the background : http://en.wikipedia.org/wiki/Lane-Emden_equation > and indeed checking for n=1 that sin(x)/x is a solution : > In [16]: diff(sin(x)/x, x,2)+2/x*diff(sin(x)/x,x)+sin(x)/x > works like a charm. Exc

[sympy] Re: new to sympy : trying out the Lane Emden equation, but fail

2009-03-05 Thread johannct
ok I looked at the code in solvers.py, l.606: r = eq.match(a*f(x).diff(x,x) + b*diff(f(x),x) + c*f(x)) if r: r1 = solve(r[a]*x**2 + r[b]*x + r[c], x) if r1[0].is_real: if len(r1) == 1: return (Symbol("C1") + Symbol("C2")*x)*exp(r1[0]*x)

[sympy] Re: new to sympy : trying out the Lane Emden equation, but fail

2009-03-05 Thread Ondrej Certik
On Thu, Mar 5, 2009 at 9:55 AM, johannct wrote: > > ok I looked at the code in solvers.py, l.606: >    r = eq.match(a*f(x).diff(x,x) + b*diff(f(x),x) + c*f(x)) >    if r: >        r1 = solve(r[a]*x**2 + r[b]*x + r[c], x) >        if r1[0].is_real: >            if len(r1) == 1: >                re