1. Apr 27, 2010

### malindenmoyer

Could somebody explain what exactly a "piecewise quadratic approximation" is?

Problem Statement

Find a piecewise quadratic approximation P(x) of f(x), where

$$f(x)=\sin{4x}\; on \; [0,\pi]$$

Plot f(x) and P(x) on $$[0,\pi]$$.

What is the maximum value of the following:

$$|f(x)-P(x)| \; on \;[0,\pi]$$

The problem goes on to say:

Can you find a piecewise approximation to f(x) that is continuous on $$[0,\pi]$$ and each "piece" is a polynomial?

Attempt at Solution

I know that a piecewise is typically a set of linear functions defined at several intervals in the given domain of x. Is this what the problem is asking, except a quadratic approximation at several intervals? If so, how is one supposed to come up with that; it seems rather ambiguous. My thoughts are the same for the next part regarding the "continuous piecewise approximation".

The first part of the problem not listed asked to find a quadratic approximation of f(x), which I can do using a Taylor Series.

I have never heard of the term piecewise quadratic approximation and therefore stumped. If somebody could please give an explanation of what the problem is asking us to find, that would be greatly appreciated.

2. Apr 28, 2010

### LCKurtz

A piecewise function can be constructed with any functions, not just linear ones. I think the answer is yes about what they are asking. Since quadratics are parabolas I'm guessing you should approximate each arch of your sine function with a parabola. You should be able to match the zeroes and the max/min points.
The first two terms of a Taylor series for this function would be essentially useless.

3. Apr 28, 2010

### malindenmoyer

And why would finding the second order Taylor expansion of $$\sin{4x}$$ be useless? It would give a pretty good approximation per the given domain.

4. Apr 28, 2010

### HallsofIvy

A "piecewise continuous function" is a function that is continuous everywhere except at specific points (that separate the "pieces"). A piecewise quadratic function is a function that is given by specific quadratic formulas on the "pieces" between points and, if the two formulas on either side of a "break point" give the same value at that break point, then it is continuous, not "piecewise continuous".

The first two terms of the Taylor expansion of sin(4x) is NOT a "pretty good approximation" except close to the point about which the function is expanded. You might make it a good approximation by taking a large number of points but even then you will have a problem with matching end values.

I would suggest this- take an odd number of x values from 0 to $\pi$, say $x_0= 0$, $x_1, x_2,$, etc. to $x_n= \pi$ with n even. You need an odd number (and n even since I started with "0") because it take three points to determine a parabola. Use $\{(x_0, sin(4x_0), (x_1, sin(4x_1), (x_2, sin(4x_2)\}$to determine the first parabola, $\{(x_2, sin(4x_2)), (x_3, sin(4x_3), (x_5, sin(4x_5)\}$ to determine the second, etc.

5. Apr 28, 2010

### LCKurtz

A function that is continuous but has different formulas on different intervals in its domain. For example if f(x) = - x on (-oo, 0] and x2 on [0,oo). The two pieces agree at x = 0 so the function is well defined and continuous from both sides there.

sin(4x) has two full periods on [0,π]. There is no way for a second degree polynomial, whose graph is a parabola, to come anywhere near approximating that on the whole interval.

6. Apr 28, 2010

### LCKurtz

That strikes me as unnecessarily complicated given the loose statement of the problem. Don't pick any old odd number of points. For each arch of the sine function use the parabola matching its zeroes and max/min point. This can be easily and quickly done by hand and gives a pretty good approximation.

7. Apr 28, 2010

### malindenmoyer

I feel like that would be the best way to do it. However, regarding the continuous piecewise, how would you go about doing that?

8. Apr 28, 2010

### LCKurtz

Your parabolas are going to match up at the zeroes of the sine function aren't they?

9. Apr 28, 2010

### malindenmoyer

Yes, that is what I was thinking. My question comes from the fact that there are two parts to the problem: 1) find a piecewise quadratic, which can be done by the method you suggested, and 2) find a continuous piecewise, where each piece is a polynomial.

I hope you can see where my confusion is coming from.

10. Apr 28, 2010

### LCKurtz

Actually, I'm not sure what is bothering you. Draw a picture of two periods of a sine curve. The arches kind of look like parabolas don't they? Imagine replacing each arch with a little parabola which almost matches the sine curve, hitting it exactly at its zeroes and max/min on each arch. Don't you see the connected parabolas are continuous and approximate the sine curve?

11. Apr 28, 2010

### malindenmoyer

Yes, I understand that...but what does it mean by a CONTINUOUS piecewise.

Here is what I have so far, which suffices for the first part of the problem (I think):

[PLAIN]http://people.tamu.edu/~malindenmoyer/tamu/sin4x_plot.png [Broken]

What do I do next? That is, to come up with a continuous quadratic approximation versus the piecewise approximation.

Last edited by a moderator: May 4, 2017
12. Apr 28, 2010

### LCKurtz

Nice picture. Well, your function is a piecewise defined function because you have different formulas for the approximations to the different arches, right?

And you know what a continuous function is, right? Does the graph you drew of the approximation have any jumps, holes, or other discontinuities? Is it continuous?

If it is, I would say you have a continuous piecewise quadratic approximation.

13. Apr 28, 2010

### malindenmoyer

Yes that was my reasoning as well. I just thought it was strange the problem dedicated two parts to essentially doing one thing...

Now that I have the piecewise function...how would I go about computing

the maximum of $$|f(x)-P(x)|$$ on $$[0,\pi]$$

Last edited: Apr 28, 2010
14. Apr 28, 2010

### LCKurtz

Well, you have a lot of symmetry so you could probably look at one arch. Sounds like a calculus maximization problem to me.