Problem:
y″−2y=x+1.
Solution:
Let's discuss the method in general first, consider the differential equation:
y″+p(x)y′+q(x)y=r(x).
Assume we can solve the homogeneous equation
w″+p(x)w′+q(x)w=0
and get the solution the two independent solutions w(x)=w1(x) and w(x)=w2(x).
Now we assume the solution to the original equation takes the form:
y(x)=v1(x)w1(x)+v2(x)w2(x).
Computing the first derivative, we get:
y′(x)=v′1(x)w1(x)+v1(x)w′1(x)+v′2(x)w2(x)+v2(x)w′2(x).
As a wishful thinking, let's assume v′1(x)w1(x)+v′2(x)w2(x)=0. This is one of the equation that govern v′1(x) and v′2(x).
Next, we compute the second derivative, we get:
y′(x)=v1(x)w′1(x)+v2(x)w′2(x).
y″(x)=v′1(x)w′1(x)+v1(x)w″1(x)+v′2(x)w′2(x)+v2(x)w″2(x).
Putting these derivative back to the differential equation, we get:
(v′1(x)w′1(x)+v1(x)w″1(x)+v′2(x)w′2(x)+v2(x)w″2(x))+p(x)(v1(x)w′1(x)+v2(x)w′2(x))+q(x)(v1(x)w1(x)+v2(x)w2(x))=r(x).
A very long equation, but if we carefully group the terms we see this:
v′1(x)w′1(x)+v′2(x)w′2(x)+(v1(x)w″1(x)+p(x)v1(x)w′1(x)+q(x)v1(x)w1(x))+(v2(x)w″2(x)+p(x)v2(x)w′2(x)+q(x)v2(x)w2(x))=r(x).
Note that the two bracketed term is actually 0 because w1(x) and w2(x) is a solution to the homogeneous equation. So it simplifies to
v′1(x)w′1(x)+v′2(x)w′2(x)=r(x).
That will be our second equation that govern v′1(x) and v′2(x), with this two equations, we can solve the v1(x) and v2(x) and therefore the overall differential equation.
So much for the theory, now we solve the equation y″−2y=x+1.
The homogeneous equation w″−2w=0 is pretty easy to solve, it is simply w1(x)=e√2x and w2(x)=e−√2x.
Next, we use the two equations to solve for the v functions
v′1(x)e√2x+v′2(x)e−√2x=0
√2v′1(x)e√2x+(−√2)v′2(x)e−√2x=x+1
Cancelling the √2 factor from the second equation we get
v′1(x)e√2x−v′2(x)e−√2x=x+1√2
Now the functions are trivial to solve v′1(x)=x+12√2e−√2x, v′2(x)=−x−12√2e√2x.
Next we integrate to find v1(x) and v2(x).
v1(x)=−18(2x+√2+2)e−√2x
v2(x)=−18(2x−√2+2)e√2x
Putting these back to the differential equation, we finally get
y(x)=v1(x)w1(x)+v2(x)w2(x)=−18(2x+√2+2)+−18(2x−√2+2)=−12(x+1).
And the final answer is, of course, y(x)=−12(x+1)+Ae√2x+Be−√2x.
To be honest to myself, I cheated. I didn't do all these integration myself. I used these simple MATLAB code. It is really troublesome to use this method.
clc
w1 = exp(sqrt(2) * x);
w2 = exp(-sqrt(2) * x);
v1d = (x + 1)/sqrt(2) /2 / w1;
v2d = -(x + 1)/sqrt(2) /2 / w2;
g = simplify(int(v1d) * w1 + int(v2d) * w2)
diff(diff(g)) - 2 * g
y″−2y=x+1.
Solution:
Let's discuss the method in general first, consider the differential equation:
y″+p(x)y′+q(x)y=r(x).
Assume we can solve the homogeneous equation
w″+p(x)w′+q(x)w=0
and get the solution the two independent solutions w(x)=w1(x) and w(x)=w2(x).
Now we assume the solution to the original equation takes the form:
y(x)=v1(x)w1(x)+v2(x)w2(x).
Computing the first derivative, we get:
y′(x)=v′1(x)w1(x)+v1(x)w′1(x)+v′2(x)w2(x)+v2(x)w′2(x).
As a wishful thinking, let's assume v′1(x)w1(x)+v′2(x)w2(x)=0. This is one of the equation that govern v′1(x) and v′2(x).
Next, we compute the second derivative, we get:
y′(x)=v1(x)w′1(x)+v2(x)w′2(x).
y″(x)=v′1(x)w′1(x)+v1(x)w″1(x)+v′2(x)w′2(x)+v2(x)w″2(x).
Putting these derivative back to the differential equation, we get:
(v′1(x)w′1(x)+v1(x)w″1(x)+v′2(x)w′2(x)+v2(x)w″2(x))+p(x)(v1(x)w′1(x)+v2(x)w′2(x))+q(x)(v1(x)w1(x)+v2(x)w2(x))=r(x).
A very long equation, but if we carefully group the terms we see this:
v′1(x)w′1(x)+v′2(x)w′2(x)+(v1(x)w″1(x)+p(x)v1(x)w′1(x)+q(x)v1(x)w1(x))+(v2(x)w″2(x)+p(x)v2(x)w′2(x)+q(x)v2(x)w2(x))=r(x).
Note that the two bracketed term is actually 0 because w1(x) and w2(x) is a solution to the homogeneous equation. So it simplifies to
v′1(x)w′1(x)+v′2(x)w′2(x)=r(x).
That will be our second equation that govern v′1(x) and v′2(x), with this two equations, we can solve the v1(x) and v2(x) and therefore the overall differential equation.
So much for the theory, now we solve the equation y″−2y=x+1.
The homogeneous equation w″−2w=0 is pretty easy to solve, it is simply w1(x)=e√2x and w2(x)=e−√2x.
Next, we use the two equations to solve for the v functions
v′1(x)e√2x+v′2(x)e−√2x=0
√2v′1(x)e√2x+(−√2)v′2(x)e−√2x=x+1
Cancelling the √2 factor from the second equation we get
v′1(x)e√2x−v′2(x)e−√2x=x+1√2
Now the functions are trivial to solve v′1(x)=x+12√2e−√2x, v′2(x)=−x−12√2e√2x.
Next we integrate to find v1(x) and v2(x).
v1(x)=−18(2x+√2+2)e−√2x
v2(x)=−18(2x−√2+2)e√2x
Putting these back to the differential equation, we finally get
y(x)=v1(x)w1(x)+v2(x)w2(x)=−18(2x+√2+2)+−18(2x−√2+2)=−12(x+1).
And the final answer is, of course, y(x)=−12(x+1)+Ae√2x+Be−√2x.
To be honest to myself, I cheated. I didn't do all these integration myself. I used these simple MATLAB code. It is really troublesome to use this method.
clc
w1 = exp(sqrt(2) * x);
w2 = exp(-sqrt(2) * x);
v1d = (x + 1)/sqrt(2) /2 / w1;
v2d = -(x + 1)/sqrt(2) /2 / w2;
g = simplify(int(v1d) * w1 + int(v2d) * w2)
diff(diff(g)) - 2 * g
No comments:
Post a Comment