# Keep getting the wrong answer in this lengthy Laplace problem

Tags:
1. Sep 27, 2015

### Jonas E

1. The problem statement, all variables and given/known data
y'' + 4y = 8t^2 if 0 < t < 5, and 0 if t > 5; y(1) = 1 + cos(2), y'(1) = 4 - 2sin(2). Use the Laplace transform to find y.

2. Relevant equations
t-shift, s-shift, unit step function.

3. The attempt at a solution
I have been trying to solve it for hours, but keep getting the wrong solution. Each solution takes about 40 minutes, and i'm wondering if there is a faster way than my method, which is:

y'' + 4y = 8t^2 * [1 - u(t-5)] = 8t^2 - 8t^2 * u(t-5)

i set t = T + 1,

ỹ'' + 4ỹ = 8(T + 1)^2 - 8(T + 1)^2 * u(T - 4)

Then I use Laplace on both sides, and get some very messy expressions. I solve for Ỹ = ℒ(ỹ) on the left. I reduce everything on the right with partial fractions., which takes an insane amount of time. Then i find ỹ by taking the inverse Laplace on both sides. Finally, I substitute T with r - 1. Is this the correct way of doing it?

2. Sep 27, 2015

### Zondrina

This first step is wrong:

In order to write $f(t)$ in terms of step functions, you need to write:

$$f(t) = 8t^2 [u(t - 0) - u(t - 5)] = 8t^2 u(t - 0) - 8t^2 u(t - 5)$$

Now obtain $Y(s)$ by applying the Laplace transform to both sides and continue.

3. Sep 27, 2015

### Staff: Mentor

But isn't u(t - 0) = 1 for t ≥ 0? How is what you wrote correct and what the OP wrote incorrect if both are the same.
It's possible that you (@Zondrina) didn't read the OP closely enough. What Jonas is trying to do is to use a translated coordinate system to get the initial conditions at 0 instead of 1.

Jonas, show us what you get when you take the Laplace transform of the last equation you show. What you describe as your process seems fine to me, except for the last step -- replace T by t - 1, not r - 1.

This DE happens to be easier to solve using other methods than by Laplace transforms. As a check on your work, you might go at it using another method, if you know another. Both methods should give the same solution.

4. Sep 27, 2015

### Ray Vickson

Yes, provided that you did the steps correctly, which we cannot judge because you do not present the details. What is your final expression for $y(t)$? I might be able to compare your final expression with mine.

5. Sep 28, 2015

### Jonas E

Sorry, @Mark44 , I meant T by t - 1, not r - 1.

Here are the steps I did:

y'' + 4y = 8t^2 * [1 - u(t-5)] = 8t^2 - 8t^2 * u(t-5)

ỹ'' + 4ỹ = 8(T + 1)^2 - 8(T + 1)^2 * u(T - 4)

ỹ'' + 4ỹ = 8(T^2 + 2T + 1) - 8(T^2 + 2T + 1) * u(t - 4)

I use Laplace on both sides and get:

s(s + 4)Ỹ - s - scos(2) + 2sin(2) - 8 - 4cos(2) = 16/s^3 + 16/s^2 + 8/s - 8ℒ(T^2 * u(t - 4)) - 16ℒ(T * u(t - 4)) - 8ℒ(u(t - 4))

s(s + 4)Ỹ - s - scos(2) + 2sin(2) - 8 - 4cos(2) = 16/s^3 + 16/s^2 + 8/s - 8e^(-4s) * (2/s^3 + 8/s^2 + 16/s) - 16e^(-4s) * (1/s^2 + 4/s) - 8e^(-4s) * 1/s

s(s + 4)Ỹ - s - scos(2) + 2sin(2) - 8 - 4cos(2) = (16 + 16s + 8s^2) / (s^3) - e^(-4s) * (16 - 80s - 200s^2) / (s^3)

Then I solve for Ỹ on the left, and get:

Ỹ = (16 + 16s + 8s^2) / [(s^4)(s+4)] - e^(-4s) * (16 - 80s - 200s^2) / [(s^4)(s+4)] + (s + scos(2) - 2sin(2) + 8 + 4cos(2)) / [s(s+4)]

Now I use partial fraction decomposition on all 3 terms:

first term) (16 + 16s + 8s^2) / [(s^4)(s+4)] = (As^3 + Bs^2 + Cs + D) / (s^4) + E / (s + 4)

