function [x, info, kappa] = quadratic_penalty(f, h, beta, x0)

    % This uses Manopt (go to Manopt.org), but could use fmincon.

    problem.M = euclideanfactory(size(x0));
    problem.cost = @(x) f(x) + (beta/2)*h(x)^2;
    problem = manoptAD(problem);

    options.verbosity = 0;
    [x, ~, info] = steepestdescent(problem, x0, options);
    
    kappa = cond(hessianmatrix(problem, x));

end
