I am working on my own project, and I proved the following recursive equation has a
unique fixed point (due to the Banach Fixed Point Theorem).
Here is the equation with simplified notations. I couldn’t find any option to write mathematical equations in a nice way. Please let me know if this matters for your understanding.
Way1 : v(x) = -c + s*n*max(F(v(x)),v(x)) + s*m*max(G(v(x)),v(x)) + s*(1-n-m)*v(x)
where all the parameters are in (0,1) with n+m in (0,1). Unless there is a mathematical mistake, I believe this exacts to
Way2 : v(x) = -c/(1-s) + s/(1-s)*n*max(F(v(x))-v(x),0) + s/(1-s)*m*max(G(v(x))-v(x),0)
However somehow when I use while function to get the fixed point, whereas Way1 attains the fixed point, Way2 does not.
I would very much like to know if this difference is whether coming from some error in my codes or from the way iteration works differently. Just in case, I leave my real codes.
Way 1
m_A = 0.15
m_B = 0.8
maxiter = 5000
tolerance = 1e-10
v_iv = collect(1:n) ./1000 # initial condition
# setup the algorithm
v_old = v_iv
normdiff = Inf
iter = 1
while normdiff > tolerance && iter <= maxiter
v_new = -c .+ s .* m_A .* max.(im_sur(v_old),v_old) .+ s.*m_B .* max.(na_splus(v_old),v_old) .+ s .* (1-m_A-m_B) .* v_old
normdiff = norm(v_new - v_old)
v_old = v_new
iter = iter + 1
end
# Way 2
c_new = -c / (1-s)
m_A_new = m_A * s / (1-s)
m_B_new = m_B * s / (1-s)
while normdiff > tolerance && iter <= maxiter
v_new = c_new .+ m_A_new .* max.(im_sur(v_old) .- v_old , 0) .+ m_B_new .* max.(na_splus(v_old) .- v_old , 0)
normdiff = norm(v_new - v_old)
v_old = v_new
iter = iter + 1
end