Solving a Linear Piecewise ODE

  • Thread starter Thread starter Bcranger 0
  • Start date Start date
  • Tags Tags
    Linear Ode
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 4K views
Bcranger 0
Messages
10
Reaction score
0

Homework Statement


Solve the piecewise linear ODE, y' - y = f(x), y(0) = 1, where
f(x) = 1 when 0<=x<=1 and f(x) = -1 when x > 1.

y(2) = ?

Homework Equations


None


The Attempt at a Solution


I found the integrating factor to be e^-x and multiplied both sides of the equation by the integrating factor.

I rewrote the equation as the d/dx(e^-x * y) = e^-x * f(x). I integrated both sides to get e^-x * y = -e^-x * f(x) + C.

Solving for y, I got y = -f(x) + C/e^-x. Using the initial value y(0)=1, I managed to find C as +2. Solving for y(2) there onwards, I obtained an answer of 15.7781, which was said to be the wrong answer. I am not sure where I went wrong!


I would appreciate any help on solving this problem using the "5 Steps Method" aka the basic method for solving an inhomogeneous linear DE.
 
Physics news on Phys.org
You have two different differential equations. Try solving first in the range 0<x<1 for y(1) and then use this as an initial condition for the second equation to find y(2).