function sol_function = default_integrals(l_dem_B,cstarB,...
    wage,mB_minus,dB_minus,q_complete,num_eq,type_calc)

% Load parameters.
load params_file

% Default threshold and rate
epshat = max( (cbar + q_complete.*mB_minus - dB_minus)./(wage.*l_dem_B), 0);

% Constrained consumption cutoffs
epsstar_nd = max( (cstarB + q_complete.*mB_minus - dB_minus)./(wage.*l_dem_B), 0);
epsstar_d = max( (cstarB - dB_minus)./(wage.*l_dem_B), 0);
epsbar_d = min(epsstar_d,epshat);

% Integrals for consumption
A = wage.*l_dem_B;
B_d = dB_minus;
B_nd = dB_minus - q_complete.*mB_minus;

% Parameters for the integrals.
params.gaMMa = gaMMa;
params.logmueps = logmueps;
params.logsigeps = logsigeps;
params.nodes = nodes;
params.weights = weights;

[upr_vec,upreps_vec,Fdef_vec,Fdefeps_vec] = ...
    getDefaultFcts(epshat,epsstar_nd,epsbar_d,A,B_nd,B_d,params);


% Option 1: Multipliers
% values of multipliers for the FOC
if type_calc == 1
    if num_eq == 1
        nunodef_int = upr_vec(:,1) - Fdef_vec(:,1).*cstarB.^(-gaMMa);
        sol_function = nunodef_int;
    elseif num_eq == 2
        nudef_int = upr_vec(:,2) - Fdef_vec(:,2).*cstarB.^(-gaMMa);
        sol_function = nudef_int;
        % values of multipliers times nodes (for labor FOC)
    elseif num_eq == 3
        nunodefeps_int = upreps_vec(:,1) - Fdefeps_vec(:,1).*cstarB.^(-gaMMa);
        sol_function = nunodefeps_int;
    elseif num_eq == 4
        nudefeps_int = upreps_vec(:,2) - Fdefeps_vec(:,2).*cstarB.^(-gaMMa);
        sol_function = nudefeps_int;
    elseif num_eq == 5
        FbarB = logncdf(epshat,logmueps,logsigeps);
        sol_function = FbarB;
    elseif num_eq == 6
        fepshat = lognpdf(epshat,logmueps,logsigeps);
        sol_function = fepshat;
    end
end

% Option 2: CDF
if type_calc == 2
    sol_function = Fdef_vec(num_eq);
end

% Option 2: Conditional Expectation
if type_calc == 3
    sol_function = Fdefeps_vec(num_eq);
end

end

