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

read('s31odr10Eq'):
read('InitialCs'):
read('Newton'):
readlib(write):

# the number of initial guesses to be tried on.

NumIG:=rowdim(InitialCs):
print(`the number of initial guesses to be tried on:`): print(NumIG):

# working vectors and matrix.

x0:=vector(15):
x0out:=matrix(NumIG,15): x0tmp:=vector(15):

# Set working precision and how many Digits to be Dumped for each
# computed solutions

Digits:=100: DumpDigits:=20:
eps:=10^(-Digits+30):
#
istart:=1: print(istart):
for j from 1 to 15 do
    x0[j]:=InitialCs[istart,j]:
od:
err:=NewtonItern(x0): 
if err >=eps then
   print(`Warning: Possible inaccurate solution!`):
   print(`Please Interrupt`):
else
   numpts:=1:
   for j from 1 to 15 do
       x0out[numpts,j]:=x0[j]:
   od:
fi:
#
for ii from (istart+1) to NumIG do
    ichk:=1:
    print(ii):
    for j from 1 to 15 do
	x0[j]:=InitialCs[ii,j]:
    od:
    err:=NewtonItern(x0): 
    if err >=eps then
       print(`Warning: Possible inaccurate solution!`):
    else
       for i from 1 to numpts do
	   if ichk=1 then
	      for j from 1 to 15 do
	          x0tmp[j]:=x0out[i,j]-x0[j]:
	      od:
	      if norm(x0tmp)<=eps*norm(x0) then
		 ichk:=0:
	      fi: 
	   fi:
       od:
       if ichk=1 then
	  numpts:=numpts+1:
          for j from 1 to 15 do
              x0out[numpts,j]:=x0[j]:
          od:
       fi:
    fi:
od:

# Dumping all solutions found.

for ii from 1 to numpts do
    appendto(s31odr10_All):
    writeln():
    write(`Scheme`): write(ii): write(`:`): writeln():
    write(`==============`): writeln():
    for i from 1 to 15 do x0[i]:=x0out[ii,i]: od:
    read('WriteItOut'):
    writeln():
    close():
od:
