Orthogonal Polynomials Extra Problems

download Orthogonal Polynomials Extra Problems

of 6

Transcript of Orthogonal Polynomials Extra Problems

  • 7/28/2019 Orthogonal Polynomials Extra Problems

    1/6

    Orthogonal Least Squares: Revision Problems

    Problems

    Problem 1

    Given the function fx logx 2. Find a polynomial approximation for this function in the range x [1, 2] of order 3.Estimate the maximal error made in your calculations if you replace fx by p3x. Use for the maximum estimation the formulamaxaxb fx p3x ba n1n1 maxaxb fn1x .Compare this error with the integral error 2 12fx p3x2 x.

    Problem 2

    Derive the first 6 Legendre polynomials, P0x, P1x, P2x, P3x, P4x, P5x, using the recurrence formula given in thelecture. Start with P0x 1 and P1x x. Show that the polynomials are orthogonal.Problem 3

    Give a graphical representation of the first three Chebyshev polynomials Tnx, where n 0, 1, 2.Problem 4

    Approximate fx 11x2

    on the interval [-1,1] by a polynomial of degree 2, using the least square method with orthogonal

    polynomials.

    Problem 5

    Find a second degree polynomial for fx x12 on [-1,1], using weighted least square approximation withwx 1 1 x2 . Choose the appropriate orthogonal ploynomials.

    Problem 6

    a) Find the sum of the first 5 Laguerre polynomials defined by the recursion

    b) Evaluate the resulting polynomial at x 2.5 using Horners rule symbolically and in tabular form. Show all your steps in detail.

  • 7/28/2019 Orthogonal Polynomials Extra Problems

    2/6

    Solutions

    Problem 1

    f

    x

    log

    x 2

    , x [1,2]. Then f

    x

    is approximately equal to P3

    x

    a0 a1 x a2 x

    2 a3 x

    3. Try to solve it on your own,

    this problem is exactly like Problem 15 in Classwork 003.

    Problem 2

    You are given the first 2 Legendre polynomials, use them in the recurrence formula to get the other ones needed. The recurrence

    formula given in the lecture is

    and the first 6 polynomials are

    Problem 3

    Plot1, x, 2 x2 1, x, 1.5, 1.5

    1.5 1.0 0.5 0.5 1.0 1.5

    1

    1

    2

    3

    2 Orthogonal_Polynomials_extra_problems.nb

  • 7/28/2019 Orthogonal Polynomials Extra Problems

    3/6

    Problem 4

    We have the following function

    (0.1)fx 11 x2

    and we need to get a 2nd degree polynomial that approximates it on the interval [-1, 1]. The weighting function is not given, so we

    assume it to be wx 1. Thus, Legendre's polynomials will be used.

    In[8]:= p0 1; p1 x; p2 1

    23 x2 1; w 1;

    Then, the form of the required polynomial is

    (0.2)P2 a0 p0 a1 p1 a2 p2

    Now, we simply need to find the coeffecients a0, a1 and a2. These are found using the following expression

    (0.3)ai abfx pix wx xabfx pix wx x

    Substituting in this expression with i 0, we get the first coefficient, a0

    In[9]:= a0 1

    1f p0 w x

    1

    1p0 p0 w x

    Integrate::idiv : Integral of1

    1x2does not converge on 1, 1.

    This is problematic, as it leads to a singularity. Which means that our initial choice of the weighting function was not a good one.

    Since our interval is [-1,1], we still have 2 more options to choose from. We can either work with the Chebyshev polynomials of

    the first or the second kind. Lets use the second kind which has a the weighting function wx 1 x2 . Substituting with thisw

    x

    in equation (0.3) we get the coefficients ai.

    In[16]:= a0 1

    1f p0 w x

    1

    1p0 p0 w x

    Out[16]= 2

    Orthogonal_Polynomials_extra_problems.nb 3

  • 7/28/2019 Orthogonal Polynomials Extra Problems

    4/6

    In[18]:= a1 1

    1f p1 w x

    1

    1p1 p1 w x

    Out[18]= 0

    In[19]:= a2 11

    f p2 w x

    1

    1p2 p2 w x

    Out[19]=

    16

    5

    Now that we have the coeffients, we just multiply them by the Chebyshev polynomials of the second kind, given next

    In[20]:= U0 1; U1 2 x; U2 4 x2 1;

    In[24]:= P2 a0 U0 a1 U1 a2 U2 Expand

    Out[24]= 6

    5

    64 x2

    5

    Which is the polynomail we are looking for. This can also be written as P2x 1.2 12.8 x2. Now, to calculate the error, weuse the formula

    (0.4)Error2

    ab

    f

    x

    Pn

    x

    2 w

    x

    x

    Problem 5

    We have the following function

    (0.5)fx x12

    and we need to get a 2nd degree polynomial that approximates it on the interval [-1, 1]. The given weighting function is

    wx 1 1 x2 . Thus, Chebyshevs polynomials of the first kind will be used

    4 Orthogonal_Polynomials_extra_problems.nb

  • 7/28/2019 Orthogonal Polynomials Extra Problems

    5/6

    In[25]:= T0 1; T1 2 x; T2 4 x2 1; w

    1

    1 x2

    ;

    Then, the form of the required polynomial is

    (0.6)P2 a0 U0 a1 U1 a2 U2

    and the coefficients are

    In[28]:= a0 1

    1f T0 w x

    1

    1T0 T0 w x

    N

    Out[28]= 12.4721

    In[29]:= a1 1

    1f T1 w x

    1

    1T1 T1 w x

    N

    Out[29]= 9.69759

    In[30]:= a2 1

    1

    f T2 w x

    1

    1T2 T2 w x

    N

    Out[30]= 8.20829

    Finally, the polynomial we are looking for is

    In[32]:= P2 a0 T0 a1 T1 a2 T2 Expand

    Out[32]= 4.26379 19.3952 x 32.8332 x2

    Problem 6

    Using Laguerres recurrence relation given, we get the first 5 polynomials

    Then, we get their sum as

    L0 1; L1 1 x; L2 1

    2

    x2 4 x 2;

    L3 1

    6x3 9 x2 18 x 6; L4

    1

    24x4 16 x3 72 x2 96 x 24;

    P4 L0 L1 L2 L3 L4 Expand

    5 10 x 5 x2

    5 x3

    6

    x4

    24

    Now, we use Horners rule as follows

    Orthogonal_Polynomials_extra_problems.nb 5

  • 7/28/2019 Orthogonal Polynomials Extra Problems

    6/6

    6 Orthogonal_Polynomials_extra_problems.nb