7.4.5 problem 5

Internal problem ID [77]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 1. First order differential equations. Section 1.5 (linear equations). Problems at page 54
Problem number : 5
Date solved : Saturday, March 29, 2025 at 04:30:17 PM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (1\right )&=5 \end{align*}

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