Hello Dear Julians,
I’m currently translating a code from MATLAB to Julia and I got stuck at reformulating a non-linear differential equation problem. The code in MATLAB is as follows,
for i = 1:numel(rrangeopt)
r = rrangeopt(i); welfarecurrent(i) = welfare(c,l,s,mass,r,My,e); % welfare under current tax % compute lump sum payment equivalent to welfare gain from optimal tax using the function welfare % absolute change in lump sum payment: cwelfaregainlumpabs(i) = fsolve(@(add) 100000*(welfare(c+add,l,s+add,mass,r,My,e)-welfareopt(i)),1); % relative to current average income: cwelfaregainlumpgdp(i) = cwelfaregainlumpabs(i)/ymean; % relative to current lump sum payment: cwelfaregainlump (i) = cwelfaregainlumpabs(i)/s;
I want to reformulate fsolve(@(add) 100000(welfare(c+add,l,s+add,mass,r,My,e)-welfareopt(i)),1)* in Julia and solve it with NlSolve package but I couldn’t find ant documents online to help me. welfare is a function while welfareopt is a vector.
I would appreciate any input to help me understand what the MATLAB code does and how can I reformulate it in Julia.