math4610

Routine Name: LogPlot

Author: David Merkley

Language: Python

Description/Purpose: Produce a log-log plot of a list of errors.

Input: list of errors

Output: log-log plot

Implementation/Code:

def logplot(logerr):
    x = []
    y = []
    for i in range(1, len(logerr)):
        y.append(logerr[i])
        x.append(logerr[i - 1])
    plt.title("Log-Log Plot of Newton's Convergence")
    plt.xlabel("Log $e_k$")
    plt.ylabel("log $e_{k - 1}$")
    plt.plot(x, y)
    plt.grid()
    plt.show()