• Support PF! Buy your school textbooks, materials and every day products Here!

Solving a Linear Piecewise ODE

  • Thread starter Bcranger 0
  • Start date
  • #1
12
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.
 

Answers and Replies

  • #2
938
9
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).
 

Related Threads on Solving a Linear Piecewise ODE

  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
1
Views
741
  • Last Post
Replies
6
Views
3K
  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
6
Views
1K
  • Last Post
Replies
6
Views
1K
Replies
5
Views
1K
Replies
14
Views
700
Replies
3
Views
997
Replies
7
Views
909
Top