47.1.29 problem 29

Internal problem ID [7410]
Book : Ordinary differential equations and calculus of variations. Makarets and Reshetnyak. Wold Scientific. Singapore. 1995
Section : Chapter 1. First order differential equations. Section 1.1 Separable equations problems. page 7
Problem number : 29
Date solved : Wednesday, March 05, 2025 at 04:27:04 AM
CAS classification : [[_linear, `class A`]]

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

Maple. Time used: 0.001 (sec). Leaf size: 15
ode:=diff(y(x),x)+y(x) = 2*x+1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = 2 x -1+c_{1} {\mathrm e}^{-x} \]
Mathematica. Time used: 0.072 (sec). Leaf size: 18
ode=D[y[x],x]+y[x]==2*x+1; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to 2 x+c_1 e^{-x}-1 \]
Sympy. Time used: 0.158 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x + y(x) + Derivative(y(x), x) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- x} + 2 x - 1 \]