7.12.1 problem 1

Internal problem ID [383]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 2. Linear Equations of Higher Order. Section 2.6 (Forced oscillations and resonance). Problems at page 171
Problem number : 1
Date solved : Saturday, March 29, 2025 at 04:52:20 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }+9 x&=10 \cos \left (2 t \right ) \end{align*}

With initial conditions

\begin{align*} x \left (0\right )&=0\\ x^{\prime }\left (0\right )&=0 \end{align*}

Maple. Time used: 0.027 (sec). Leaf size: 22
ode:=diff(diff(x(t),t),t)+9*x(t) = 10*cos(2*t); 
ic:=x(0) = 0, D(x)(0) = 0; 
dsolve([ode,ic],x(t), singsol=all);
 
\[ x = -8 \cos \left (t \right )^{3}+6 \cos \left (t \right )+4 \cos \left (t \right )^{2}-2 \]
Mathematica. Time used: 0.017 (sec). Leaf size: 18
ode=D[x[t],{t,2}]+9*x[t]==10*Cos[2*t]; 
ic={x[0]==0,Derivative[1][x][0] ==0}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to 2 (\cos (2 t)-\cos (3 t)) \]
Sympy. Time used: 0.086 (sec). Leaf size: 15
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(9*x(t) - 10*cos(2*t) + Derivative(x(t), (t, 2)),0) 
ics = {x(0): 0, Subs(Derivative(x(t), t), t, 0): 0} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = 2 \cos {\left (2 t \right )} - 2 \cos {\left (3 t \right )} \]