# Revision history [back]

[ Not really an answer, but refinements needing more than the 500 characters of a comment ]

calc314's answer is an explicit solution :

import sympy
y=function("y")(x)
E1=diff(y(x),x,3)(x)-3*diff(y(x),x,2)(x)+diff(y(x),x)(x)-5*y(x)==0
Sol=sympy.dsolve(*map(sympy.sympify, [E1,y(x)]))._sage_()
Sol
y(x) == C3*e^(x*complex_root_of(x^3 - 3*x^2 + x - 5, 2)) + C2*e^(x*complex_root_of(x^3 - 3*x^2 + x - 5, 1)) + C1*e^(x*complex_root_of(x^3 - 3*x^2 + x - 5, 0))

The function complex_root_of(P,i) is a formal function representing the ith root of the polynomial P (in a stable fashion), which can be evaluated numerically). See its help docstring, as well as sympy's CRoot

If symbolic solutions are needed, you can also extract the characteristic polynomial and solve it symbolically :

Sol.rhs().operands()[0].operands()[1].operands()[0].operands()[1].operands()[0].solve(x)
[x == -1/2*(1/9*sqrt(235)*sqrt(3) + 3)^(1/3)*(I*sqrt(3) + 1) + 1/3*(I*sqrt(3) - 1)/(1/9*sqrt(235)*sqrt(3) + 3)^(1/3) + 1,
x == -1/2*(1/9*sqrt(235)*sqrt(3) + 3)^(1/3)*(-I*sqrt(3) + 1) + 1/3*(-I*sqrt(3) - 1)/(1/9*sqrt(235)*sqrt(3) + 3)^(1/3) + 1,
x == (1/9*sqrt(235)*sqrt(3) + 3)^(1/3) + 2/3/(1/9*sqrt(235)*sqrt(3) + 3)^(1/3) + 1]

But I think that the "formal root" form s a better expression in a lot of situations.

[ Not really an answer, but refinements needing more than the 500 characters of a comment ]

calc314's answer is an explicit solution :

import sympy
y=function("y")(x)
E1=diff(y(x),x,3)(x)-3*diff(y(x),x,2)(x)+diff(y(x),x)(x)-5*y(x)==0
Sol=sympy.dsolve(*map(sympy.sympify, [E1,y(x)]))._sage_()
Sol
y(x) == C3*e^(x*complex_root_of(x^3 - 3*x^2 + x - 5, 2)) + C2*e^(x*complex_root_of(x^3 - 3*x^2 + x - 5, 1)) + C1*e^(x*complex_root_of(x^3 - 3*x^2 + x - 5, 0))

The function complex_root_of(P,i) is a formal function representing the ith root of the polynomial P (in a stable fashion), which can be evaluated numerically). See its help docstring, as well as sympy's CRoot's.

If symbolic solutions are needed, you can also extract the characteristic polynomial and solve it symbolically :

Sol.rhs().operands()[0].operands()[1].operands()[0].operands()[1].operands()[0].solve(x)
[x == -1/2*(1/9*sqrt(235)*sqrt(3) + 3)^(1/3)*(I*sqrt(3) + 1) + 1/3*(I*sqrt(3) - 1)/(1/9*sqrt(235)*sqrt(3) + 3)^(1/3) + 1,
x == -1/2*(1/9*sqrt(235)*sqrt(3) + 3)^(1/3)*(-I*sqrt(3) + 1) + 1/3*(-I*sqrt(3) - 1)/(1/9*sqrt(235)*sqrt(3) + 3)^(1/3) + 1,
x == (1/9*sqrt(235)*sqrt(3) + 3)^(1/3) + 2/3/(1/9*sqrt(235)*sqrt(3) + 3)^(1/3) + 1]

But I think that the "formal root" form s a better expression in a lot of situations.