<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Orthogonal polynomial function: Legendre polynomials in SAS/IML in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666154#M5186</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replicate a simulation that requires using Legendre polynomial function. I have a vector of values between -1 and 1 and need to calculate the Legendre function of different orders evaluated at each element in this vector. I noticed that Matlab has a function (legendre(n,x)) that calculates associated legendre polynomials of degree n&amp;nbsp; with order m (I only need it for m=0) and this produces the values that I expect to have for this vector. However, I'm doing this simulation work in SAS and am wondering if there is an equivalent built-in function in SAS/IML.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed that there is the ORPOL function but I am not quite sure if this is the same function as it generates different values.&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jun 2020 16:59:15 GMT</pubDate>
    <dc:creator>ZMX</dc:creator>
    <dc:date>2020-06-30T16:59:15Z</dc:date>
    <item>
      <title>Orthogonal polynomial function: Legendre polynomials in SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666154#M5186</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replicate a simulation that requires using Legendre polynomial function. I have a vector of values between -1 and 1 and need to calculate the Legendre function of different orders evaluated at each element in this vector. I noticed that Matlab has a function (legendre(n,x)) that calculates associated legendre polynomials of degree n&amp;nbsp; with order m (I only need it for m=0) and this produces the values that I expect to have for this vector. However, I'm doing this simulation work in SAS and am wondering if there is an equivalent built-in function in SAS/IML.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed that there is the ORPOL function but I am not quite sure if this is the same function as it generates different values.&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 16:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666154#M5186</guid>
      <dc:creator>ZMX</dc:creator>
      <dc:date>2020-06-30T16:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Orthogonal polynomial function: Legendre polynomials in SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666165#M5187</link>
      <description>&lt;P&gt;I think you didn't read all the way to the end of the doc for ORPOL. It includes an example of how to generate Legendre polynomials by using the usual three-term recurrence. The doc example computes the Legendre polynomials up through degree 6. The only thing I added was writing to a SAS data set and plotting the polynomials on [-1, 1]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
maxDegree = 6;
/* evaluate polynomials at these points */
x = T( do(-1,1,0.05) );

/* define the standard Legendre Polynomials
   Using the 3-term recurrence with
   A[j]=0, B[j]=(2j-1)/j, and C[j]=(j-1)/j
   and the standardization P_j(1)=1
   which implies P_0(x)=1, P_1(x)=x. */
legendre = j(nrow(x), maxDegree+1);
legendre[,1] = 1; /* P_0 */
legendre[,2] = x; /* P_1 */

do j = 2 to maxDegree;
   legendre[,j+1] = (2*j-1)/j # x # legendre[,j] -
                      (j-1)/j # legendre[,j-1];
end;
*print legendre;

L = x || Legendre;
create Legendre from L[c=('x' || ('L0':'L6'))];
append from L;
close;

QUIT;

proc sgplot data=Legendre;
series x=x y=L0;
series x=x y=L1;
series x=x y=L2;
series x=x y=L3;
series x=x y=L4;
series x=x y=L5;
series x=x y=L6;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2020 17:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666165#M5187</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-06-30T17:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Orthogonal polynomial function: Legendre polynomials in SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666586#M5188</link>
      <description>&lt;P&gt;Did my response answer your question? If so, please mark as "Answered." If not, let us know&amp;nbsp;your other questions.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 12:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666586#M5188</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-07-02T12:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Orthogonal polynomial function: Legendre polynomials in SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666599#M5189</link>
      <description>Thanks so much for your help. Yes, I just got access to my work PC and could run the program. It does work. Thanks again.&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Jul 2020 14:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Orthogonal-polynomial-function-Legendre-polynomials-in-SAS-IML/m-p/666599#M5189</guid>
      <dc:creator>ZMX</dc:creator>
      <dc:date>2020-07-02T14:03:12Z</dc:date>
    </item>
  </channel>
</rss>

