Created
May 18, 2016 15:33
-
-
Save MikaelSlevinsky/7ad4ec0e2c44a22cc1a2199439bcf59c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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