<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, How do I extract the corresponding variables given the list of coefficients ?</title>
    <link>http://www.mapleprimes.com/questions/139167-How-Do-I-Extract-The-Corresponding-Variables</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Tue, 09 Jun 2026 17:23:47 GMT</lastBuildDate>
    <pubDate>Tue, 09 Jun 2026 17:23:47 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, How do I extract the corresponding variables given the list of coefficients ?</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, How do I extract the corresponding variables given the list of coefficients ?</title>
      <link>http://www.mapleprimes.com/questions/139167-How-Do-I-Extract-The-Corresponding-Variables</link>
    </image>
    <item>
      <title>A solution using coeffs (and zip, select, and map2)</title>
      <link>http://www.mapleprimes.com/questions/139167-How-Do-I-Extract-The-Corresponding-Variables?ref=Feed:MaplePrimes:How do I extract the corresponding variables given the list of coefficients ?:Comments#answer139168</link>
      <itunes:summary>&lt;p&gt;Satya,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This was fun. The key to my approach is the coeffs command. Not only does it return all coefficients of a multinomial polynomial but it can also return the term for each coefficient. I zip the two lists together and then select all pairs whose first term (coefficient) matches the given value. My final implementation is presented in the following procedure - with two test cases.&lt;/p&gt;
&lt;pre&gt;restart;&lt;br&gt;&lt;br&gt;Terms := proc( f, vars, coef )&lt;br&gt;  local c, t, T;&lt;br&gt;  c := coeffs( f, vars, 't' );&lt;br&gt;  T := zip( (x,y)-&amp;gt;[x,y], [c], [t] );&lt;br&gt;  return map2( op, 2, select( C-&amp;gt;evalb( C[1]=coef ), T ) );&lt;br&gt;end proc:&lt;br&gt;&lt;br&gt;f := 3*x^3 + 5*x^4 + 5*x^44;&lt;br&gt;                         3      4      44&lt;br&gt;                      3 x  + 5 x  + 5 x  &lt;br&gt;Terms( f, x, 5 );&lt;br&gt;                           [ 4   44]&lt;br&gt;                           [x , x  ]&lt;br&gt;Terms( f, x, 4 );&lt;br&gt;                               []&lt;br&gt;Terms( f, x, 3 );&lt;br&gt;                              [ 3]&lt;br&gt;                              [x ]&lt;br&gt;&lt;br&gt;f2 := 3*x^3*y + 4*x^2 + 5*y^33;&lt;br&gt;                        3        2      33&lt;br&gt;                     3 x  y + 4 x  + 5 y  &lt;br&gt;Terms( f2, [x,y], 5 );&lt;br&gt;                             [ 33]&lt;br&gt;                             [y  ]&lt;br&gt;Terms( f2, [x,y], 4 );&lt;br&gt;                              [ 2]&lt;br&gt;                              [x ]&lt;br&gt;Terms( f2, [x,y], 3 );&lt;br&gt;                             [ 3  ]&lt;br&gt;                             [x  y]&lt;br&gt;&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;Does this do what you request?&lt;/p&gt;
&lt;p&gt;I hope this is helpful. I encourage you to consult the Maple help documents for coeffs, zip, select, and map2 (in particular) if you need help understanding what each command does.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;Doug&lt;/p&gt;
&lt;pre&gt;---------------------------------------------------------------------
Douglas B. Meade  &amp;lt;&amp;gt;&amp;lt;
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu&lt;/pre&gt;</itunes:summary>
      <description>&lt;p&gt;Satya,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This was fun. The key to my approach is the coeffs command. Not only does it return all coefficients of a multinomial polynomial but it can also return the term for each coefficient. I zip the two lists together and then select all pairs whose first term (coefficient) matches the given value. My final implementation is presented in the following procedure - with two test cases.&lt;/p&gt;
&lt;pre&gt;restart;&lt;br&gt;&lt;br&gt;Terms := proc( f, vars, coef )&lt;br&gt;  local c, t, T;&lt;br&gt;  c := coeffs( f, vars, 't' );&lt;br&gt;  T := zip( (x,y)-&amp;gt;[x,y], [c], [t] );&lt;br&gt;  return map2( op, 2, select( C-&amp;gt;evalb( C[1]=coef ), T ) );&lt;br&gt;end proc:&lt;br&gt;&lt;br&gt;f := 3*x^3 + 5*x^4 + 5*x^44;&lt;br&gt;                         3      4      44&lt;br&gt;                      3 x  + 5 x  + 5 x  &lt;br&gt;Terms( f, x, 5 );&lt;br&gt;                           [ 4   44]&lt;br&gt;                           [x , x  ]&lt;br&gt;Terms( f, x, 4 );&lt;br&gt;                               []&lt;br&gt;Terms( f, x, 3 );&lt;br&gt;                              [ 3]&lt;br&gt;                              [x ]&lt;br&gt;&lt;br&gt;f2 := 3*x^3*y + 4*x^2 + 5*y^33;&lt;br&gt;                        3        2      33&lt;br&gt;                     3 x  y + 4 x  + 5 y  &lt;br&gt;Terms( f2, [x,y], 5 );&lt;br&gt;                             [ 33]&lt;br&gt;                             [y  ]&lt;br&gt;Terms( f2, [x,y], 4 );&lt;br&gt;                              [ 2]&lt;br&gt;                              [x ]&lt;br&gt;Terms( f2, [x,y], 3 );&lt;br&gt;                             [ 3  ]&lt;br&gt;                             [x  y]&lt;br&gt;&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;Does this do what you request?&lt;/p&gt;
&lt;p&gt;I hope this is helpful. I encourage you to consult the Maple help documents for coeffs, zip, select, and map2 (in particular) if you need help understanding what each command does.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;Doug&lt;/p&gt;
&lt;pre&gt;---------------------------------------------------------------------
Douglas B. Meade  &amp;lt;&amp;gt;&amp;lt;
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu&lt;/pre&gt;</description>
      <guid>139168</guid>
      <pubDate>Sun, 04 Nov 2012 07:11:35 Z</pubDate>
      <itunes:author>Doug Meade</itunes:author>
      <author>Doug Meade</author>
    </item>
    <item>
      <title>Thank you Doug for the timely help</title>
      <link>http://www.mapleprimes.com/questions/139167-How-Do-I-Extract-The-Corresponding-Variables?ref=Feed:MaplePrimes:How do I extract the corresponding variables given the list of coefficients ?:Comments#comment139171</link>
      <itunes:summary>&lt;p&gt;This will help me.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;This will help me.&lt;/p&gt;</description>
      <guid>139171</guid>
      <pubDate>Sun, 04 Nov 2012 15:04:53 Z</pubDate>
      <itunes:author>satya123999</itunes:author>
      <author>satya123999</author>
    </item>
  </channel>
</rss>