CS 131 Discussion 2

629 days ago by srborlongan

%latex 7.13 (a) The \emph{k}th Chebyshev polynomial of the first kind is defined on the interval [-1,1] by \\ \begin{align} T_k(t) & = \cos ({k \arccos {(t)}}). \end{align} Given that \\ \begin{align} T_0(t) & = 1 \\ T_1(t) & = t \end{align} The three-term recurrence for the \emph{k}th Chebyshev polynomial of the first kind is \begin{align} T_{k+1}(t) & = 2 \, t \, T_{k}(t) - T_{k-1}(t). \end{align} Proof: \\ Basis: (k = 1) \\ \begin{align} T_{1+1}(t) & = 2 \, t \, T_{1}(t) - T_{1-1}(t) \\ T_{2}(t) & = 2 \, t \, T_{1}(t) - T_{0}(t) \\ & = 2 \, t \, \bullet \, t - 1 \\ & = 2 \, t ^ 2 - 1 \\ & = \cos ({2 \arccos {(t)}}) \end{align} Induction step: (k = n + 1) \\ If \begin{align} T_{n}(t) & = 2t T_{n-1}(t) - T_{n-2}(t) \\ & = 2t \cos ({(n-1) \arccos {(t)}}) - \cos ({(n-2) \arccos {(t)}}) \\ & = \cos ({n \arccos {(t)}}), \end{align} then \begin{align} T_{n+1}(t) & = 2t T_{n}(t) - T_{n-1}(t) \\ & = 2t \cos ({n \arccos {(t)}}) - \cos ({(n-1) \arccos {(t)}}) \\ & = 2t \cos ({n \arccos {(t)}}) - \cos ({n \arccos {(t)} - \arccos {(t)}}) \\ & = 2t \cos ({n \arccos {(t)}}) - (\cos ({n \arccos {(t)}}) \cos ({\arccos {(t)}}) + \sin ({n \arccos {(t)}}) \sin ({\arccos {(t)}})) \\ & = 2t \cos ({n \arccos {(t)}}) - \cos ({n \arccos {(t)}}) \cos ({\arccos {(t)}}) - \sin ({n \arccos {(t)}}) \sin ({\arccos {(t)}}) \\ & = 2t \cos ({n \arccos {(t)}}) - t \cos ({n \arccos {(t)}}) - \sin ({n \arccos {(t)}}) \sin ({\arccos {(t)}}) \\ & = t \cos ({n \arccos {(t)}}) - \sin ({n \arccos {(t)}}) \sin ({\arccos {(t)}}) \\ & = \cos ({n \arccos {(t)}}) \cos ({\arccos {(t)}}) - \sin ({n \arccos {(t)}}) \sin ({\arccos {(t)}}) \\ & = \cos ({n \arccos {(t)} + \arccos {(t)}}) \\ & = \cos ({(n+1) \arccos {(t)}}) \end{align} 
       
%latex 7.13 (b) 
       
%sage for k in range(6): print "cos({0}*arccos(t)) =".format(k),cos(k*arccos(var('t'))).full_simplify() print "Plot of cos({0}*arccos(t)) =".format(k) plot(cos(k*arccos(var('t'))), (-1,1)) 
       
cos(0*arccos(t)) = 1
Plot of cos(0*arccos(t)) =


cos(1*arccos(t)) = t
Plot of cos(1*arccos(t)) =


cos(2*arccos(t)) = 2*t^2 - 1
Plot of cos(2*arccos(t)) =


cos(3*arccos(t)) = 4*t^3 - 3*t
Plot of cos(3*arccos(t)) =


cos(4*arccos(t)) = 8*t^4 - 8*t^2 + 1
Plot of cos(4*arccos(t)) =


cos(5*arccos(t)) = 16*t^5 - 20*t^3 + 5*t
Plot of cos(5*arccos(t)) =
cos(0*arccos(t)) = 1
Plot of cos(0*arccos(t)) =


cos(1*arccos(t)) = t
Plot of cos(1*arccos(t)) =


cos(2*arccos(t)) = 2*t^2 - 1
Plot of cos(2*arccos(t)) =


cos(3*arccos(t)) = 4*t^3 - 3*t
Plot of cos(3*arccos(t)) =


cos(4*arccos(t)) = 8*t^4 - 8*t^2 + 1
Plot of cos(4*arccos(t)) =


cos(5*arccos(t)) = 16*t^5 - 20*t^3 + 5*t
Plot of cos(5*arccos(t)) =
%latex 7.13 (c) The \emph{k} roots of the \emph{k}th Chebyshev polynomial of the first kind are the values of \begin{align} t_i \mbox{ , } i = 0,1,\ldots,k \end{align} such that \\ \begin{align} \cos ({k \arccos {(t_i)}}) & = 0 \\ k \arccos {(t_i)} & = \frac {(2i-1) \pi} {2} \mbox{ , } i = 1,\ldots,k \\ \arccos {(t_i)} & = \frac {(2i-1) \pi} {2k} \mbox{ , } i = 1,\ldots,k \\ t_i & = \cos \left ( {\frac {(2i-1) \pi} {2k}} \right ) \mbox{ , } i = 1,\ldots,k \\ \end{align} The \emph{k} + 1 extrema (including the endpoints) of the \emph{k}th Chebyshev polynomial of the first kind are the values of \begin{align} t_i \mbox{ , } i = 0,1,\ldots,k \end{align} \begin{align} | \cos ({k \arccos {(t_i)}}) | & = 1 \\ k \arccos {(t_i)} & = i \pi \mbox{ , } i = 0,1,\ldots,k \\ \arccos {(t_i)} & = \frac {i \pi} {k} \mbox{ , } i = 0,1,\ldots,k \\ t_i & = \cos \left ( {\frac {i \pi} {k}} \right ) \mbox{ , } i = 0,1,\ldots,k \end{align} 
       
