jlperla / continuous_time_methods

MIT License
23 stars 15 forks source link

Consider formalization of this trick for solving for the KFE #21

Open jlperla opened 7 years ago

jlperla commented 7 years ago

From Ben: Simply fix one element of the vector f, then solve the linear system (which is no longer singular) and the renormalize f afterwards. See e.g. this code snippet from http://www.princeton.edu/~moll/HACTproject/huggett_partialeq.m

AT = A';
b = zeros(2*I,1);

%need to fix one value, otherwise matrix is singular
i_fix = 1;
b(i_fix)=.1;
row = [zeros(1,i_fix-1),1,zeros(1,2*I-i_fix)];
AT(i_fix,:) = row;

%Solve linear system
gg = AT\b;
g_sum = gg'*ones(2*I,1)*da;
gg = gg./g_sum;

The question will be whether this approach can be generalized in a nonlinear setup.