Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

WorksForMe(TM) on 10.2.beta5 :

sage: y=function("y")
sage: de=diff(y(x),x,2)+diff(y(x),x)+37/4*y(x)==0
sage: desolve(de, y(x), ivar=x)
(_K2*cos(3*x) + _K1*sin(3*x))*e^(-1/2*x)
sage: import sympy as sp
sage: sp.dsolve(*map(sp.sympify, (de, y(x))))
Eq(y(x), (C1*sin(3*x) + C2*cos(3*x))*exp(-x/2))

What version of Sage do you use ?

Note : check your sympy's syntax, possibly by working in a Python REPL...

HTH,

WorksForMe(TM) on 10.2.beta5 :

sage: y=function("y")
sage: de=diff(y(x),x,2)+diff(y(x),x)+37/4*y(x)==0
sage: desolve(de, y(x), ivar=x)
(_K2*cos(3*x) + _K1*sin(3*x))*e^(-1/2*x)
sage: import sympy as sp
sage: sp.dsolve(*map(sp.sympify, (de, y(x))))
Eq(y(x), (C1*sin(3*x) + C2*cos(3*x))*exp(-x/2))

What version of Sage do you use ?

Note : check your sympy's syntax, possibly by working in a Python REPL...

EDIT : As pointed out in a comment, your Python code works in a Python REPL (modulo choice of floats vs rationals) :

Python 3.11.5 (main, Aug 29 2023, 15:31:31) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy as sp
x=sp.symbols('x')
y=sp.Function('y')(x)
eq = sp.Eq(sp.diff(y,x,x)+sp.diff(y,x)+9.25*y,0)  
y=sp.dsolve(eq,y)
y
>>> >>> >>> >>> >>> Eq(y(x), (C1*sin(3.0*x) + C2*cos(3.0*x))*exp(-0.5*x))
>>>

HTH,