#                                        Ren-Cang Li, June 1, 1996
#                                        na.rcli@na-net.ornl.gov

with(linalg):
nstep:=9: nstep12:=floor(nstep/2):
cs:=[w,z,y,x,1-x]:

delta[nstep12]:=cs[1]:
for i from nstep12-1 to 0 by -1 do 
    delta[i]:=cs[nstep12+1-i]-cs[nstep12-i]: 
od:

a1:=delta[0]:
a3:=delta[0]^3: 
a5:=delta[0]^5: b5:=0:

for i from 1 to nstep12 do
    Newa1 := a1 + 2*delta[i];
    Newa3 := a3 + 2*delta[i]^3;
    Newa5 := a5 + 2*delta[i]^5;
    Newb5 := b5 - (a1*a3*delta[i])/6 - (a3*delta[i]^2)/6 
		+ (a1^2*delta[i]^3)/6 + (a1*delta[i]^4)/6;
   a1:=simplify(expand( Newa1 ));
   a3:=simplify(expand( Newa3 )); 
   a5:=simplify(expand( Newa5 )); b5:=simplify(expand( Newb5 ));
od:

f[1]:=a3: 
f[2]:=a5: f[3]:=b5:

#
#  fw1 is linear in w.
#
fw1:=collect(expand(15*f[3]-f[2]-(5/2)*((-1+z)*w-z+1/2)*f[1]),w):
#
#  Other two important polynomials belonging to the ideal generated by
#  f[1], f[2], and f[3] are
#
read('Fxy'): # It is in x and y ONLY.
read('f13'): # It is in x, y and z, linear in z.

xfxy:=diff(fxy,x):
xfxyh:=convert(xfxy,horner, x):
yfxy:=diff(fxy,y):
yfxyh:=convert(yfxy,horner, x)::

fxyh:=convert(fxy,horner,x): 

xyfxyh:=convert(diff(yfxy,x),horner,x):
yyfxyh:=convert(diff(yfxy,y),horner,x):

Axy:=matrix(2,2,[xfxyh, yfxyh, xyfxyh, yyfxyh]):

f13h:=convert(f13,horner,x):
xf13h:=convert(diff(f13,x),horner,x):
yf13h:=convert(diff(f13,y),horner,x):
zf13h:=convert(diff(f13,z),horner,x):
