2.1.18 Problem 3 (vi)

Solved using first_order_ode_exact
Maple
Mathematica
Sympy

Internal problem ID [18434]
Book : Elementary Differential Equations. By R.L.E. Schwarzenberger. Chapman and Hall. London. First Edition (1969)
Section : Chapter 3. Solutions of first-order equations. Exercises at page 47
Problem number : 3 (vi)
Date solved : Monday, March 31, 2025 at 05:28:34 PM
CAS classification : [_exact, _rational, [_1st_order, `_with_symmetry_[F(x),G(x)]`], [_Abel, `2nd type`, `class A`]]

Solved using first_order_ode_exact

Time used: 0.064 (sec)

Solve

2t+3x+(3tx)x=t2

To solve an ode of the form

(A)M(x,y)+N(x,y)dydx=0

We assume there exists a function ϕ(x,y)=c where c is constant, that satisfies the ode. Taking derivative of ϕ w.r.t. x gives

ddxϕ(x,y)=0

Hence

(B)ϕx+ϕydydx=0

Comparing (A,B) shows that

ϕx=Mϕy=N

But since 2ϕxy=2ϕyx then for the above to be valid, we require that

My=Nx

If the above condition is satisfied, then the original ode is called exact. We still need to determine ϕ(x,y) but at least we know now that we can do that since the condition 2ϕxy=2ϕyx is satisfied. If this condition is not satisfied then this method will not work and we have to now look for an integrating factor to force this condition, which might or might not exist. The first step is to write the ODE in standard form to check for exactness, which is

(1A)M(t,x)dt+N(t,x)dx=0

Therefore

(3tx)dx=(t22t3x)dt(2A)(t2+2t+3x)dt+(3tx)dx=0

Comparing (1A) and (2A) shows that

M(t,x)=t2+2t+3xN(t,x)=3tx

The next step is to determine if the ODE is is exact or not. The ODE is exact when the following condition is satisfied

Mx=Nt

Using result found above gives

Mx=x(t2+2t+3x)=3

And

Nt=t(3tx)=3

Since Mx=Nt, then the ODE is exact The following equations are now set up to solve for the function ϕ(t,x)

(1)ϕt=M(2)ϕx=N

Integrating (1) w.r.t. t gives

ϕtdt=Mdtϕtdt=t2+2t+3xdt(3)ϕ=t(t23t9x)3+f(x)

Where f(x) is used for the constant of integration since ϕ is a function of both t and x. Taking derivative of equation (3) w.r.t x gives

(4)ϕx=3t+f(x)

But equation (2) says that ϕx=3tx. Therefore equation (4) becomes

(5)3tx=3t+f(x)

Solving equation (5) for f(x) gives

f(x)=x

Integrating the above w.r.t x gives

f(x)dx=(x)dxf(x)=x22+c1

Where c1 is constant of integration. Substituting result found above for f(x) into equation (3) gives ϕ

ϕ=t(t23t9x)3x22+c1

But since ϕ itself is a constant function, then let ϕ=c2 where c2 is new constant and combining c1 and c2 constants into the constant c1 gives the solution as

c1=t(t23t9x)3x22

Solving for x gives

x=3t6t3+99t218c13x=3t+6t3+99t218c13
Figure 2.31: Slope field 2t+3x+(3tx)x=t2

Summary of solutions found

x=3t6t3+99t218c13x=3t+6t3+99t218c13
Maple. Time used: 0.004 (sec). Leaf size: 51
ode:=2*t+3*x(t)+(3*t-x(t))*diff(x(t),t) = t^2; 
dsolve(ode,x(t), singsol=all);
 
x=3t6t3+99t2+18c13x=3t+6t3+99t2+18c13

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 
<- exact successful
 

Maple step by step

Let’s solve2t+3x(t)+(3tx(t))(ddtx(t))=t2Highest derivative means the order of the ODE is1ddtx(t)Check if ODE is exactODE is exact if the lhs is the total derivative of aC2functionddtG(t,x(t))=0Compute derivative of lhstG(t,x)+(xG(t,x))(ddtx(t))=0Evaluate derivatives3=3Condition met, ODE is exactExact ODE implies solution will be of this form[G(t,x)=C1,M(t,x)=tG(t,x),N(t,x)=xG(t,x)]Solve forG(t,x)by integratingM(t,x)with respect totG(t,x)=(t2+2t+3x)dt+_F1(x)Evaluate integralG(t,x)=t33+t2+3xt+_F1(x)Take derivative ofG(t,x)with respect toxN(t,x)=xG(t,x)Compute derivative3tx=3t+ddx_F1(x)Isolate forddx_F1(x)ddx_F1(x)=xSolve for_F1(x)_F1(x)=x22Substitute_F1(x)into equation forG(t,x)G(t,x)=13t3+t2+3xt12x2SubstituteG(t,x)into the solution of the ODE13t3+t2+3xt12x2=C1Solve forx(t){x(t)=3t6t3+99t218C13,x(t)=3t+6t3+99t218C13}
Mathematica. Time used: 0.141 (sec). Leaf size: 67
ode=(2*t+3*x[t])+(3*t-x[t])*D[x[t],t]==t^2; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
x(t)3ti2t3311t2c1x(t)3t+i2t3311t2c1
Sympy
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-t**2 + 2*t + (3*t - x(t))*Derivative(x(t), t) + 3*x(t),0) 
ics = {} 
dsolve(ode,func=x(t),ics=ics)
 
Timed Out