Error for "sol_prog10_02.f90"

Forums Questions on specific programs Error for "sol_prog10_02.f90"

This topic contains 1 reply, has 2 voices, and was last updated by Maurice Hofmann May 14, 2020 at 4:19 pm.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1816

    LEE Hyung Suk
    User

    Hello,

    I am always grateful to your valuable sources.

    But, in sol_prog10_02.f90(Exercise and Solutions Manual)

    line 263, I found error as follow.

    ” 263 | phi(1, 0, ip, is_initial) = varphi*dist_theta(ip)”
    Error: ‘varphi’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

    If permit your time, please answer my question.

    Thank you.

    Respect

    #1819

    Maurice Hofmann
    User

    Hi,

    thank you for your comment on the solution for Exercise 10.2.

    You are right, that this is a mistake in program sol_prog10_02. The code in line 262-265 needs to be corrected to:

    ! get initial distribution in age 1
    do ip = 1, NP
        phi(1, 0, ip, is_initial) = dist_theta(ip)
    enddo

    Explanation:

    varphi is most likely still a relict from prog10_01 on which this solution is based on. There, the lower bound of the asset grid is defined more generally and stored in a separate array a_bor. This makes it necessary at age 1 to use linear interpolation to attribute the correct share of individuals to the gridpoints on the asset grid.

    However, in sol_prog10_02 the borrowing constraint a ‚Č• 0 is implicitly defined by the lower bound of the asset grid. Under the assumption, that individuals start their lifecycle with zero assets it is enough to attribute them fully to the gridpoint \hat{a}_0.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.