read('s7odr6Eq');
#
# It is a rather small polynomial system whose grobner basis
# can be computed in less than 30 minutes on IBM RS6000/590.
# Its grobner basis has three components: p[1], p[2], and p[3].
# 
#        1)  p[3] is a polynomial in x of degree 39;
#        2)  p[2] is a polynomial in x and y. It is linear in y!
#        3)  p[1] is a polynomial in x and z. It is linear in z!
#
#                                        Ren-Cang Li, June 1, 1996
#                                        na.rcli@na-net.ornl.gov

with(grobner):
p:=gbasis({f[1],f[2],f[3]},[z,y,x],plex):
#
#  p[3] has three real roots which can be located by Maple function
#  realroot.
#
readlib(realroot):
rtintv:=realroot(p[3],1/1000):
#
nrt:=nops(rtintv):
read('Newton'):
read('ToCheck'):
readlib(write):
appendto(s7odr6): writeln(): close():
Digits:=100; DumpDigits:=20;
for i from 1 to nrt do
    print(`Compute Scheme`): print(i):
    x0:=NewtonItern(p[3],rtintv[i][1],rtintv[i][2]):
    y0:=solve(subs(x=x0,p[2]),y):
    z0:=solve(subs(x=x0,p[1]),z):
    xyz0:=vector([x0, y0, z0]):
    ResiErr(xyz0);

    cs0:=[z0, y0, x0, 1-x0]:
    delta0[1]:=cs0[1]:
    for j from 2 to 4 do delta0[j]:=cs0[j]-cs0[j-1]; od:
    appendto(s7odr6):
    write(`Scheme`): write(i): write(`:`): writeln():
    write(`=============`): writeln(): writeln():
    write(`Delta's:`): writeln():
    write(`-------`): writeln():
    for j from 1 to 4 do 
	write(evalf(delta0[j],DumpDigits)): writeln():
    od;
    write(`C's:`): writeln():
    write(`---`): writeln():
    for j from 1 to 3 do 
	write(evalf(cs0[j],DumpDigits)): writeln():
    od;
    writeln(): writeln(): close():
od:
