Jacques Gélinas on Tue, 24 Jul 2018 23:07:35 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

RE: Using taylor() with polynomials in many variables

/* Here is a better version of the signs function posted earlier in this group
   to check the signs of the coefficients in a polynomial of many variables
   (http://pari.math.u-bordeaux.fr/archives/pari-users-1806/msg00018.html) */

signs(p) = if(type(p) == "t_POL", signp(p));
signp(p) = if(!#variables(p=simplify(p)), sign(p),\
           if(nsv(p=apply(signp,Vec(p))), UNK, p[1]));

\\ number of sign variations in a vector
nsv(V) = my(r,s); sum(k=1,#V,if(s,r=s);s=V[k];r&s&(r!=s));

\\ For a polynomial, the taylor() or Vec() functions can be replaced by

taylorp(p,x='x,a=0) = vector(1+poldegree(p,x),k,polcoeff(subst(p,x,x+a),k-1,x));

\* The problem is to show that the following polynomial is positive
    under the constraints  n>=3, 2<= r <= n-1, 0 <= a,b, <=1 */

E = r*(n-1)*(2*r+1)*(3-a) - 3*(n-r)*(2*r+1-a*b);

\\First, auxiliary variables transform the constraints on r,n to m>=0, s>=0

F = subst(subst(E,n,r+1+m),r,s+2)

\\Next we get the Maclaurin coefficients with respect to variable b.

G = taylorp(F,b);
G[2] == (3*m + 3)*a
signs(G[2]) == 1

\\ One more auxiliary variable converts a <= 1 to A>=0

apply(signs,G) == [UNK,1]
signs(subst(G[1],a,1-A)) == 1

Jacques Gélinas