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)
            else:
                return Symbol("C1")*exp(r1[0]*x) + Symbol("C2")*exp(r1
[1]*x)
        else:
            r2 = abs((r1[0] - r1[1])/(2*S.ImaginaryUnit))
            return (Symbol("C2")*C.cos(r2*x) + Symbol("C1")*C.sin
(r2*x))*exp((r1[0] + r1[1])*x/2)

where:
In [19]: r
Out[19]:
⎧         2      ⎫
⎨a: 1, b: ─, c: 1⎬
⎩         x      ⎭

I guess the characteristic second order test is completely irrelevant,
as it assumes that a,b, and c are constants, and not functions of x.
What is the best way to check for that?
Johann

On Mar 5, 2:51 pm, Ondrej Certik <ond...@certik.cz> wrote:
> Hi Johann
>
> On Thu, Mar 5, 2009 at 6:28 AM, johannct <johann.cohentan...@gmail.com> 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.
>
> Excellent!
>
>
>
> > But:
> > In [14]: dsolve(f(x).diff(x, x)+2/x*f(x).diff(x)+f(x),f(x))
> > Out[14]:
> > C₁⋅sin(x sqrt(3)) + C₂⋅cos(x⋅sqrt(3) )
> > Obviously I am doing something wrong...
>
> Unfortunately, our dsolve solver is not very advanced now. If you'd
> like to enhance it, so that it works for your equation above, it'd be
> awesome. Feel free to ask if you have any questions. Also please
> report the above as a bug into our bug tracker, as we need to fix it
> in any case.
>
>
>
> > Thanks for your help. I just downloaded sympy using git, so I have
> > In [3]: sympy.__version__
> > Out[3]: '0.6.4.beta1'
>
> > best, and kudos for the great package,
>
> Thanks for using it,
> Ondrej
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to