8.4.5 problem 5

Internal problem ID [708]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 1.5. Linear first order equations. Page 56
Problem number : 5
Date solved : Tuesday, March 04, 2025 at 11:33:28 AM
CAS classification : [_linear]

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

With initial conditions

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

Maple. Time used: 0.007 (sec). Leaf size: 11
ode:=2*y(x)+x*diff(y(x),x) = 3*x; 
ic:=y(1) = 5; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = x +\frac {4}{x^{2}} \]
Mathematica. Time used: 0.024 (sec). Leaf size: 12
ode=2*y[x]+x*D[y[x],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.173 (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}} \]