LEGENDRE_TR_EVAL Evaluates Discrete Legendre Transform formula (4.4.17) pag. 118, Quarteroni-Valli, Springer 1997 with coefficients computed with formula (4.4.18) pag. 118, Quarteroni-Valli, Springer 1997 [u_int]=legendre_tr_eval(x,u,x_int) returns the evaluation at nodes x_int of the expansion of (I_N u)(x) with respect to Legendre polynomials (I_n u)(x)=\Sum_{k=0}^n u_k L_k(x) (*) where L_k(x) are the Legendre polynomials Input: x = array of np Legendre Gauss Lobatto (LGL) nodes on [-1,1] u = array of np values of u at LGL nodes x : u_j=u(x_j) size(u)=[np,nc], where nc is the number of transforms which should be computed. If u is a 2-indices array, then every column of u is transformed following formula (*) x_int = array of a second set of nodes in [-1,1] Output: u_int = array of the values of the expansion of I_Nu(x) with respect to Legendre polynomials. Reference: A. Quarteroni, A. Valli: "Numerical Approximation of Partial Differential Equations" Springer Verlag / 1997 (2nd Ed)
0001 function [u_int]=legendre_tr_eval(x,u,x_int); 0002 % LEGENDRE_TR_EVAL Evaluates Discrete Legendre Transform 0003 % 0004 % formula (4.4.17) pag. 118, Quarteroni-Valli, Springer 1997 0005 % with coefficients computed with formula (4.4.18) 0006 % pag. 118, Quarteroni-Valli, Springer 1997 0007 % 0008 % [u_int]=legendre_tr_eval(x,u,x_int) returns the evaluation at nodes x_int 0009 % of the expansion of (I_N u)(x) with respect to Legendre polynomials 0010 % 0011 % (I_n u)(x)=\Sum_{k=0}^n u_k L_k(x) (*) 0012 % 0013 % where L_k(x) are the Legendre polynomials 0014 % 0015 % Input: x = array of np Legendre Gauss Lobatto (LGL) nodes on [-1,1] 0016 % u = array of np values of u at LGL nodes x : u_j=u(x_j) 0017 % size(u)=[np,nc], where nc is the number of transforms which 0018 % should be computed. 0019 % If u is a 2-indices array, then every column of u is transformed 0020 % following formula (*) 0021 % x_int = array of a second set of nodes in [-1,1] 0022 % 0023 % Output: u_int = array of the values of the 0024 % expansion of I_Nu(x) with respect to Legendre polynomials. 0025 % 0026 % Reference: A. Quarteroni, A. Valli: 0027 % "Numerical Approximation of Partial Differential Equations" 0028 % Springer Verlag / 1997 (2nd Ed) 0029 % 0030 0031 % Written by Paola Gervasio 0032 % $Date: 2007/04/01$ 0033 0034 0035 n1=length(x_int); 0036 np=length(x); n=np-1; 0037 0038 uk=legendre_tr_coef(x,u); 0039 pn=pnleg_all(x_int,n); 0040 u_int=pn*uk; 0041 0042 return