Industrial Math - Alexiades
Lab 2
Newton solver
1. Implement Newton's method to find a root of a given function F(x)
   i.e. solve F(x)=0.

  The main program should read in:
	x0    = initial guess for the root, 
	maxIT = maximum number of iterations to be performed, 
	TOL   = tolerance for testing convergence.  
  and should call the Newton rootfinder (see below).
  Your program should output the input values, and then the iterates:
          n    xn    F(xn)
  and, upon convergence, the root.
  The values of F(x) and F'(x) should be computed in a
  subprogram FCN( xn, Fn, DFn ) called by the rootfinder.

[ A good way to code Newton rootfinder and decide convergence 
  is something like this (pseudocode):

  subprogram Newton1D( x0, TOL, maxIT )
	xn = x0
	dx = 1000.0 			[something big]
	print '# n      xn      Fn'		[labels for values]
    for n=1:maxIT
        call FCN( xn, Fn, DFn )		[returns Fn=F(xn), DFn=F'(xn)]
	print: n      xn      Fn
      if( ABS(dx) < TOL ) then
      	if( ABS(Fn) < TOL ) then
	    print: 'DONE: root=',xn,' F=',Fn,' in ',n,' iters'
	else
      	    print: 'STUCK: dx < TOL BUT residual =', Fn,' > TOL'
	endif
      endif
	dx = -Fn/DFn
	xn = xn + dx
    endfor
    print: 'BAD: reached maxIT'
  END subprogram ]  

2. Debug your code by finding SQRT(3) as root of F(x) = x**2 - 3.
   Try a couple of different x0's, with maxIT=10, TOL=1.e-6.


3. Create a PLAIN TEXT file "lab2.txt" containing:
	- Lab2: Name, Date
	  ======================================== (separation line)
	- your code
	  ======================================== (separation line)
	- the input and output of ONE run of your code.

Email it to alexiades@utk.edu and Cc: to yourself, with Subject: M475 lab2.