function [U, Emin, Emax, x, dx] = potential(flag)
    dx = 0.002;
    x = 0:dx:1;
    U = zeros(1,length(x));

    switch flag
        case 'box'
            x = 2*x;
            U(abs(x)<1) = -80;
        case 'box_2'
            x = 2.25*x;
            U(x>0.5 & x<1.5) = -100;
        case 'gauss_2'
            x = 3*x;
            U = -79*(exp(-4*(x+1).^2)+exp(-4*(x-1).^2));
        case 'quad_2'
            x = 3*x;
            ind = find(x<1.5);
            U(ind) = 100*((x(ind)-0.75).^2-0.75^2);
        case 'ramp'
            x = 2*x;
            ind = find(x<1.5);
            U(ind) = 450*(x(ind)-1.5);
        case 'sin2_6'
            x = 3*x;
            ind = find(x<1.5);
            U(ind) = -190*(sin(2*pi*x(ind))).^2;
        case 'sin2_12'
            x = 3*x;
            ind = find(x<1.5);
            U(ind) = -180*(sin(4*pi*x(ind))).^2;
        case 'sin2_2'
            x = 1.5*x;
            ind = find(x<1);
            U(ind) = -400*(sin(pi*x(ind))).^2;
        case 'cos2_3'
            x = 2*x;
            ind = find(x<1.5);
            U(ind) = -170*(cos(pi*x(ind))).^2;
    end
    dx = x(2)-x(1);
    Emin = min(U);
    Emax = max(U);
end