2.3.8 Problem 8

Maple
Mathematica
Sympy

Internal problem ID [9064]
Book : First order enumerated odes
Section : section 3. First order odes solved using Laplace method
Problem number : 8
Date solved : Friday, April 25, 2025 at 05:39:54 PM
CAS classification : [_linear]

Solve

ty+y=sin(t)

With initial conditions

y(1)=0

Since initial condition is not at zero, then change of variable is used to transform the ode so that initial condition is at zero.

τ=t1

Solve

(τ+1)y+y=sin(τ+1)

With initial conditions

y(0)=0

We will now apply Laplace transform to each term in the ode. Since this is time varying, the following Laplace transform property will be used

τnf(τ)L(1)ndndsnF(s)

Where in the above F(s) is the laplace transform of f(τ). Applying the above property to each term of the ode gives

y(τ)LY(s)(τ+1)(ddτy(τ))LY(s)s(ddsY(s))+sY(s)y(0)sin(τ+1)Lsin(1)s+cos(1)s2+1

Collecting all the terms above, the ode in Laplace domain becomes

sY+sYy(0)=sin(1)s+cos(1)s2+1

Replacing y(0)=0 in the above results in

sY+sY=sin(1)s+cos(1)s2+1

The above ode in Y(s) is now solved.

In canonical form a linear first order is

Y+q(s)Y=p(s)

Comparing the above to the given ode shows that

q(s)=1p(s)=sin(1)scos(1)(s2+1)s

The integrating factor μ is

μ=eqds=e(1)ds=es

The ode becomes

dds(μY)=μpdds(μY)=(μ)(sin(1)scos(1)(s2+1)s)dds(Yes)=(es)(sin(1)scos(1)(s2+1)s)d(Yes)=((sin(1)scos(1))es(s2+1)s)ds

Integrating gives

Yes=(sin(1)scos(1))es(s2+1)sds=Ei1(s+i)2Ei1(si)2+cos(1)Ei1(s)+c1

Dividing throughout by the integrating factor es gives the final solution

Y=es(Ei1(s+i)2Ei1(si)2+cos(1)Ei1(s)+c1)

Applying inverse Laplace transform on the above gives.

(1)y=cos(1)τ+1+c1L1(es,s,τ)cos(τ+1)τ+2

Substituting initial conditions y(0)=0 and y(0)=0 into the above solution Gives

0=c1L1(es,s,τ)+cos(1)2

Solving for the constant c1 from the above equation gives

c1=cos(1)2L1(es,s,τ)

Substituting the above back into the solution (1) gives

y=cos(1)τ+1cos(1)2cos(τ+1)τ+2

Changing back the solution from τ to t using

τ=t1

the solution becomes

y(t)=cos(1)tcos(1)2cos(t)t+1

The solution was found not to satisfy the ode or the IC. Hence it is removed.

Maple
ode:=diff(y(t),t)*t+y(t) = sin(t); 
ic:=y(1) = 0; 
dsolve([ode,ic],y(t),method='laplace');
 
No solution found

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
<- 1st order linear successful
 

Maple step by step

Let’s solve[t(ddty(t))+y(t)=sin(t),y(1)=0]Highest derivative means the order of the ODE is1ddty(t)Isolate the derivativeddty(t)=y(t)t+sin(t)tGroup terms withy(t)on the lhs of the ODE and the rest on the rhs of the ODEddty(t)+y(t)t=sin(t)tThe ODE is linear; multiply by an integrating factorμ(t)μ(t)(ddty(t)+y(t)t)=μ(t)sin(t)tAssume the lhs of the ODE is the total derivativeddt(y(t)μ(t))μ(t)(ddty(t)+y(t)t)=(ddty(t))μ(t)+y(t)(ddtμ(t))Isolateddtμ(t)ddtμ(t)=μ(t)tSolve to find the integrating factorμ(t)=tIntegrate both sides with respect tot(ddt(y(t)μ(t)))dt=μ(t)sin(t)tdt+C1Evaluate the integral on the lhsy(t)μ(t)=μ(t)sin(t)tdt+C1Solve fory(t)y(t)=μ(t)sin(t)tdt+C1μ(t)Substituteμ(t)=ty(t)=sin(t)dt+C1tEvaluate the integrals on the rhsy(t)=cos(t)+C1tUse initial conditiony(1)=00=cos(1)+C1Solve for_C1C1=cos(1)Substitute_C1=cos(1)into general solution and simplifyy(t)=cos(t)+cos(1)tSolution to the IVPy(t)=cos(t)+cos(1)t
Mathematica. Time used: 0.035 (sec). Leaf size: 16
ode=t*D[y[t],t]+y[t]==Sin[t]; 
ic=y[1]==0; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
y(t)cos(1)cos(t)t
Sympy. Time used: 0.252 (sec). Leaf size: 10
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(t*Derivative(y(t), t) + y(t) - sin(t),0) 
ics = {y(1): 0} 
dsolve(ode,func=y(t),ics=ics)
 
y(t)=cos(t)+cos(1)t