I noticed sometimes dsolve ignore IC give and gives general solution instead. This seems to happen when it is not able to resolve the constants of integrations.
In this case it should return no solution instead.
Is there a way to tell it not to do this? Here is an example
>python
Python 3.13.1 (main, Dec 4 2024, 18:05:56) [GCC 14.2.1 20240910] on linux
Type "help", "copyright", "credits" or "license" for more information.
from sympy import *
x = symbols("x")
y = Function("y")
ode = Eq(x**2*Derivative(y(x), (x, 2)) - 4*x*Derivative(y(x), x) + 6*y(x),0)
ics = {y(0): 2, Subs(Derivative(y(x), x), x, 2): -1}
dsolve(ode,func=y(x),ics=ics)
It gives
Eq(y(x), x**2*(C2*x - 3*C2 - 1/4))
Notice the solution contains C2.
Actually there is no solution to this ode with these IC's, so it should not have returned any solution. This is what Maple does
ode:=x^2*diff(y(x),x$2)-4*x*diff(y(x),x)+6*y(x)=0;
IC:=y(0)=2,D(y)(2)=-1;
sol:= dsolve([ode,IC]);
( )
i.e. No solution.
--Nasser