%latex 8.10 (a) The \emph{n} Chebyshev nodes in the interval [-1,1] are \begin{align} x_i & = \cos \left ( \frac { 2 i - 1 } { 2 n } \pi \right ) \mbox{ , } i = 1,\ldots,n. \end{align} For a three-point Chebyshev quadrature rule on the interval [-1, 1], we need to determine the weight \emph{w} and the nodes \begin{align} x_1 \mbox{ , } x_2 \mbox{ , } x_3. \end{align} %latex Nodes: \\ \begin{align} x_1 & = \cos \left ( \frac { 2 \bullet 1 - 1 } { 2 \bullet 3 } \pi \right ) \\ & = \cos \left ( \frac { \pi } { 6 } \right ) \\ x_1 & = \frac { \sqrt 3 } {2} \end{align} \begin{align} x_2 & = \cos \left ( \frac { 2 \bullet 2 - 1 } { 2 \bullet 3 } \pi \right ) \\ & = \cos \left ( \frac { 3 \pi } { 6 } \right ) \\ x_2 & = 0 \end{align} \begin{align} x_3 & = \cos \left ( \frac { 2 \bullet 2 - 1 } { 2 \bullet 3 } \pi \right ) \\ & = \cos \left ( \frac { 5 \pi } { 6 } \right ) \\ x_3 & = - \frac { \sqrt 3 } {2} \end{align} 
       
%latex Moment Equations: \\ \begin{align} w_1 \bullet 1 + w \bullet 1 + w \bullet 1 & = \int_{ -1 }^{ 1 } \! 1 \, dx \\ & = x \mid_{ -1 }^{ 1 } \! \\ & = 1 - ( -1 ) \\ & = 1 + 1 \\ & = 2 \end{align} \begin{align} w_1 \bullet x_1 + w \bullet x_2 + w \bullet x_3 & = \int_{ -1 }^{ 1 } \! x \, dx \\ & = \frac { x ^ 2 } { 2 } \mid_{ -1 }^{ 1 } \! \\ & = \frac { 1 ^ 2 - ( -1 ) ^ 2 } { 2 } \\ & = \frac { 1 - 1 } { 2 } \\ & = 0 \end{align} \begin{align} w_1 \bullet x_1^2 + w \bullet x_2^2 + w \bullet x_3^2 & = \int_{ -1 }^{ 1 } \! x^2 \, dx \\ & = \frac { x ^ 3 } { 3 } \mid_{ -1 }^{ 1 } \! \\ & = \frac { 1 ^ 3 - ( -1 ) ^ 3 } { 2 } \\ & = \frac { 1 - ( -1 ) } { 2 } \\ & = \frac { 1 + 1 } { 2 } \\ & = \frac { 2 } { 2 } \\ & = 1 \end{align} 
       
print 'In matrix form:' print Matrix(RR, [ [1 , 1 , 1 , 2], [sqrt(3) / 2 , 0 , - sqrt(3) / 2 , 0], [(sqrt(3) / 2) ^ 2 , 0 , (- sqrt(3) / 2) ^ 2 , 1] ] ) print 'Solving by Gauss-Jordan:' print Matrix(RR, [ [1 , 1 , 1 , 2], [sqrt(3) / 2 , 0 , - sqrt(3) / 2 , 0], [(sqrt(3) / 2) ^ 2 , 0 , (- sqrt(3) / 2) ^ 2 , 1] ] ).echelon_form() 
       
In matrix form:
[  1.00000000000000   1.00000000000000   1.00000000000000  
2.00000000000000]
[ 0.866025403784439  0.000000000000000 -0.866025403784439 
0.000000000000000]
[ 0.750000000000000  0.000000000000000  0.750000000000000  
1.00000000000000]
Solving by Gauss-Jordan:
[ 1.00000000000000 0.000000000000000 0.000000000000000
0.666666666666667]
[0.000000000000000  1.00000000000000 0.000000000000000
0.666666666666667]
[0.000000000000000 0.000000000000000  1.00000000000000
0.666666666666667]
In matrix form:
[  1.00000000000000   1.00000000000000   1.00000000000000   2.00000000000000]
[ 0.866025403784439  0.000000000000000 -0.866025403784439  0.000000000000000]
[ 0.750000000000000  0.000000000000000  0.750000000000000   1.00000000000000]
Solving by Gauss-Jordan:
[ 1.00000000000000 0.000000000000000 0.000000000000000 0.666666666666667]
[0.000000000000000  1.00000000000000 0.000000000000000 0.666666666666667]
[0.000000000000000 0.000000000000000  1.00000000000000 0.666666666666667]
%latex Weight: \\ \begin{align} w & = \frac {2} {3} \end{align} Final Answers: \\ \begin{align} x_1 & = \frac {\sqrt 3 } {2} \\ x_2 & = 0 \\ x_3 & = - \frac {\sqrt 3 } {2} \\ w & = \frac {2} {3} \end{align} 
       
%latex 8.10 (b) Since the resulting rule uses 3 polynomial basis functions, said quadrature rule will then integrate any polynomial of degree 2 exactly. \\