Internal
problem
ID
[13263]
Book
:
Differential
Equations
by
Shepley
L.
Ross.
Third
edition.
John
Willey.
New
Delhi.
2004.
Section
:
Chapter
2,
section
2.3
(Linear
equations).
Exercises
page
56
Problem
number
:
29
Date
solved
:
Wednesday, March 05, 2025 at 09:32:24 PM
CAS
classification
:
[[_linear, `class A`]]
With initial conditions
ode:=diff(y(x),x)+y(x) = piecewise(0 <= x and x < 2,exp(-x),2 <= x,exp(-2)); ic:=y(0) = 1; dsolve([ode,ic],y(x), singsol=all);
ode=D[y[x],x]+y[x]==Piecewise[{{Exp[-x],0<=x<2},{Exp[-2],x>=2}}]; ic={y[0]==1}; DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
from sympy import * x = symbols("x") y = Function("y") ode = Eq(-Piecewise((exp(-x), (x >= 0) & (x < 2)), (exp(-2), x >= 2)) + y(x) + Derivative(y(x), x),0) ics = {y(0): 1} dsolve(ode,func=y(x),ics=ics)