Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve NumPy code in equalizing differences lecture #361

Closed
jstac opened this issue Feb 12, 2024 · 3 comments
Closed

Improve NumPy code in equalizing differences lecture #361

jstac opened this issue Feb 12, 2024 · 3 comments

Comments

@jstac
Copy link
Contributor

jstac commented Feb 12, 2024

The NumPy code does not adhere to PEP8 and the class could easily be removed, so that compute_gap is just a function of the different parameters.

Then we could get rid of all the separate functions in the code block that starts with

# ϕ_R
def ϕ_R(mc, R_new):
    mc_new = equalizing_diff(R_new, mc.T, mc.γ_h, mc.γ_c, mc.w_h0, mc.D, mc.π)
    return mc_new.compute_gap()

ϕ_R = np.vectorize(ϕ_R)

@thomassargent30 Would you be willing to let @HumphreyYang and I simplify the NumPy part of the code without changing what it does?

@jstac
Copy link
Contributor Author

jstac commented Feb 12, 2024

The benchmark parameters

# set benchmark parameters
R = 1.05
T = 40
γ_h, γ_c = 1.01, 1.01
w_h0 = 1
D = 10

could be included at default values for the compute_gap function.

@HumphreyYang
Copy link
Collaborator

Hi @jstac,

I think this issue has been addressed in #388. Would you like me to close it?

@jstac
Copy link
Contributor Author

jstac commented Apr 9, 2024

Thanks @HumphreyYang, closing.

@jstac jstac closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants