GitHub

Original file line numberDiff line numberDiff line change

@@ -985,7 +985,7 @@ class BCG_complete_markets:

985985

weights = self.weights

986986

integ = lambda 𝜖: np.exp(𝜖) * fk * q(𝜖, k)

987987
988-

return -k + np.sum(weights * integ(self.points_integral)) / np.sqrt(np.pi)

988+

return -k + (weights @ integ(self.points_integral)) / np.sqrt(np.pi)

989989
990990

#=========== Optimal c ===========#

991991

# Function: Compute optimal consumption choices c

@@ -1007,10 +1007,10 @@ class BCG_complete_markets:

10071007

fk = self.f(k)

10081008
10091009

c1 = lambda 𝜖: (w1(𝜖) + np.exp(𝜖)*fk)*q(𝜖,k)

1010-

denom = np.sum(weights * c1(self.points_integral)) / np.sqrt(np.pi) + (w0 - k)

1010+

denom = (weights @ c1(self.points_integral)) / np.sqrt(np.pi) + (w0 - k)

10111011
10121012

w11q = lambda 𝜖: w11(𝜖)*q(𝜖,k)

1013-

num = w10 + 𝜃10 * V(k) + np.sum(weights * w11q(self.points_integral)) / np.sqrt(np.pi)

1013+

num = w10 + 𝜃10 * V(k) + (weights @ w11q(self.points_integral)) / np.sqrt(np.pi)

10141014
10151015

𝜂 = num / denom

10161016

@@ -1048,7 +1048,7 @@ def k_foc_factory(model):

10481048
10491049

@njit

10501050

def k_foc(k, 𝜒1, 𝜒2):

1051-

int_k = np.sum(weights * integrand(points_integral, 𝜒1, 𝜒2, k=k)) / np.sqrt(np.pi)

1051+

int_k = (weights @ integrand(points_integral, 𝜒1, 𝜒2, k=k)) / np.sqrt(np.pi)

10521052
10531053

mul = 𝛽 * 𝛼 * A * k ** (𝛼 - 1) / ((w0 - k) ** (-𝜓))

10541054

val = mul * int_k - 1

Read the original on github.com ↗