<?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 Re: Could you please suggest a program to find the zeros to these two polynomials in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203901#M2137</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Really ?&amp;nbsp; &lt;STRONG&gt;Why ?&lt;/STRONG&gt;&amp;nbsp; But &lt;SPAN style="color: #000000; font-family: Consolas, Courier, 'Courier New'; font-size: 16px; background-color: #ffffff;"&gt;-1.254501 is more approximate 0 . See my LOG .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Courier, 'Courier New'; font-size: 16px; background-color: #ffffff;"&gt;Maybe it is the problem about accuracy .&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 14 Jun 2015 05:01:52 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2015-06-14T05:01:52Z</dc:date>
    <item>
      <title>Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203889#M2125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman';"&gt;Could you please suggest a program to find the zeros to these two polynomials:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman';"&gt;48 = ((0.3-x)*2)/((1+x)^2)&amp;nbsp; solution (using excel) is &lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman';"&gt;-0.78717 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-bidi-language: AR-SA; mso-fareast-language: EN-US; color: #1f497d; font-size: 11pt; mso-ansi-language: EN-US; mso-fareast-theme-font: minor-latin; font-family: 'Calibri',sans-serif; mso-fareast-font-family: Calibri;"&gt;25 = ((0.1-x)*4)/(1.x)^2&amp;nbsp; sol is &lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman';"&gt;-0.65292&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-bidi-language: AR-SA; mso-fareast-language: EN-US; color: #1f497d; font-size: 11pt; mso-ansi-language: EN-US; mso-fareast-theme-font: minor-latin; font-family: 'Calibri',sans-serif; mso-fareast-font-family: Calibri;"&gt;I have a list of 4,000 of these equations to solve. and the actual polynomial have 12 terms.&amp;nbsp; Perhaps if I know how to do these simple ones, I can do the more complex ones.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-bidi-language: AR-SA; mso-fareast-language: EN-US; color: #1f497d; font-size: 11pt; mso-ansi-language: EN-US; mso-fareast-theme-font: minor-latin; font-family: 'Calibri',sans-serif; mso-fareast-font-family: Calibri;"&gt;Thank you !!!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 16:52:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203889#M2125</guid>
      <dc:creator>Thomas_mp</dc:creator>
      <dc:date>2015-06-11T16:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203890#M2126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First subtract the constant terms so that you have a polynomial of the form P(x)=0. Then find the roots of the polynomials.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you want only the real roots, or do you want complex roots as well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66845/HTML/default/viewer.htm#imlug_langref_sect305.htm"&gt;POLYROOT function &lt;/A&gt;finds all complex roots of a polynomial, but you would have to represent the functions as a12*x^12 + a11*x^11 + ... + a0. See the doc or the first example of &lt;A href="http://blogs.sas.com/content/iml/2011/08/03/finding-the-root-of-a-univariate-function.html"&gt;"Finding the roots of a univariate function".&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To find only the real roots, use the &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66845/HTML/default/viewer.htm#imlug_langref_sect139.htm"&gt;FROOT function.&lt;/A&gt; Or find all and throw out the complex roots. An example of the FROOT function is given in &lt;A href="http://blogs.sas.com/content/iml/2014/02/05/find-the-root-of-a-function.html"&gt;"A simple way to find the root of a function of one variable."&lt;/A&gt; For the FROOT function, you can keep the functions written as the are.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 17:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203890#M2126</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-06-11T17:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203891#M2127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Um, I just reread your question. Those are not polynomials, they are rational functions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 17:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203891#M2127</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-06-11T17:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203892#M2128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank very much Rick. &lt;/P&gt;&lt;P&gt;How could use this to solve several thousands functions with same "functional form"?&amp;nbsp; Please, let me explain:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your example&amp;nbsp; in the link &lt;A href="http://blogs.sas.com/content/iml/2014/02/05/find-the-root-of-a-function.html" title="http://blogs.sas.com/content/iml/2014/02/05/find-the-root-of-a-function.html"&gt;http://blogs.sas.com/content/iml/2014/02/05/find-the-root-of-a-function.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;( exp(-x##&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;) - x##&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;3&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; + &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;5&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;#x +&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;let me call -2,-3, 5,1 "parameters"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;I have a file with 4,000 different rows with these parameters; thus each row defines a rational function; each has (at least) one root in the interval (0.05,0.30)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;I tried to read the file with the 4,000 rows (I have it in a csv format) , &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;infile&amp;nbsp; 'H;file.csv' &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;; input a b c d;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;The parameters in your example are&amp;nbsp; (a,b,c,d), so&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt; your example is, in a generic form: ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;( exp(-x##a) - bx##c + c#x +d );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;I run this, but &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;I get the message &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; z = froot("Func", intervals);&lt;/P&gt;&lt;P&gt;ERROR: (execution) Matrix has not been set to a value.&lt;/P&gt;&lt;P&gt;Why?&lt;/P&gt;&lt;P&gt;As you can tell my knowledge of SAS is very limited..&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 20:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203892#M2128</guid>
      <dc:creator>Thomas_mp</dc:creator>
      <dc:date>2015-06-12T20:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203893#M2129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the method to find the function roots with FCMP. Note however that the SOLVE function in FCMP requires a fairly good guess as initial value to find the root.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*&amp;nbsp; Equation has the form p1 = (p2-x)*p3/(p4+x)**p5&amp;nbsp;&amp;nbsp; */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data parms;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;eqNo + 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input p1-p5;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;48 0.3 2 1 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;25 0.1 4 1 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* Define FCMP routine to find function roots */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc fcmp outlib=sasuser.fcmp.test;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;function fn(p2, p3, p4, p5, x);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if fuzz(p4+x) = 0 then return (.);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else return ((p2-x)*p3/(p4+x)**p5);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endsub;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;function findZero(p1, p2, p3, p4, p5, init);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array solvopts[1] initial (0);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; initial = init;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (solve("fn", solvopts, p1, p2, p3, p4, p5, .)); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endsub;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;options cmplib=sasuser.fcmp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data roots;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set parms;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;root = findZero(of p1-p5, -0.6); /* -0.6 is the initial guess&amp;nbsp; */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=roots noobs; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Jun 2015 02:52:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203893#M2129</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-13T02:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203894#M2130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this is a difficult problem in general because root-finding works best when you have knowledge of the function and the interval on which you are searching.&amp;nbsp; As PG says, a good estimate for the root is important.&amp;nbsp;&amp;nbsp; This problem is compounded because these rational functions are not continuous and have singularities. However, in your recent response you claim that function "has (at least) one root in the interval (0.05,0.30)."&lt;/P&gt;&lt;P&gt;Is it always true that the function is continuous on that interval and f(0.05) and f(0.3) have different signs? If so, then you can use the FROOT function in SAS/IML and pass in that interval.&amp;nbsp; The function will return the first root that it finds in that interval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following example reads the parameters from a SAS data set and calls the FROOT function for each row.&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;data parms;&lt;BR /&gt;eqNo + 1;&lt;BR /&gt;input p1-p5;&lt;BR /&gt;datalines;&lt;BR /&gt;48 0.3 2 1 2&lt;BR /&gt;25 0.1 4 1 2&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;/* Define objective function */&lt;BR /&gt;start fn(x)&amp;nbsp; global( p );&lt;BR /&gt;&amp;nbsp; return( (p[2]-x)*p[3]/(p[4]+x)##p[5] - p[1] );&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;varNames="p1":"p5";&lt;BR /&gt;use parms;&lt;BR /&gt;read all var varNames into m;&lt;BR /&gt;close parms;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;root = j(nrow(m), 1, .);&lt;BR /&gt;do i = 1 to nrow(m);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; p = m[i,];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* store i_th row into global variable */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* Optional: Call function that computes interval that has root */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; interval = {-0.9 2};&lt;BR /&gt;&amp;nbsp;&amp;nbsp; root&lt;I&gt; = froot("fn", interval);&amp;nbsp; /* find a root in the interval [0,1] */&lt;BR /&gt;end;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;print root;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rick Wicklin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Jun 2015 09:59:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203894#M2130</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-06-13T09:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203895#M2131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about using Genetic Algorithms ? which can be used under the situation that function is not differentiable or continuous .&lt;/P&gt;&lt;P&gt;And you define a width range of interval to search root . Unlike Rick and PG need to define a very good start point .&lt;/P&gt;&lt;P&gt;I love GA a hell of a lot .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H3 style="color: #353535; font-family: Lato, sans-serif; background-color: #f0f1f2;"&gt;Code: Program&lt;/H3&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;iml&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;start&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;func&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;x&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;v&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;abs&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0.3-x&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;*&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;2&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;/&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;x&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;*&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;*&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;2&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;-&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;48&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;return&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;v&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;finish&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gasetup&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1234&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gasetobj&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;"func"&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gasetsel&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;100&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0.95&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gasetcro&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0.4&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;4&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gasetmut&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0.4&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gainit&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;10000&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;-&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;10&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;10&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;niter&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;100&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;summary&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;j&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;niter&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;2&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;mattrib&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;summary&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;c&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;"Min Value"&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;"Avg Value"&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;l&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;""&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;do&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;i&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;to&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;niter&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;garegen&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gagetval&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;value&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;summary&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;i&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;value&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;summary&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;i&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;2&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;value&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gagetmem&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;mem&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;value&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;print&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;mem&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;l&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;"best member:"&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;"Min Value: "&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;value&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;l&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;""&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;iteration&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;t&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;niter&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;print&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;iteration&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;summary&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;call&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;gaend&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="x.png" class="jive-image" src="https://communities.sas.com/legacyfs/online/10829_x.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Jun 2015 12:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203895#M2131</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-13T12:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203896#M2132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rick. &lt;/P&gt;&lt;P&gt;Not sure . If I am wrong. Your root is not right for the first function .&lt;/P&gt;&lt;P&gt;I get &lt;SPAN style="color: #000000; font-family: Consolas, Courier, 'Courier New'; font-size: 16px; background-color: #ffffff;"&gt;-48.16637008&amp;nbsp; not approximate 0 .&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Jun 2015 13:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203896#M2132</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-13T13:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203897#M2133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! I was reading all numeric variables, so I was getting the EqNo variable and using that for the first parameter.&amp;nbsp; I have corrected the program to read only the parameters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Jun 2015 17:26:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203897#M2133</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-06-13T17:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203898#M2134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you again !!&lt;/P&gt;&lt;P&gt;This was my first experience in this forum and I am very grateful.&lt;/P&gt;&lt;P&gt;The 3 methods work for me.&amp;nbsp; I will be using Rick's because I understand a little bit better how it works.&amp;nbsp; For your information, I will be using this to solve for the implied cost of capital as explained in the paper :&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="KO" style="font-family: Code2000; font-size: 12pt;"&gt;&lt;SPAN lang="KO" style="font-family: Code2000; font-size: 12pt;"&gt;&lt;SPAN lang="KO" style="font-family: Code2000; font-size: 12pt;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Toward an Implied Cost of Capital&lt;/P&gt;&lt;P&gt;Author(s): William R. Gebhardt, Charles M. C. Lee and Bhaskaran Swaminathan&lt;/P&gt;&lt;P&gt;Source: Journal of Accounting Research, Vol. 39, No. 1 (Jun., 2001), pp. 135-176&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="KO" style="font-family: Code2000; font-size: 12pt;"&gt;&lt;SPAN lang="KO" style="font-family: Code2000; font-size: 12pt;"&gt;Take care&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jun 2015 02:37:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203898#M2134</guid>
      <dc:creator>Thomas_mp</dc:creator>
      <dc:date>2015-06-14T02:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203899#M2135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way, I found a better ROOT than you for the first funtion via GA. Of course for the second function .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="sasSource"&gt; 1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/P&gt;&lt;P class="sasSource"&gt; 57&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource"&gt; 58&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource"&gt; 59 data _null_;&lt;/P&gt;&lt;P class="sasSource"&gt; 60 my_root=-1.254501;&lt;/P&gt;&lt;P class="sasSource"&gt; 61 your_root=-0.787165;&lt;/P&gt;&lt;P class="sasSource"&gt; 62 my_value=(0.3-my_root)*2/(1+my_root)**2 - 48;&lt;/P&gt;&lt;P class="sasSource"&gt; 63 your_value=(0.3-your_root)*2/(1+your_root)**2 - 48;&lt;/P&gt;&lt;P class="sasSource"&gt; 64 put my_root= my_value= / your_root= your_value=;&lt;/P&gt;&lt;P class="sasSource"&gt; 65 run;&lt;/P&gt;&lt;P class="sasSource"&gt; my_root=-1.254501 my_value=0.000085964&lt;/P&gt;&lt;P class="sasSource"&gt; your_root=-0.787165 your_value=-0.00020722&lt;/P&gt;&lt;P class="sasNote" id="sasLogNote1_1434256189369" style="color: #0000ff;"&gt; NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P class="sasNote" style="color: #0000ff;"&gt;&amp;nbsp; real time 0.00 seconds&lt;/P&gt;&lt;P class="sasNote" style="color: #0000ff;"&gt;&amp;nbsp; cpu time 0.00 seconds&lt;/P&gt;&lt;P class="sasNote" style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jun 2015 04:35:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203899#M2135</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-14T04:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203900#M2136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;A __default_attr="645292" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; it is not a &lt;EM&gt;better root&lt;/EM&gt;. The function has two roots! :smileysilly:&amp;nbsp; - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jun 2015 04:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203900#M2136</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-14T04:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203901#M2137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Really ?&amp;nbsp; &lt;STRONG&gt;Why ?&lt;/STRONG&gt;&amp;nbsp; But &lt;SPAN style="color: #000000; font-family: Consolas, Courier, 'Courier New'; font-size: 16px; background-color: #ffffff;"&gt;-1.254501 is more approximate 0 . See my LOG .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, Courier, 'Courier New'; font-size: 16px; background-color: #ffffff;"&gt;Maybe it is the problem about accuracy .&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jun 2015 05:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203901#M2137</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-14T05:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203902#M2138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you . PG .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jun 2015 05:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203902#M2138</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-14T05:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203903#M2139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I said, there is a singularity, and the function has a root to the left of the singularity and another branch to the right.&lt;/P&gt;&lt;P&gt;Here is a graph of the function, which has a singularity at x = -p4.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data rational;&lt;BR /&gt;p1=48; p2=0.3; p3=2; p4=1; p5=2;&lt;BR /&gt;/* p1=25; p2=0.1; p3=4; p4=1; p5=2; */&lt;BR /&gt;delta = 0.05;&lt;BR /&gt;do x = -3 to -p4-delta by delta;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Branch = "Neg";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; y =&amp;nbsp; (p2-x)*p3/(p4+x)**p5 - p1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;end;&lt;BR /&gt;do x = -p4+delta to 1 by delta;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Branch = "Pos";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; y =&amp;nbsp; (p2-x)*p3/(p4+x)**p5 - p1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgplot data=rational;&lt;BR /&gt;series x=x y=y / group=Branch;&lt;BR /&gt;refline 0 /axis=y;&lt;BR /&gt;refline -1 /axis=x;&lt;BR /&gt;yaxis max =100;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jun 2015 10:31:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203903#M2139</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-06-14T10:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203904#M2140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An interesting alternative is to hijack the machinery of proc nlin with a single observation. The specification of starting values is very flexible in proc nlin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*&amp;nbsp; Equation has the form p1 = (p2-x)*p3/(p4+x)**p5&amp;nbsp;&amp;nbsp; */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data parms;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;eqNo + 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input p1-p5;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;48 0.3 2 1 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;25 0.1 4 1 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data startingValues;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set parms;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;parameter = "x";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;do Estimate = -0.95*p4 to -0.05*sign(p4) by 0.05*sign(p4);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;keep eqNo parameter Estimate;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc nlin data=parms noprint outest=roots(where=(_TYPE_="FINAL"));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;by eqNo;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;parameters / pdata=startingValues;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;model p1 = (p2-x)*p3/(p4+x)**p5;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=roots noobs; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;var EqNo _STATUS_ _SSE_ x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format x best12.; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 15:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203904#M2140</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-15T15:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203905#M2141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The right-hand-side of the 2 examples is the ratio of 1 polynomial over another polynomial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You write: "the actual polynomial have 12 terms". Do both polynomials (numerator and denominator) have 12 terms? Or does the equation have a grand total of 12 parameters?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 16:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203905#M2141</guid>
      <dc:creator>billfish</dc:creator>
      <dc:date>2015-06-15T16:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203906#M2142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello again Rick,&lt;/P&gt;&lt;P&gt;Thank you gain,&lt;/P&gt;&lt;P&gt;I thought that your program worked for my generic problem , but I am having some trouble .&amp;nbsp; In my problem one of the terms is of the form:&lt;/P&gt;&lt;P&gt;x/(x*(1+x)##12)&amp;nbsp; &lt;/P&gt;&lt;P&gt;For these type of problems, when x appears also multiplying in the denominator,&amp;nbsp; it seems that the program cannot find the solution.&amp;nbsp; For instance, in your example, below, slightly modified (I changed the first number from 48 to 3.3058, and added the x multiplying in the denominator), the solution, a zero, is&amp;nbsp;&amp;nbsp; x= 0.1, but the program seems to have problems finding it. &lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data parms;&lt;/P&gt;&lt;P&gt;eqNo + 1;&lt;/P&gt;&lt;P&gt;input p1-p5;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;3.3058 0.3 2 1 2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;/* Define objective function */&lt;BR /&gt;start fn(x)&amp;nbsp; global( p );&lt;BR /&gt;&amp;nbsp; return( (p[2]-x)*p[3]/x*(p[4]+x)##p[5] - p[1] );&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;varNames="p1":"p5";&lt;BR /&gt;use parms;&lt;BR /&gt;read all var varNames into m;&lt;BR /&gt;close parms;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;root = j(nrow(m), 1, .);&lt;BR /&gt;do i = 1 to nrow(m);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; p = m[i,];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* store i_th row into global variable */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* Optional: Call function that computes interval that has root */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; interval = {-0.9 2};&lt;BR /&gt;&amp;nbsp;&amp;nbsp; root&lt;I&gt; = froot("fn", interval);&amp;nbsp; /* find a root in the interval [0,1] */&lt;BR /&gt;end;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;print root;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 03:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203906#M2142</guid>
      <dc:creator>Thomas_mp</dc:creator>
      <dc:date>2015-06-16T03:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203907#M2143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Product and division have the same evaluation priority, without parentheses they are evaluated from left to right. Your equation is equivalent to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;( (p[2]-x)*p[3]/x)*(p[4]+x)##p[5] - p[1] &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;It should read&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp; (p[2]-x)*p[3]/&lt;SPAN style="color: #993300;"&gt;(&lt;/SPAN&gt;x*(p[4]+x)##p[5]&lt;SPAN style="color: #993300;"&gt;)&lt;/SPAN&gt; - p[1]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;PG&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 03:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203907#M2143</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-16T03:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please suggest a program to find the zeros to these two polynomials</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203908#M2144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I expect that you will encounter all kinds of problems like this. For the FROOT function, the INTERVAL argument is supposed to be an interval [a,b] such that f(a) and f(b) have different signs and f is continuous on [a,b]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You see the comment that says:&lt;/P&gt;&lt;P&gt;/* Optional: Call function that computes interval that has root */&lt;/P&gt;&lt;P&gt;It means that you should use knowledge of your problem to compute an interval [a,b] for each pair of parameters.&amp;nbsp; For rational functions that have k branches, you need to decide which root you want.&lt;/P&gt;&lt;P&gt;(If the denominator of your expression has k-1 zeros, then the rational function has k branches.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 10:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Could-you-please-suggest-a-program-to-find-the-zeros-to-these/m-p/203908#M2144</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-06-16T10:09:12Z</dc:date>
    </item>
  </channel>
</rss>

