# Thread: Integral of a multi-part function

1. ## Integral of a multi-part function

I have two functions

$\displaystyle f(t)=\left\{\begin{array}{ccc}\sqrt{t^2+2\pi t + \pi^2} &\mbox{ if }& t < -\pi \\ \cos{\left(\frac{\pi}{2} - t\right)} & \mbox{ if }& -\pi\leq t \leq \frac{\pi}{2}\\ 1 &\mbox{ if }& t > \frac{\pi}{2} \end{array}\right.$

$\displaystyle S(x)=\int_0 ^x f(t) dt \ \ \ \ -\infty < x < \infty$

I need to write S(x) without the integral sign.

My attempt
I started by trying to find the primitive functions for each part

1.a
$\displaystyle \int \sqrt{t^2 + 2\pi t + \pi^2} dt = \int \sqrt{(x+\pi)^2}= \frac{1}{2}(t+\pi)^2 +C$

2.a
$\displaystyle \int \cos{\left(\frac{\pi}{2}-t\right)} dt=\int \sin{t} dt = -\cos{t} + C$

3.a
$\displaystyle \int 1 dt = t + C$

Now what confuses me a bit is what integrating from 0 to x actually means in this case. Does it just mean that I integrate for the defined interval in each case? Or do I actually calculate things like 1.b here:

1.b
$\displaystyle \frac{1}{2}\left[(t+\pi)^2\right]_0 ^x = \frac{1}{2}\left( (x+\pi)^2 - \pi^2 \right)=\frac{1}{2}(x^2+2\pi x)$

I am also supposed to plot S(x), so I would like to grasp how it works/what it looks like. Right now I just cannot get my head around this.
Any help appreciated.

2. ## Re: Integral of a multi-part function

Originally Posted by sugarmuffin
I have two functions
$\displaystyle f(t)=\left\{\begin{array}{ccc}\sqrt{t^2+2\pi t + \pi^2} &\mbox{ if }& t < -\pi \\ \cos{\left(\frac{\pi}{2} - t\right)} & \mbox{ if }& -\pi\leq t \leq \frac{\pi}{2}\\ 1 &\mbox{ if }& t > \frac{\pi}{2} \end{array}\right.$

$\displaystyle S(x)=\int_0 ^x f(t) dt \ \ \ \ -\infty < x < \infty$

I need to write S(x) without the integral sign.
This is an extremely messy problem. You are over simplifying it too.

First, if $\displaystyle t\le -\pi$ then $\displaystyle f(t)=-(t+\pi)$.

Second, if $\displaystyle x\le -\pi$ then $\displaystyle \int_0^x {f(t)dt} = \int_0^{ - \pi } {f(t)dt} + \int_{ - \pi }^x{f(t)dt}$

So you should graph each part of the function to see what is going on.

3. ## Re: Integral of a multi-part function

This is an extremely messy problem. You are over simplifying it too.
Yeah, honestly it scares the hell out of me.

So a different way to express f(t) could be like below?

$\displaystyle f(t)=\left\{\begin{array}{ccc} \pi - t &\mbox{ if }& t < -\pi \\ \sin{t} & \mbox{ if }& -\pi\leq t \leq \frac{\pi}{2}\\ 1 &\mbox{ if }& t > \frac{\pi}{2} \end{array}\right.$

And if I continue from your example above

$\displaystyle \mbox{ if } x < -\pi \mbox{ then }\int_0 ^x f(t) dt = \int_0 ^{-\pi} f(t) dt + \int_{-\pi} x f(t) dt$

$\displaystyle = \left[\pi t\right]_0 ^{-\pi}-\frac{1}{2}\left[t^2\right]_0 ^{-\pi}+\left[\pi t\right]_{-\pi} ^x -\frac{1}{2}\left[t^2\right]_{-\pi} ^x = \pi x - \frac{1}{2} x^2$

Or am I still over simplifying things?

I am not sure I understand how/why I divide that last integral into two parts. Would the part for 2.a look like below?

$\displaystyle \mbox{ if } -\pi \leq t \leq \frac{\pi}{2} \mbox{ then } \int_0 ^x f(t) dt = \int_0 ^{-\pi} f(t) dt + \int_{-\pi} ^{\frac{\pi}{2}} f(t) dt + \int_{\frac{\pi}{2}} ^x f(t) dt$

4. ## Re: Integral of a multi-part function

Originally Posted by sugarmuffin
So a different way to express f(t) could be like below?

$\displaystyle f(t)=\left\{\begin{array}{ccc} \pi - t &\mbox{ if }& t < -\pi \\ \sin{t} & \mbox{ if }& -\pi\leq t \leq \frac{\pi}{2}\\ 1 &\mbox{ if }& t > \frac{\pi}{2} \end{array}\right.$
You have a mistake in the first line.
$\displaystyle f(t)=\left\{\begin{array}{ccc} -\pi - t &\mbox{ if }& t < -\pi \\ \sin{t} & \mbox{ if }& -\pi\leq t \leq \frac{\pi}{2}\\ 1 &\mbox{ if }& t > \frac{\pi}{2} \end{array}\right.$

5. ## Re: Integral of a multi-part function

Right, I don't know how I missed that.
Then

$\displaystyle \mbox{ if } x < -\pi \mbox{ then }\int_0 ^x f(t) dt = \int_0 ^{-\pi} f(t) dt + \int_{-\pi} x f(t) dt$
$\displaystyle = \left[-\pi t\right]_0 ^{-\pi}-\frac{1}{2}\left[t^2\right]_0 ^{-\pi}+\left[-\pi t\right]_{-\pi} ^x -\frac{1}{2}\left[t^2\right]_{-\pi} ^x = -\pi x - \frac{1}{2} x^2$

Pretty sure that part is correct now. But I am still a bit confused. Was the second part of my last post correct? The assumption that the part for 2.a would look like below?

$\displaystyle \mbox{ if } -\pi \leq t \leq \frac{\pi}{2} \mbox{ then } \int_0 ^x f(t) dt = \int_0 ^{-\pi} f(t) dt + \int_{-\pi} ^{\frac{\pi}{2}} f(t) dt + \int_{\frac{\pi}{2}} ^x f(t) dt$

6. ## Re: Integral of a multi-part function

Attempt 3

I've ended up with this

$\displaystyle S(x)=\left\{\begin{array}{ccc}-\pi x - \frac{1}{2}x^2 & \mbox{ if } & x < -\pi \\ 1-\cos{x} & \mbox{ if } & -\pi \leq x \leq \frac{\pi}{2} \\ x & \mbox{ if } & x>\frac{\pi}{2}\end{array}\right.$

Is this in any way correct?
I'm not really sure if I am still over simplifying things. And I apologize if these are stupid questions, but I am extremely stressed at the moment and just cannot figure this out.

Again, thanks for the help.

7. ## Re: Integral of a multi-part function

Originally Posted by sugarmuffin
Attempt 3

I've ended up with this

$\displaystyle S(x)=\left\{\begin{array}{ccc}-\pi x - \frac{1}{2}x^2 & \mbox{ if } & x < -\pi \\ 1-\cos{x} & \mbox{ if } & -\pi \leq x \leq \frac{\pi}{2} \\ x & \mbox{ if } & x>\frac{\pi}{2}\end{array}\right.$

Is this in any way correct?
Did you account for the fact $\displaystyle \int_0^{ - \pi } {f(t)dt}=2~?$

8. ## Re: Integral of a multi-part function

Originally Posted by Plato
Did you account for the fact $\displaystyle \int_0^{ - \pi } {f(t)dt}=2~?$
No.. I don't think I did. I have to admit that that completely stumps me, how does that come about?

9. ## Re: Integral of a multi-part function

Originally Posted by sugarmuffin
No.. I don't think I did. I have to admit that that completely stumps me, how does that come about?
If $\displaystyle x\le -\pi$ then $\displaystyle S(x)=S(-\pi)+\int_{-\pi}^{ x } {f(t)dt}=2+\int_{-\pi}^{ x } {(-\pi-t)dt}$

10. ## Re: Integral of a multi-part function

Ahhh okay, I see what you mean now. But in the original post, $\displaystyle f(t) = -t - \pi \mbox{ if } t < -\pi$

So is $\displaystyle t = -\pi$ really a part of this interval? Can I still use it in the way you have suggested?
I just assumed it would be part of the sin(t) interval, and could only be used there.

11. ## Re: Integral of a multi-part function

Originally Posted by sugarmuffin
Ahhh okay, I see what you mean now. But in the original post, $\displaystyle \color{red}f(t) = -t - \pi \mbox{ if } t < -\pi$
So is $\displaystyle t = -\pi$ really a part of this interval? Can I still use it in the way you have suggested?
I just assumed it would be part of the sin(t) interval, and could only be used there.
In integrals that makes absolutely no difference.
The value is the same no matter one point.

If $\displaystyle -pi\le x \le\tfrac{\pi}{2}$ then $\displaystyle S(x)=\int_{ 0}^x {\sin(t)dt}$.
Just do straightforward integration. Change no limits around.

If $\displaystyle x\ge\tfrac{\pi}{2}$ then $\displaystyle S(x)=S\left( {\tfrac{\pi }{2}} \right) + \int_{\frac{\pi }{2}}^x {1 dt}$

12. ## Re: Integral of a multi-part function

Okay, this has begun making sense. You sir, are a saint.

It would make sense to first do the middle one:

$\displaystyle \mbox{ If } \ -\pi\le x \le\tfrac{\pi}{2} \ \mbox{ then } \ S(x)=\int_{ 0}^x {\sin(t)dt}=\underline{1-\cos{x}}$.

Then as you said before

$\displaystyle \mbox{ If } \ x \leq -\pi \ \mbox{ then } \ \int_0 ^x f(t) dt = S(-\pi) + \int_{-\pi} ^x f(t) dt$

$\displaystyle = 2 - \frac{1}{2}\left[t^2\right]_{-\pi} ^x - \left[\pi t\right]_{-\pi}^x =\underline{2 -\frac{1}{2}x^2-\pi x - \frac{\pi^2}{2}}$

And then finally with the same logic as before

$\displaystyle \mbox{If } \ x\ge\tfrac{\pi}{2} \ \mbox{ then } S(x)=S\left( {\tfrac{\pi }{2}} \right) + \int_{\frac{\pi }{2}}^x {1 dt} = (1-\cos{\frac{\pi}{2}}) +\left[ t\right]_{\frac{\pi}{2}} ^x =\underline{1 + (x - \frac{\pi}{2})}$

Does this look better?

13. ## Re: Integral of a multi-part function

Originally Posted by sugarmuffin
Does this look better?
Yes, much better.

14. ## Re: Integral of a multi-part function

I've gone through it a couple of times now. Think I understand what we did fairly well.

Thanks again for your help. Really appreciated.