Industrial Mathematics - Alexiades
Roots, free software, languages
Do part 1 right away, then go to Lab4.
Do the rest later, by end of January.
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 ?
Submit this part as "M475 Lab3.1" now
Important: Clean up your files on the remote machine!
Start working on the rest, may take time...
Submit this part as "M475 Lab3.2" by end of January
2. To practice getting software from the Internet:
Try to find the file dpara.f from the "paranoia" collection on netlib
(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.
You will need a Fortran compiler:
Install gfortran on your machine (see course page),
then compile it: gfortran dpara.f , and run it: a.exe
3. To practice computing on a remote computer:
• Get a UTK unix account (if you don't already have one).
• Install SSH on your machine (see course page).
• Then SSH to unix.utk.edu and login to your unix account,
• Either: transfer the file dpara.f to unix.utk.edu using SCP.
Or you can just copy it from my account on that machine to yours:
cp ~vasili/dpara.f . (note: there is a " ." at the end).
• Compile it by typing: f77 dpara.f , and run it: a.out
Report the values of: radix, smallest number, and largest number,
and what machine this is from ( uname -a on unix machines).
4. 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, 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 it)
to find the x=−3 root of the cubic function in Part 1.
Your UT unix account (unix.utk.edu) has both fortran
( f77 code.f or f90 code.f90 ) and C ( cc code.c ).
Any Linux OS contains gcc and gfortran.
b. Do the same using Matlab or Maple (or Mathematica), they have
built-in root finders (fzero, fsolve, ... ).
Compare and contrast with your Newton solver (for accuracy and efficiency).
Transfer the files you want to save, and then delete everything with: