.. _homework6: Homework 6 (Due 6 pm, Wednesday, 11/29/2017) ########################################################################## There are two channels you should submit your homework. 1. Git repo submission: Please submit your homework to your git repo by **6 pm, Wednesday, 11/29/2017**. 2. Sphinx homepage upload: Please upload your homework files to your homepage two bussiness days after the deadline between **6 pm, Thursday, 11/30/2017** and **6 pm, Friday, 12/1/2017**. In this homework, you are going to implement a Python routine, ``pyRun_rootFinder.py``, which performs the following sequential tasks to compile, run and plot some of the results of the Newton's root finder algorithm we studied in :ref:`ch02-fortran-example`. Here are very specific guidlines of this homework. It is strongly encouraged that you implement each step by following the guidlines carefully: 1. make two subdirectories: ``newton_rootFinder`` and ``pyRun``, and copy the Fortran Newton's method code from ``lecture_note/chapters/chapt02/codes/newton_rootfinder/`` and place under the ``newton_rootFinder`` directory. 2. In the Newton's method code, delete ``rootFinder.init`` and just keep the followings:: RootFinder.F90 findRootMethod_module.F90 makefile read_initFile_module.F90 definition.h ftn_module.F90 output_module.F90 setup_module.F90 3. Now you're going to implement ``pyRun_rootFinder.py`` in the ``pyRun`` directory. You need to implement (at least) four different functions and one main code section followed by ``if __name__ == '__main__':`` in ``pyRun_rootFinder.py``. For example, a template example should look like: .. literalinclude:: ./hw6_template.py :language: python :linenos: Your implementation should produce three different data for three different threshold values, :math:`10^{-4}, 10^{-6}, 10^{-8}`. To do this, you excute ``pyRun_rootFinder.py`` *only once* in the script mode:: >>> python pyRun_rootFinder.py which will conduct the following all four tasks sequentially: (a) compile the Fortran code before running, (b) write a new runtime parameter file ``rootFinder.init`` for each of the three different threshold value, :math:`10^{-4}, 10^{-6}, 10^{-8}`, (c) run the Fortran code for each threshold value, (d) plot each result for each threshold value to both screen and to a file. 4. Finally, write up a LaTeX report on your findings including figures. You need to specify what your test function is (a function of a single variable :math:`x`). For your test function, please explore at least two different initial guesses, one that is relatively close to a true solution, the other that is farther away from the true solution of the function. Discuss any convergent behaviors on two different initial guesses. All you need is to find a rough location of an analytic solution, at least approximately, by plotting the function using Python. Keep in mind that all of the run cases are to be done in *one* execution of ``pyRun_rootFinder.py`` in the script mode.