Review2A_98F - Partial Solutions of Review Problems 2, 1998...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Partial Solutions of Review Problems 2, 1998 Fall MEAM 501 Analytical Methods in Mechanics and Mechanical Engineering 1. Define the Legendre polynomials in an interval (-1,1), and approximate a data by the least squares method for appropriate number of terms of the basis functions. Legendre polynomials are defined as the polynomials obtained by the othogonalization of the polynomial basis functions { } ... ... 1 3 n x x x x 2 with respect to an inner product (.,.) defined on a given interval, say, (-1,1) or (0,1): ( 29 - = 1 1 , fgdx g f . In general, they are also normalized by its natural norm ( 29 f f f , = . n=6 pbasis=Table[x^(i-1),{i,1,n+1}] LP=pbasis; LP[[1]]=pbasis[[1]]/Sqrt[NIntegrate[pbasis[[1]]^2,{x,-1,1}]]; Do[xi=pbasis[[i]];
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Do[cj=NIntegrate[LP[[j]]*xi,{x,-1,1}]; xi=xi-cj*LP[[j]],{j,1,i-1}]; LP[[i]]=Expand[xi/Sqrt[NIntegrate[xi^2,{x,-1,1}]]], {i,2,n+1}] LP Plot[Release[LP],{x,-1,1},PlotRange->All,Frame->True] Polynomial Basis Functions Legendre Polynomial Computed Let a function f be approximated by ( 29 ( 29 ( 29 = = n i i i n x L c x f x f 1
Background image of page 2
using the least squares method, that is, the coefficients c i are determined by solving rectangular equations with the pseudo-inverse, i.e., the singular value decomposition : ( 29 ( 29 21 ,.... , 2 , 1 , 1 = = = m x f x L c m n i m i i where x m are the coordinates at which the function f is sampled. . n=10; A=N[Table[LegendreP[i-1,x]/.{x->data[[j,1]]},{j,1,21},{i,1,n}]]; coef=PseudoInverse[A].Transpose[data][[2]]; fn=Sum[coef[[i]]*LegendreP[i-1,x],{i,1,n}] g2=Plot[fn,{x,-1,1},PlotRange->All, Frame->True, GridLines->Automatic] Show[{g1,g2}] fnj=Table[N[fn/.{x->data[[j,1]]}],{j,1,21}]; errornorm=Sqrt[(fnj-Transpose[data][[2]]).(fnj-Transpose[data][[2]])] Approximated Function f n ( x )
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Error for n = 10 : For n = 3, we have large error, say 0.35259. 2. Interpolate the above data by using the Lagrange Polynomials by using 3, 5, 11, and 21 basis functions.
Background image of page 4
Using n+1 points, 1 2 1 ..... , , , + n x x x , the n degree Lagrange polynomial is defined by ( 29 1 ,..... , 2 , 1 , 1 1 + = - - = + = n i x x x x x L n i j j j i j i . Lagrange Polynomials ( n = 5 ) Interpolation/Approximation ( n = 3 )
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Interpolation/Approximation ( n = 5 ) Interpolation/Approximation ( n = 11 ) Interpolation/Approximation ( n = 21 ) 3. Decomposing the above data into two sets for (-1,0) and (0,+1) for t, approximate the above data by using the Hermite cubic polynomials, Bezier polynomilas, and also B- spline for k=5.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 12/08/2011.

Page1 / 15

Review2A_98F - Partial Solutions of Review Problems 2, 1998...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online