Undergraduate Computational Macro
breakep_mean = ep_sum / length(ep) = -0.10436111001880369
ep_mean ≈ mean(ep) = true
ep_mean = -0.10436111001880369
sum(ep) / length(ep) = -0.10436111001880365
sum((ep_val for ep_val = ep)) / length(ep) = -0.10436111001880369
$name for variables or $(expr) for expressions inside strings@show@) transform code before execution; @show is a handy debug macro[0.45629390661111663, 2.239276519973084, 0.012093086182622361, 0.8178133947622638, 0.029520710239712283]
generatedata(5) = [0.7936585609350724, 2.54008455063787, 0.03630079956534469, 1.0596951950031361, 0.026581091545836936]
generatedata2(5) = [0.12012915959661571, 0.14908580134436417, 1.2037454134039276, 0.014073031953049788, 3.7808480859126736]
rand(dist, n) changes its behavior based on the type of distf3 can change. Avoid -> if name requiredf(pi) = 0.36787944117144233
f(pi; a = 2) = 2.718281828459045
f(pi; a) = 2.718281828459045
solve_model(0.1) = (a = 0.010000000000000002, b = 0.020000000000000004, c = 0.030000000000000006)
a = 0.010000000000000002, c = 0.030000000000000006
size(b) = (3,)
size(A) = (2, 2)
typeof(b) = Vector{Float64}
typeof(A) = Matrix{Int64}
zeros(3) = [0.0, 0.0, 0.0]
ones(2, 2) = [1.0 1.0; 1.0 1.0]
fill(1.0, 2, 2) = [1.0 1.0; 1.0 1.0]
similar(A) = [139665379137856 139665235556560; 139665235556112 139665235557008]
A[1, 1] = 1
A[1, :] = [1, 2]
A[1:end, 1] = [1, 3]
cumsum(x) = [1.0, 0.0, 2.5, 2.0]
findfirst(g, x) = 3
(val_1, val_2) = (3, 3)
A * b = [5, 11]
A' = [1 3; 2 4]
dot(b, [5.0, 2.0]) = 9.0
b' * b = 5
Diagonal([1.0, 2.0]) = Diagonal([1.0, 2.0])
I = LinearAlgebra.UniformScaling{Bool}(true)
inv(A) = [-1.9999999999999996 0.9999999999999998; 1.4999999999999998 -0.4999999999999999]
norm(v, 1) or norm(v, Inf) for othersnorm(v) = 5.0990195135927845
(manual_euclid1, manual_euclid2) = (5.0990195135927845, 5.0990195135927845)
norm(v, 1) = 8.0
norm(v, Inf) = 4.0
size(X) = (2, 3, 4)
M2 = [7 9 11; 8 10 12]
view(X, :, :, 2) = [7 9 11; 8 10 12]
X[1, :, 2] = [7, 9, 11]
> Git: Clone the https://github.com/quantecon/lecture-julia.notebooks