如图
例 y''-2y'+5y = e^xsin2x
特征方程 r^2-2r+5 = 0, r = 1±2i
非齐次项中,1±2i 与特征根 1±2i 相同,应取 k = 1,
即特解应设为 y = xe^x(Acos2x+Bsin2x), 则
y' = e^x(Acos2x+Bsin2x) + xe^x(Acos2x+Bsin2x)
+ xe^x(-2Asinx+2Bcos2x)
= e^x[(Ax+2Bx+A)cos2x+(Bx-2AX+B)sin2x]
y'' = e^x[(Ax+2Bx+A)cos2x+(Bx-2AX+B)sin2x]
+e^x[(A+2B)cos2x-2(Ax+2Bx+A)sin2x+(B-2A)sin2x+2(Bx-2AX+B)cos2x]
= e^x[(-3Ax+4Bx+2A+4B)cos2x+(-3Bx-4AX+2B-4A)sin2x]
代入微分方程得
(-3Ax+4Bx+2A+4B)cos2x+(-3Bx-4AX+2B-4A)sin2x
-2(Ax+2Bx+A)cos2x - 2(Bx-2AX+B)sin2x
+5Axcos2x+5Bxsin2x = sin2x, 解得 A = -1/4, B = 0
特解是 y = -(1/4)xe^xcos2x