File r37/lisp/csl/html/r37_0142.html artifact ca10437acd part of check-in d9e362f11e



<A NAME=COEFFN>

<TITLE>COEFFN</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>COEFFN</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>operator</B><P>
<P>
 
 <P>
<P>
The <em>coeffn</em> operator takes three arguments: an expression, a kernel, and
 
a non-negative integer. It returns the coefficient of the kernel to that 
integer power, appearing in the expression. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>coeffn</em>(&lt;expression&gt;,&lt;kernel&gt;,&lt;integer&gt;) 
<P>
<P>
<P>
&lt;expression&gt; must be a polynomial, unless 
<A HREF=r37_0322.html>ratarg</A> is on which 
allows rational expressions. &lt;kernel&gt; must be a kernel, and 
&lt;integer&gt; must be a non-negative integer. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>

ff := x**7 + sin(y)*x**5 + y**4 + x + 7; 


                5     7         4
  FF := SIN(Y)*X   + X   + X + Y   + 7 


coeffn(ff,x,5); 

  SIN(Y) 


coeffn(ff,z,3); 

  0 


coeffn(ff,y,0); 

          5     7
  SIN(Y)*X   + X   + X + 7 



rr := 1/y**2+y**3+sin(y); 

                2     5
        SIN(Y)*Y   + Y   + 1
  RR := -------------------- 
                  2
                 Y


on ratarg; 


coeffn(rr,y,-2); 

  ***** -2 invalid as COEFFN index 



coeffn(rr,y,5); 

  1
  ---
   2
  Y

</TT></PRE><P>If the given power of the kernel does not appear in the expression
, 
<em>coeffn</em> returns 0. Negative powers are never detected, even if 
they appear in the expression and 
<A HREF=r37_0322.html>ratarg</A> are on. <em>coeffn</em> 
with an integer argument of 0 returns any terms in the expression that 
do not contain the given kernel. 
<P>
<P>
<P>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]