def METHOD_NAME(E_axis, xmin, dx, nx):
    # Compute cell centers for grid
    x_cell_centers = np.linspace(xmin+dx/2.,xmax-dx/2.,nx)
    # Extract subgrid away from boundary (exact solution assumes infinite/open
    # domain but WarpX solution assumes perfect conducting walls)
    ix1 = round((xmin/2. - xmin)/dx)
    ix2 = round((xmax/2. - xmin)/dx)
    x_sub_grid = x_cell_centers[ix1:ix2]
    # Exact solution of field along Cartesian axes
    E_exact_grid = E_exact(x_sub_grid)
    # WarpX solution of field along Cartesian axes
    E_grid = E_axis[ix1:ix2]
    # Define approximate L2 norm error between exact and numerical solutions
    L2_error = (np.sqrt(sum((E_exact_grid - E_grid)**2))
              / np.sqrt(sum((E_exact_grid)**2)))
    return L2_error