20.1.30 problem Problem 38

Internal problem ID [3587]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 1, First-Order Differential Equations. Section 1.2, Basic Ideas and Terminology. page 21
Problem number : Problem 38
Date solved : Sunday, March 30, 2025 at 01:53:29 AM
CAS classification : [[_2nd_order, _quadrature]]

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

With initial conditions

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

Maple. Time used: 0.026 (sec). Leaf size: 11
ode:=diff(diff(y(x),x),x) = cos(x); 
ic:=y(0) = 2, D(y)(0) = 1; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = -\cos \left (x \right )+x +3 \]
Mathematica. Time used: 0.01 (sec). Leaf size: 12
ode=D[y[x],{x,2}]==Cos[x]; 
ic={y[0]==2,Derivative[1][y][0] ==1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x-\cos (x)+3 \]
Sympy. Time used: 0.063 (sec). Leaf size: 8
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-cos(x) + Derivative(y(x), (x, 2)),0) 
ics = {y(0): 2, Subs(Derivative(y(x), x), x, 0): 1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x - \cos {\left (x \right )} + 3 \]