Skip to content

Instantly share code, notes, and snippets.

@MikaelSlevinsky
Created May 18, 2016 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikaelSlevinsky/7ad4ec0e2c44a22cc1a2199439bcf59c to your computer and use it in GitHub Desktop.
Save MikaelSlevinsky/7ad4ec0e2c44a22cc1a2199439bcf59c to your computer and use it in GitHub Desktop.
using FastTransforms, PyPlot
errASY1,errASY2,errCXN1,errCXN2 = Float64[],Float64[],Float64[],Float64[]
n = round(Int,logspace(1,5,30))
for k in n
println("This is k: ",k)
srand(0)
c = randn(k)
push!(errASY1,norm(icjt(cjt(c,0.,0.),0.,0.)-c,Inf))
push!(errASY2,norm(cjt(icjt(c,0.,0.),0.,0.)-c,Inf))
push!(errCXN1,norm(cheb2leg(leg2cheb(c))-c,Inf))
push!(errCXN2,norm(leg2cheb(cheb2leg(c))-c,Inf))
end
clf();loglog(n,errASY1,"-r",n,errASY2,"-g",n,errCXN1,"-b",n,errCXN2,"-k")
xlabel("\$ N \$");ylabel("Absolute Error")
legend(["Forward-Inverse ASY","Inverse-Forward ASY","Forward-Inverse CXN","Inverse-Forward CXN"],loc="upper left")
savefig("asycxn.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment