Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Piecewise Quadratic Approximation

  1. Apr 27, 2010 #1
    Could somebody explain what exactly a "piecewise quadratic approximation" is?

    Problem Statement

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

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

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

    What is the maximum value of the following:

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

    The problem goes on to say:

    Can you find a piecewise approximation to f(x) that is continuous on [tex][0,\pi][/tex] 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. jcsd
  3. Apr 28, 2010 #2

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.
     
  4. Apr 28, 2010 #3
    Thanks for the reply, and sorry about the double post. I hadn't realized I had posted the question in the wrong forum per the first thread's instructions.

    Regarding your reply, what does it mean by "continuous piecewise function?"

    And why would finding the second order Taylor expansion of [tex]\sin{4x}[/tex] be useless? It would give a pretty good approximation per the given domain.
     
  5. Apr 28, 2010 #4

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    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 [itex]\pi[/itex], say [itex]x_0= 0[/itex], [itex]x_1, x_2, [/itex], etc. to [itex]x_n= \pi[/itex] 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 [itex]\{(x_0, sin(4x_0), (x_1, sin(4x_1), (x_2, sin(4x_2)\}[/itex]to determine the first parabola, [itex]\{(x_2, sin(4x_2)), (x_3, sin(4x_3), (x_5, sin(4x_5)\}[/itex] to determine the second, etc.
     
  6. Apr 28, 2010 #5

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.
     
  7. Apr 28, 2010 #6

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.
     
  8. Apr 28, 2010 #7
    I feel like that would be the best way to do it. However, regarding the continuous piecewise, how would you go about doing that?
     
  9. Apr 28, 2010 #8

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Your parabolas are going to match up at the zeroes of the sine function aren't they?
     
  10. Apr 28, 2010 #9
    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.
     
  11. Apr 28, 2010 #10

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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?
     
  12. Apr 28, 2010 #11
    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
  13. Apr 28, 2010 #12

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

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

    And your formulas are all second degree [quadratic] polynomials, yes?

    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.
     
  14. Apr 28, 2010 #13
    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 [tex]|f(x)-P(x)|[/tex] on [tex][0,\pi][/tex]
     
    Last edited: Apr 28, 2010
  15. Apr 28, 2010 #14

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Well, you have a lot of symmetry so you could probably look at one arch. Sounds like a calculus maximization problem to me.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Piecewise Quadratic Approximation
  1. Piecewise functions (Replies: 1)

  2. Piecewise function (Replies: 1)

  3. Piecewise functions (Replies: 7)

Loading...