2.1.69 Problem 69

Solved using first_order_ode_special_form_ID_1
Maple
Mathematica
Sympy

Internal problem ID [9052]
Book : First order enumerated odes
Section : section 1
Problem number : 69
Date solved : Friday, April 25, 2025 at 05:39:30 PM
CAS classification : [[_1st_order, `_with_symmetry_[F(x),G(x)]`]]

Solved using first_order_ode_special_form_ID_1

Time used: 0.363 (sec)

Solve

y=xex+y+sin(x)

Writing the ode as

(1)y=xex+y+sin(x)

And using the substitution u=ey then

u=yey

The above shows that

y=u(x)ey=u(x)u

Substituting this in (1) gives

u(x)u=xexu+sin(x)

The above simplifies to

u(x)=xex+sin(x)u(x)(2)u(x)+sin(x)u(x)=xex

Now ode (2) is solved for u(x).

In canonical form a linear first order is

u(x)+q(x)u(x)=p(x)

Comparing the above to the given ode shows that

q(x)=sin(x)p(x)=xex

The integrating factor μ is

μ=eqdx=esin(x)dx=ecos(x)

The ode becomes

ddx(μu)=μpddx(μu)=(μ)(xex)ddx(uecos(x))=(ecos(x))(xex)d(uecos(x))=(xexecos(x))dx

Integrating gives

uecos(x)=xexecos(x)dx=xexecos(x)dx+c1

Dividing throughout by the integrating factor ecos(x) gives the final solution

u(x)=ecos(x)(xexecos(x)dx+c1)

Substituting the solution found for u(x) in u=ey gives

ey=ecos(x)(xexecos(x)dx+c1)

Solving for y gives

y=ln(xexecos(x)dx+c1)cos(x)
Figure 2.74: Slope field y=xex+y+sin(x)

Summary of solutions found

y=ln(xexecos(x)dx+c1)cos(x)
Maple. Time used: 0.010 (sec). Leaf size: 29
ode:=diff(y(x),x) = x*exp(x+y(x))+sin(x); 
dsolve(ode,y(x), singsol=all);
 
y=cos(x)ln(c1xexcos(x)dx)

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
trying Bernoulli 
trying separable 
trying inverse linear 
trying homogeneous types: 
trying Chini 
differential order: 1; looking for linear symmetries 
trying exact 
Looking for potential symmetries 
trying inverse_Riccati 
trying an equivalence to an Abel ODE 
differential order: 1; trying a linearization to 2nd order 
--- trying a change of variables {x -> y(x), y(x) -> x} 
differential order: 1; trying a linearization to 2nd order 
trying 1st order ODE linearizable_by_differentiation 
--- Trying Lie symmetry methods, 1st order --- 
   -> Computing symmetries using: way = 3 
   -> Computing symmetries using: way = 4 
   -> Computing symmetries using: way = 5 
trying symmetry patterns for 1st order ODEs 
-> trying a symmetry pattern of the form [F(x)*G(y), 0] 
-> trying a symmetry pattern of the form [0, F(x)*G(y)] 
<- symmetry pattern of the form [0, F(x)*G(y)] successful
 

Maple step by step

Let’s solveddxy(x)=xex+y(x)+sin(x)Highest derivative means the order of the ODE is1ddxy(x)Solve for the highest derivativeddxy(x)=xex+y(x)+sin(x)
Mathematica. Time used: 3.158 (sec). Leaf size: 100
ode=D[y[x],x]==x*Exp[x+y[x]]+Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
Solve[1x(eK[1]cos(K[1])K[1]ecos(K[1])y(x)sin(K[1]))dK[1]+1y(x)ecos(x)K[2](ecos(x)+K[2]1xecos(K[1])K[2]sin(K[1])dK[1]1)dK[2]=c1,y(x)]
Sympy. Time used: 16.325 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(x + y(x)) - sin(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
y(x)=log(ecos(x)C1xexecos(x)dx)