def METHOD_NAME(width=5,
                    padn=100,
                    trim=30,
                    spacing=5,
                    noise_loc=[0,0],
                    noise_scale=[1e-1,1e-1],
                    learning_rate=1e-1,
                    num_iter=10000,
                    uniform_energy=True,
                    known_response_energy=None,
                    known_response_f_p=None,
                    known_response_f_dp=None,
                    ):
    """
    Run an example optimization with the following steps:
    1. Simulate f" based on a very simple model of the K-edge.
    2. Use the dispersion relations to calculate f′.
    3. Sample both of these curves with Gaussian noise to simulate experimental measurement of the two curves.
    4. Use restraint to optimize the parameters. Use automatic differentiation for first-derivatives.
    """
    energy,f_p,f_dp = create_f(width=width,
                               padn=padn,
                               trim=trim,
                               uniform_energy=uniform_energy)
    f_p_noisy,f_dp_noisy = sample(f_p,f_dp,
                                  loc=noise_loc,
                                  scale=noise_scale,
                                  )
    energy_ss,f_p_noisy_ss,f_dp_noisy_ss,inds = subsample(energy,f_p_noisy,f_dp_noisy,
                                                          spacing=spacing)
    # From energy_ss,f_p_noisy_ss, and f_dp_noisy_ss, determine f_p and f_dp, energy is given
    f_p_pred_0 = kramers_kronig_helper.INTERP_FUNC(energy_ss,f_p_noisy_ss)(energy)
    f_dp_pred_0 = kramers_kronig_helper.INTERP_FUNC(energy_ss,f_dp_noisy_ss)(energy)
    f_p_opt = torch.tensor(f_p_pred_0,requires_grad=True)
    f_dp_opt = torch.tensor(f_dp_pred_0, requires_grad=True)
    optimizer = torch.optim.SGD([f_p_opt,f_dp_opt],lr=learning_rate)
    loss_vec = []
    actual_loss_vec = []
    for i in range(num_iter):
        loss = get_loss(energy,
                        f_p_opt,
                        f_dp_opt,
                        f_p_noisy_ss,
                        f_dp_noisy_ss,
                        inds,
                        known_response_energy=known_response_energy,
                        known_response_f_p=known_response_f_p,
                        known_response_f_dp=known_response_f_dp,
                        )
        actual_loss = torch.mean((f_p_opt-f_p)**2 + (f_dp_opt-f_dp)**2)
        loss_vec.append(loss)
        actual_loss_vec.append(actual_loss)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()
    return(energy,
           f_p,
           f_dp,
           energy_ss,
           f_p_noisy_ss,
           f_dp_noisy_ss,
           f_p_pred_0,
           f_dp_pred_0,
           f_p_opt,
           f_dp_opt,
           loss_vec,
           actual_loss_vec,
           )