I get A = -5 / 16, B = 5 / 4, C = 3, D = 4, E = 5 / 16

second term) (16 - 80s - 200s^2) / [(s^4)(s+4)] = (As^3 + Bs^2 + Cs + D) / (s^4) + E / (s + 4)

I get A = -179 / 16, B = 179 / 4, C = 21, D = -4, E = 179 / 16

third term) (s + scos(2) - 2sin(2) + 8 + 4cos(2)) / [s(s+4)] = A / s + B / (s + 4)

I get A = 2 - (1/2)sin(2) + cos(2), B = (1/2)sin(2) - 1

Now I put it all together:

Ỹ = (-5 / 16s) + (5 / 4s^2) + (3 / s^3) + (4 / s^4) + (5 / 16(s+4)) + e^(-4s) * [(-179 / 16s) + (179 / 4s^2) + (21 / s^3) + (-4 / s^4) + (179 / 16(s+4))]
+ [2 - (1/2)sin(2) + cos(2)] / s + [(1/2)sin(2) - 1] / (s + 4)

(At this point I think I have already made a mistake somewhere, because it looks too messy to be correct)
Now I use inverse Laplace on both sides and get:

ỹ = (- 5 / 16) + (5/4)T + (3/2)T^2 + (2/3)T^3 + (5/16)e^(-4T) - (179/16)u(T - 4) + (179/4)(T-4)u(T - 4) + (21/2)(T-4)^2 * u(T - 4) - (2/3)(T-4)^3 * u(T - 4)
+ (179/16)e^(-4T + 16) * u(T-4) + [2 - (1/2)sin(2) + cos(2)] + [(1/2)sin(2) - 1]e^(-4T)

Now I simplify, and substitute T with t - 1, and get:

y = -5/16 + (5/4)(t-1) + (3/2)(t^2 -2t + 1) + (2/3)(t^3 -3t^2 +3t -1) + (5/16)e^(-4t+4) + 2 - (1/2)sin(2) + cos(2) + (1/2)sin(2)e^(-4t+4) - e(-4t+4) + (179e^20 / 16)e^(-4t)
+ [5323/48 - (441/4)t \ (41/2)t^2 - (2/3)t^3]u(t-5)

Thanks a lot for the feedback.

P.S.
The final expression, according to Kreyszig's "Advanced Engineering Mathematics, 9th edition", should be:

cos(2t) + 2t^2 - 1, if 0 < t < 5

cos(2t) + 49cos(2t - 10 + 10sin(2t - 10), if t > 5

6. Sep 28, 2015

### Staff: Mentor

I believe that your mistake is in the line above. The transformation you did, T = t - 1, is in the t domain, not in the s domain. Taking the Laplace transform of the diff. equation a few lines up should give you this:
$s^2Ỹ - s + \text{ rest of the stuff}$.

I agree that this is a very messy problem, made much more difficult by the initial conditions.

Since problems like this have so many steps, I've found that it's a good idea to check all steps that I can. For example, after doing a step with partial fractions, verify that my decomposition actually gets me back to what I started with.

7. Sep 28, 2015

### Jonas E

Ah, thanks a lot for the help. So, the mistake was that s(s + 4)Ỹ should have been (s^2 + 4)Ỹ instead? It seems I accidentally calculated 4ℒ(ỹ) to be 4sỸ

8. Sep 28, 2015

### Staff: Mentor

Yes, I believe so.
You had $\bar{y"} + 4\bar{y}$ on the left side. After the transform, this would be $s^2Y(s) - s\bar{y'}(0) - \bar{y}(0) + 4Y(s) = (s^2 + 4)Y(s) + \text{ other stuff}$.

You showed a lot of work, so it's possible there are other mistakes. What I noted was what caught my eye.

9. Sep 28, 2015

### Ray Vickson

I think you made an error in your transformation of the LHS. I will use the notation $z(T)$ instead of $y(T+1)$, so on the left you should have
$${\cal L} ( z^{''} + 4 z ) (s) = s[s Z_s - z(0)] - z'(0) + 4 Z_s = (s^2 + 4) Z_s - s(1 + \cos(2)) - (4 - 2 \sin(2))$$
Here, $Z_s = {\cal L} (z)(s)$.

The correct expression on the left is different from yours.