QuantEcon/lecture-julia.myst

Add back in ApproxFun example without dependencies

jlperla opened this issue · 0 comments

In the iterative_methods_sparsity section on orthogonal polynomials, I removed the following code, which we can add back in at some point - hopefully compartmentalized.

    using ApproxFun
    N = 10000
    S = Chebyshev(-1.0..1.0)  # form Chebyshev basis
    x = points(S, N)  # chooses Chebyshev nodes
    y = g.(x)
    g_approx = Fun(S,ApproxFun.transform(S,y))  # transform fits the polynomial
    @show norm(g_approx.(x) - g.(x), Inf)
    plot(x_display, g_approx.(x_display), label = L"P_{10000}(x)")
    plot!(x_display, g.(x_display), w = 3, label = L"g(x)")