Industrial Mathematics - Alexiades
                          Lab 3
                Roots, free software, languages
                Do part 1 right away, then go to Lab4.
                Do the rest later, by end of February.

1. Use the Newton code you constructed in Lab2 to find all three roots (one at a time!),
  in double precision, of the cubic   F(x) = x3 − 1.2x2 − 8.55x + 12.15
  You'll probably need to plot the function to figure out good starting points.
  Try at least two different starting values and discuss how convergence is affected (count iterations).
  [ For efficiency and accuracy, polynomials should always be evaluated in "nested form" (Horner's Rule), like: ax2+bx+c = c + x * (b + a*x) ].

  a. Check, by hand, that x = −3 is an exact root.
  b. Did your solver find −3 as an exact root ?
  c. How do you know if it's an exact root or not?
  d. If not, what could you do to increase the accuracy ? try it ! did it work ?
  e. What are the other two roots ? Did your solver find them as exact roots ?
  In a text file Lab3part1.txt insert answers to each question, and only the final "DONE" output lines on which answers are based,
  and then insert code for your FCN.
Submit this part as "Lab3part1.txt" on Canvas now.


Start working on the rest, may take time...
Submit this part as "Lab3part2.txt" by end of Feb


2. To practice getting software from the Internet:
  Try to find the file dpara.f from the "paranoia" collection on netlib.org
  (most extensive library of free, high quality numerical software, actually residing at UTK by the way!).
  Read the beginning of dpara.f to see what it does (it's a Fortran code, in plain text).
  You will need a Fortran compiler to run it: Install gfortran on your machine (see course page),
  then compile it: gfortran dpara.f , and run it: a.exe
  OR can do it on any linux machine to which you have access, can sign up for UTK Linux account.
  Report the values of: radix, smallest number, and largest number, and what machine this is from ( uname -a on unix/linux machines).

3. It is useful, and often necessary(!), to be able to do the same computation by different tools/methods.
  For a little practice, search the web for any root finding codes.
  You are likely to find free codes only in Fortran (and some in C), like fzero.f90 or zeroin.f90, or brent.f90, there are lots of them out there...
  A repository of old (.f) Fortran codes is netlib.org . For C codes, the GNU Scientific Library is excellent.
  Do the following:
  a. Use whichever code you downloaded (but identify the code and from where)
    to find the x=−3 root of the cubic function in Part 1.
  b. Do the same using Matlab or Python (or Maple or Mathematica), they have built-in root finders (fzero, fsolve, ... ).
    Compare and contrast with your Newton solver (for accuracy and efficiency).