OpenSource For You

Coefficien­ts of a polynomial

-

Extracting the coefficien­ts of a polynomial is another basic and common requiremen­t for polynomial manipulati­ons. Maxima provides two slightly different mechanisms. The first one just finds the coefficien­t of a given variable or its power, using coeff(). The second one segregates a polynomial into the coefficien­t of a given variable or its power, and the remaining terms, using bothcoef(). $ maxima -q (%i1) string(bothcoef(expand(x^2 - y^2 + (x + y)^2), x^2)); (%o1) 2,2*x*y] (%i2) string(bothcoef(expand(x^2 - y^2 + (x + y)^2), x)); (%o2) [2*y,2*x^2] (%i3) string(bothcoef(expand(x^2 - y^2 + (x + y)^2), y^2)); (%o3) [0,2*x*y+2*x^2] (%i4) string(bothcoef(expand(x^2 - y^2 + (x + y)^2), y)); (%o4) [2*x,2*x^2] (%i5) string(coeff(expand((x + 2 * y)^50), x^20)); (%o5) 5060460631­8512743383­040*y^30 (%i6) string(coeff(expand((a + b + c + d)^4), a^3)); (%o6) 4*d+4*c+4*b (%i7) quit();

Newspapers in English

Newspapers from India