ScPo Computational Economics 2018
#Pkg.add("FastGaussQuadrature")
using FastGaussQuadrature
np = 3
rules = Dict("hermite" => gausshermite(np),
"chebyshev" => gausschebyshev(np),
"legendre" => gausslegendre(np),
"lobatto" => gausslobatto(np))
using DataFrames
integ = DataFrame(Rule=Symbol[Symbol(x) for x in keys(rules)],nodes=[x[1] for x in values(rules)],weights=[x[2] for x in values(rules)])
A = [1 2;3 4]
B = [1;10]
kron(A,B)
kron(B,A)
rules["hermite"]
.rules["hermite"][1]
repeat(rules["hermite"][1],inner=[1],outer=[9])
nodes = Any[]
push!(nodes,repeat(rules["hermite"][1],inner=[1],outer=[9])) # dim1
push!(nodes,repeat(rules["hermite"][1],inner=[3],outer=[3])) # dim2
push!(nodes,repeat(rules["hermite"][1],inner=[9],outer=[1])) # dim3
weights = kron(rules["hermite"][2],kron(rules["hermite"][2],rules["hermite"][2]))
df = hcat(DataFrame(weights=weights),DataFrame(nodes,[:dim1,:dim2,:dim3]))
dimx
, multiply with the corresponding weight, and sum.{}
stands for the fractional part of a number. for $v=\sqrt{2}$,
$$ x_1 = \{1 \sqrt{2}\} = \{1.4142\} = 0.4142, x_2 = \{2 \sqrt{2}\} = \{2.8242\} = 0.8242,... $$# Pkg.add("Sobol")
using Sobol
using Plots
s = SobolSeq(2)
p = hcat([next(s) for i = 1:1024]...)'
scatter(p[:,1], p[:,2], m=(:red,:dot,1.0),legend=false)