Thanks. This is a bug so best to open a GitHub issue: https://github.com/sympy/sympy/issues
If you use rational numbers rather than floats it gives the correct answer: In [9]: print(dsolve(nsimplify(ode), y)) Eq(y(x), (C1 + C2*x)*exp(-x/2)) In [10]: print(dsolve(ode, y)) Eq(y(x), (C1*sin(5.98941528027496e-13*x) + C2*sin(6.42110952905754e-13*x) + C3*cos(5.98941528027496e-13*x) + C4*cos(6.42110952905754e-13*x))*exp(-0.5*x)) There are two different bugs here. The first is roots being inaccurate for floats: In [6]: roots(x**2 + x + 0.25) Out[6]: {-0.5 - 5.98941528027496e-13⋅ⅈ: 1, -0.5 + 6.42110952905754e-13⋅ⅈ: 1} In [7]: roots(x**2 + x + Rational(0.25)) Out[7]: {-1/2: 2} In general it is difficult to handle multiple roots in floating point. I think it would be reasonable for roots to convert the floats to rational and compute a square-free factorisation before doing anything else though. Somehow getting the wrong roots then results in having four rather than two terms in the solution. There is a bug in the nth_linear_constant_coefficient solver handling the roots somewhere. -- Oscar On Sun, 21 Jul 2024 at 10:33, Tony K B <tonny...@cet.ac.in> wrote: > > got wrong answer for this ODE y''+y'+0.25y=0, Out put attached. Correct > answer is (c_1+c_2*x)e^{-0.5x}. thank you > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/82af3e38-0dff-4ebe-be8e-102df4e37a79n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxSYK7ueZh9%2BXX08oHxKX5jVuZCS45vK8d3u3wehM_tW-w%40mail.gmail.com.