44.2.45 problem 47

Internal problem ID [6977]
Book : A First Course in Differential Equations with Modeling Applications by Dennis G. Zill. 12 ed. Metric version. 2024. Cengage learning.
Section : Chapter 1. Introduction to differential equations. Section 1.2 Initial value problems. Exercises 1.2 at page 19
Problem number : 47
Date solved : Wednesday, March 05, 2025 at 04:00:53 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }&=x -2 y \end{align*}

With initial conditions

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

Maple. Time used: 0.008 (sec). Leaf size: 15
ode:=diff(y(x),x) = x-2*y(x); 
ic:=y(0) = 1/2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \frac {x}{2}-\frac {1}{4}+\frac {3 \,{\mathrm e}^{-2 x}}{4} \]
Mathematica. Time used: 0.031 (sec). Leaf size: 21
ode=D[y[x],x]==x-2*y[x]; 
ic={y[0] == 1/2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{4} \left (2 x+3 e^{-2 x}-1\right ) \]
Sympy. Time used: 0.167 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x + 2*y(x) + Derivative(y(x), x),0) 
ics = {y(0): 1/2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x}{2} - \frac {1}{4} + \frac {3 e^{- 2 x}}{4} \]