Skip to content

Commit

Permalink
Alphabetizing tests; upd comp test scr; bumping ver to 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fusion809 committed Jul 9, 2020
1 parent cdd820f commit c4c5156
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FunctionIntegrator"
uuid = "7685536e-2581-4f83-bef1-2ba363c9cb91"
authors = ["Brenton Horne <[email protected]>"]
version = "0.4.0"
version = "0.4.1"

[deps]
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
Expand Down
48 changes: 18 additions & 30 deletions test/Computation_times_Travis_92.2.jl
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
# Taken from https://travis-ci.com/github/fusion809/FunctionIntegrator.jl/jobs/358878829
# Taken from https://travis-ci.com/github/fusion809/FunctionIntegrator.jl/jobs/359262615
# 10th entry is simppen
L_adaptive_simpsons = [0.153903;
0.045990;
0.000090;

L_chebyshev1=[1.493455; # AiryAi(x)
0.291795; # besselj
0.041686; # cos_cot
0.104719; #
0.116603;
0.090129;
0.088141;
0.114219;
0.162800;
0.441775;
0.102337;
0.050055;
0.048896];
L_chebyshev2=[0.176496; 0.060008; 0.041355; 0.099813; 0.111966; 0.125740; 0.103428; 0.098729; 0.064575; 8.991385; 0.096214; 0.052295; 0.049748];
L_chebyshev3 = [0.150834; 0.072039; 0.049798; 0.111535; 0.099392; 0.101607; 0.111045; 0.111373; 0.070177; 3.208550; 0.092763; 0.057960; 0.055562];
L_chebyshev4 = [0.125087; 0.070966; 0.049619; 0.092735; 0.098091; 0.100671; 0.099425; 0.099531; 0.070195; 4.146543; 0.094798; 0.056763; 0.053876];
L_jacobi = [20.655073; 0.741378; 0.079454; 0.468545; 0.220772; 2.786482; 0.531896; 0.446746; 0.479568; 22.058539; 0.242638; 1.933591; 0.694156];
L_legendre=[0.122725; 0.076702; 0.030384; 0.071562; 0.078758; 0.078509; 0.088236; 0.090079; 0.043331; 4.383104; 0.059413; 0.036632; 0.033564];
L_lobatto=[0.169799; 0.012460; 0.000103; 0.080504; 0.143451; 0.117507; 0.086438; 0.091315; 0.000142; 21.927058; 0.025977; 0.000409; 0.000141];
L_radau = [0.151726; 0.012143; 0.000040; 0.094062; 0.129707; 0.104701; 0.086289; 0.087083; 0.000057; 22.282400; 0.025089; 0.000345; 0.000109];
L_rectangle_midpoint = [0.073208; 0.000017; 0.000330; 0.019159; 0.022585; 0.030032; 0.018576; 0.021532; 0.000027; 1.863286; 0.035673; 0.000545; 0.000903];
L_simpsons=[0.080275; 0.040657; 0.000012; 0.023218; 0.041971; 0.028887; 0.025965; 0.031452; 0.018607; 13.831230; 0.047495; 0.000064; 0.000078];
L_simpsons38=[0.068510; ]
L_trapezoidal=[0.149524; 0.034553; 0.000577; 0.017627; 0.032416; 0.022288; 0.019312; 0.023317; 0.013583; 13.361007; 0.077226; 0.001042; 0.001420];

L_adaptive_simpsons = [0.144420; 0.048034; 0.000163; 0.019791; 0.031644; 0.022732; 0.022157; 0.023056; 0.000081; 12.635982; 0.002164; 0.000840; 0.000220];
L_chebyshev1 = [1.374153; 0.295273; 0.042028; 0.097700; 0.085278; 0.091216; 0.085430; 0.086918; 0.136373; 0.405410; 0.088461; 0.048735; 0.045503];
L_chebyshev2 = [0.189887; 0.063260; 0.041871; 0.095741; 0.109335; 0.101715; 0.111041; 0.100269; 0.082595; 8.732129; 0.090618; 0.050086; 0.045789];
L_chebyshev3 = [0.166648; 0.067508; 0.048010; 0.090679; 0.093410; 0.123339; 0.094715; 0.107830; 0.068438; 3.184987; 0.088439; 0.056318; 0.051559];
L_chebyshev4 = [0.133982; 0.067320; 0.048107; 0.093402; 0.105892; 0.101815; 0.095580; 0.095526; 0.067627; 4.097529; 0.090069; 0.054310; 0.050882];
L_jacobi = [20.730626; 0.696972; 0.074401; 0.472530; 0.214534; 2.607443; 0.521480; 0.440099; 0.493098; 21.869202; 0.162223; 1.875650; 0.579464];
L_legendre = [0.104126; 0.075988; 0.029669; 0.069286; 0.074264; 0.075576; 0.072840; 0.071971; 0.043136; 4.255756; 0.058376; 0.034468; 0.030826];
L_lobatto = [0.191745; 0.012332; 0.000122; 0.090188; 0.139901; 0.105984; 0.083651; 0.081196; 0.000138; 21.580829; 0.092406; 0.000301; 0.000141];
L_radau = [0.140783; 0.012576; 0.000053; 0.079066; 0.108806; 0.111685; 0.096150; 0.081501; 0.000065; 21.579555; 0.023179; 0.000421; 0.000113];
L_rectangle_midpoint = [0.074701; 0.000019; 0.000266; 0.018933; 0.020185; 0.018622; 0.018862; 0.018857; 0.000027; 1.564159; 0.029700; 0.000414; 0.000740];
L_simpsons = [0.057260; 0.018206; 0.000013; 0.020936; 0.029926; 0.022812; 0.023652; 0.024098; 0.018203; 13.383746; 0.036649; 0.000066; 0.000052];
L_simpsons38 = [0.056655; 0.040500; 0.000012; 0.023536; 0.031635; 0.026131; 0.024863; 0.025426; 0.017806; 14.101716; 0.040174; 0.000060; 0.000041];
L_trapezoidal = [0.141598; 0.034595; 0.000494; 0.015096; 0.021626; 0.017495; 0.016807; 0.017933; 0.012839; 12.977622; 0.069035; 0.000937; 0.001293];
N = length(L_simpsons);

# RMS of times
rms_adaptive_simpsons_wo_simppen = sqrt((L_adaptive_simpsons[1:9]'*L_adaptive_simpsons[1:9]+L_adaptive_simpsons[11:N]'*L_adaptive_simpsons[11:N])/(N-1));
rms_chebyshev1 = sqrt(L_chebyshev1'*L_chebyshev1/N);
rms_chebyshev1_wo_simppen = sqrt((L_chebyshev1[1:9]'*L_chebyshev1[1:9]+L_chebyshev1[11:N]'*L_chebyshev1[11:N])/(N-1));
rms_chebyshev2 = sqrt(L_chebyshev2'*L_chebyshev2/N);
Expand All @@ -49,6 +34,7 @@ rms_radau_wo_simppen = sqrt((L_radau[1:9]'*L_radau[1:9]+L_radau[11:N]'*L_radau[1
rms_rectangle_midpoint = sqrt(L_rectangle_midpoint'*L_rectangle_midpoint/N);
rms_rectangle_midpoint_wo_simppen = sqrt((L_rectangle_midpoint[1:9]'*L_rectangle_midpoint[1:9]+L_rectangle_midpoint[11:N]'*L_rectangle_midpoint[11:N])/(N-1));
rms_simpsons_wo_simppen = sqrt((L_simpsons[1:9]'*L_simpsons[1:9]+L_simpsons[11:N]'*L_simpsons[11:N])/(N-1));
rms_simpsons38_wo_simppen = sqrt((L_simpsons38[1:9]'*L_simpsons38[1:9]+L_simpsons38[11:N]'*L_simpsons38[11:N])/(N-1));
rms_trapezoidal_wo_simppen = sqrt((L_trapezoidal[1:9]'*L_trapezoidal[1:9]+L_trapezoidal[11:N]'*L_trapezoidal[11:N])/(N-1));

rms_wo_simppen = [rms_chebyshev1_wo_simppen; rms_chebyshev2_wo_simppen; rms_chebyshev3_wo_simppen; rms_chebyshev4_wo_simppen; rms_jacobi_wo_simppen; rms_legendre_wo_simppen; rms_lobatto_wo_simppen; rms_radau_wo_simppen; rms_rectangle_midpoint_wo_simppen; rms_simpsons_wo_simppen; rms_trapezoidal_wo_simppen];
Expand All @@ -60,6 +46,7 @@ println("rms_chebyshev4 is $(rms_chebyshev4)")
println("rms_jacobi is $(rms_jacobi)")
println("rms_legendre is $(rms_legendre)")

println("rms_adaptive_simpsons_wo_simppen is $(rms_adaptive_simpsons_wo_simppen)")
println("rms_chebyshev1_wo_simppen is $(rms_chebyshev1_wo_simppen)")
println("rms_chebyshev2_wo_simppen is $(rms_chebyshev2_wo_simppen)")
println("rms_chebyshev3_wo_simppen is $(rms_chebyshev3_wo_simppen)")
Expand All @@ -70,4 +57,5 @@ println("rms_lobatto_wo_simppen is $(rms_lobatto_wo_simppen)")
println("rms_radau_wo_simppen is $(rms_radau_wo_simppen)")
println("rms_rectangle_midpoint_wo_simppen is $(rms_rectangle_midpoint_wo_simppen)")
println("rms_simpsons_wo_simppen is $(rms_simpsons_wo_simppen)")
println("rms_simpsons38_wo_simppen is $(rms_simpsons38_wo_simppen)")
println("rms_trapezoidal_wo_simppen is $(rms_trapezoidal_wo_simppen)")
4 changes: 2 additions & 2 deletions test/airyai.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# AiryAi(x)
printstyled("Performing the Airy Ai(x) test, where Ai(x) is integrated on the semi-infinite domain, or an approximation of it, namely [0,100] and the result is compared to the analytical result 1/3.\n"; color = :red)
@testset "Airy Ai(x)" begin
printstyled("Running: adaptive_simpsons_rule\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> airyai(x), 0, 100, 1e-8) 1.0/3.0
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(x -> airyai(x), 38337, 1, 0, 100) 1.0/3.0
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand Down Expand Up @@ -29,8 +31,6 @@ printstyled("Performing the Airy Ai(x) test, where Ai(x) is integrated on the se
@time @test simpsons_rule(x -> airyai(x), 2512, 0, 100) 1.0/3.0
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(x -> airyai(x), 3075, 0, 100) 1.0/3.0
printstyled("Running: adaptive_simpsons_rule\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> airyai(x), 0, 100, 1e-8) 1.0/3.0
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(x -> airyai(x), 208381, 0, 100) 1.0/3.0
end
4 changes: 2 additions & 2 deletions test/besselj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ end

printstyled("Performing the besselj test, where BesselJ_1(2) is approximated and the result is compared to the value obtained from SpecialFunctions' besselj function.\n"; color = :red)
@testset "besselj" begin
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(besselj_integrand, 0, pi/2, 1e-7) besselj(1,2)
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(besselj_integrand, 4665, 1, 0, pi/2) besselj(1,2)
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand All @@ -31,8 +33,6 @@ printstyled("Performing the besselj test, where BesselJ_1(2) is approximated and
@time @test simpsons_rule(besselj_integrand, 6, 0, pi/2) besselj(1,2)
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(besselj_integrand, 9, 0, pi/2) besselj(1,2)
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(besselj_integrand, 0, pi/2, 1e-7) besselj(1,2)
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(besselj_integrand, 4, 0, pi/2) besselj(1,2)
end
4 changes: 2 additions & 2 deletions test/cos_cot_integral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ end

printstyled("Integrating cos^2(x)/(1+cot(x)) from 0 to pi/2 and comparing the results to the analytical result 0.25.\n"; color = :red)
@testset "coscotint" begin
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(cos_cot_fn, 0, pi/2, 1e-7) 0.25
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(cos_cot_fn, 88, 1, 0, pi/2) 0.25
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand All @@ -33,8 +35,6 @@ printstyled("Integrating cos^2(x)/(1+cot(x)) from 0 to pi/2 and comparing the re
@time @test simpsons_rule(cos_cot_fn, 78, 0, pi/2) 0.25
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(cos_cot_fn, 96, 0, pi/2) 0.25
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(cos_cot_fn, 0, pi/2, 1e-7) 0.25
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(cos_cot_fn, 7430, 0, pi/2) 0.25
end
4 changes: 2 additions & 2 deletions test/cosine.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# cosine test
printstyled("Integrating cosine from 0 to pi/2 and comparing the result to the analytical result of 1.\n"; color = :red)
@testset "Cosine" begin
printstyled("Running: adaptive_simpsons_rule\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> cos(x), 0, pi/2, 1e-7) 1
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(x -> cos(x), 4656, 1, 0, pi/2) 1
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand All @@ -27,8 +29,6 @@ printstyled("Integrating cosine from 0 to pi/2 and comparing the result to the a
@time @test simpsons_rule(x -> cos(x), 40, 0, pi/2) 1
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(x -> cos(x), 48, 0, pi/2) 1
printstyled("Running: adaptive_simpsons_rule\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> cos(x), 0, pi/2, 1e-7) 1
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(x -> cos(x), 3715, 0, pi/2) 1
end
4 changes: 2 additions & 2 deletions test/expnx2datan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ sol_9 = exp(1)*pi*erfc(1);

printstyled("Integrating e^(-x^2)/(1+x^2) on the infinite domain [-inf, inf], or failing that on [-100,100], and comparing it to the analytical result exp(1)*pi*erfc(1)\n"; color = :red)
@testset "expnx2datan" begin
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> exp(-x^2)/(x^2+1), -100, 100, 1e-7) sol_9
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(x -> exp(-x^2)/(x^2+1), 1029, 1, -100, 100) sol_9
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand Down Expand Up @@ -33,8 +35,6 @@ printstyled("Integrating e^(-x^2)/(1+x^2) on the infinite domain [-inf, inf], or
@time @test simpsons_rule(x -> exp(-x^2)/(x^2+1), 1240, -100, 100) sol_9
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(x -> exp(-x^2)/(x^2+1), 1767, -100, 100) sol_9
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> exp(-x^2)/(x^2+1), -100, 100, 1e-7) sol_9
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(x -> exp(-x^2)/(x^2+1), 655, -100, 100) sol_9
end
4 changes: 2 additions & 2 deletions test/gaussian.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Gaussian curve test
printstyled("Integrate exp(-x^2) from minus infinity to positive infinity and comparing the result to the analytical solution, sqrt(pi)\n"; color = :red)
@testset "Gaussian" begin
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> exp(-x^2), -100, 100, 1e-7) sqrt(pi)
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(x -> exp(-x^2), 433, 1, -100, 100) sqrt(pi)
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand Down Expand Up @@ -33,8 +35,6 @@ printstyled("Integrate exp(-x^2) from minus infinity to positive infinity and co
@time @test simpsons_rule(x -> exp(-x^2), 536, -100, 100) sqrt(pi)
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(x -> exp(-x^2), 780, -100, 100) sqrt(pi)
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> exp(-x^2), -100, 100, 1e-7) sqrt(pi)
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(x -> exp(-x^2), 276, -100, 100) sqrt(pi)
end
4 changes: 2 additions & 2 deletions test/logarithm.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# logarithm test
printstyled("Integrating 1/x from 1 to e and comparing the result to the analytical solution, 1.\n"; color = :red)
@testset "1/x" begin
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> x^(-1), 1, exp(1), 1e-7) 1
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(x -> x^(-1), 5695, 1, 1, exp(1)) 1
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand All @@ -27,8 +29,6 @@ printstyled("Integrating 1/x from 1 to e and comparing the result to the analyti
@time @test simpsons_rule(x -> x^(-1), 70, 1, exp(1)) 1
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(x -> x^(-1), 84, 1, exp(1)) 1
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> x^(-1), 1, exp(1), 1e-7) 1
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(x -> x^(-1), 3779, 1, exp(1)) 1
end
4 changes: 2 additions & 2 deletions test/logoverx.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
printstyled("Integrating log(x)/x from 1 to e and comparing the result to the analytical solution of 0.5.\n"; color = :red)
@testset "log(x)/x" begin
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> log(x)/x, 1, exp(1), 1e-8) 0.5
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(x -> log(x)/x, 4177, 1, 1, exp(1)) 0.5
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand All @@ -26,8 +28,6 @@ printstyled("Integrating log(x)/x from 1 to e and comparing the result to the an
@time @test simpsons_rule(x -> log(x)/x, 100, 1, exp(1)) 0.5
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(x -> log(x)/x, 114, 1, exp(1)) 0.5
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(x -> log(x)/x, 1, exp(1), 1e-8) 0.5
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(x -> log(x)/x, 5747, 1, exp(1)) 0.5
end
4 changes: 2 additions & 2 deletions test/modbessel0.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ end

printstyled("Approximating the modified bessel function I_1(1) and comparing it to the result obtained by SpecialFunctions.\n"; color = :red)
@testset "modbessel0" begin
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(dmodified_bessel_1, 0, pi/2, 1e-7) besseli(x,1)
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(dmodified_bessel_1, 4942, 1, 0, pi/2) besseli(x,1)
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand All @@ -35,8 +37,6 @@ printstyled("Approximating the modified bessel function I_1(1) and comparing it
@time @test simpsons_rule(dmodified_bessel_1, 6, 0, pi/2) besseli(x,1)
printstyled("Running: simpsons38_rule\n"; color = :magenta)
@time @test simpsons38_rule(dmodified_bessel_1, 9, 0, pi/2) besseli(x,1)
printstyled("Running: adaptive_simpsons_rule with ε=1e-7\n"; color = :magenta)
@time @test adaptive_simpsons_rule(dmodified_bessel_1, 0, pi/2, 1e-7) besseli(x,1)
printstyled("Running: trapezoidal_rule\n"; color = :magenta)
@time @test trapezoidal_rule(dmodified_bessel_1, 3, 0, pi/2) besseli(x,1)
end
4 changes: 2 additions & 2 deletions test/simppen.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Simple pendulum test
printstyled("Integrating 1/sqrt(-19.6 sin(x)) from -pi to 0 and comparing the result to the analytical solution of ellipk(1/2)/sqrt(2.45) The integrand has singularities at x = -pi and x=0, so for some of these functions the integration domain has to be itself approximated.\n"; color = :red)
@testset "Simppen" begin
printstyled("Running: adaptive_simpsons_rule on [-pi+1e-8, -1e-8]. Only a rough approximation can be realistically achieved with this function, due to the singularities.\n"; color = :magenta)
@time @test abs(adaptive_simpsons_rule(x -> (-19.6*sin(x))^(-0.5), -pi+1e-8, -1e-8, 1e-5) - ellipk(1/2)/sqrt(2.45)) < 1e-4
printstyled("Running: chebyshev_quadrature with k=1\n"; color = :magenta)
@time @test chebyshev_quadrature(x -> (-19.6*sin(x))^(-0.5), 6, 1, -pi, 0) ellipk(1/2)/sqrt(2.45)
printstyled("Running: chebyshev_quadrature with k=2\n"; color = :magenta)
Expand Down Expand Up @@ -29,8 +31,6 @@ printstyled("Integrating 1/sqrt(-19.6 sin(x)) from -pi to 0 and comparing the re
@time @test abs(simpsons_rule(x -> (-19.6*sin(x))^(-0.5), 1e8, -pi+1e-8, -1e-8) - ellipk(1/2)/sqrt(2.45)) < 1e-4
printstyled("Running: simpsons38_rule on [-pi+1e-8, -1e-8]. Only a rough approximation can be realistically achieved with this function, due to the singularities.\n"; color = :magenta)
@time @test abs(simpsons38_rule(x -> (-19.6*sin(x))^(-0.5), 1e8+2, -pi+1e-8, -1e-8) - ellipk(1/2)/sqrt(2.45)) < 1e-4
printstyled("Running: adaptive_simpsons_rule on [-pi+1e-8, -1e-8]. Only a rough approximation can be realistically achieved with this function, due to the singularities.\n"; color = :magenta)
@time @test abs(adaptive_simpsons_rule(x -> (-19.6*sin(x))^(-0.5), -pi+1e-8, -1e-8, 1e-5) - ellipk(1/2)/sqrt(2.45)) < 1e-4
printstyled("Running: trapezoidal_rule on [-pi+1e-8, -1e-8]. Only a rough approximation can be realistically achieved with this function, due to the singularities.\n"; color = :magenta)
@time @test abs(trapezoidal_rule(x -> (-19.6*sin(x))^(-0.5), 1e8, -pi+1e-8, -1e-8) - ellipk(1/2)/sqrt(2.45)) < 1e-4
end
Loading

2 comments on commit c4c5156

@fusion809
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/17688

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.1 -m "<description of version>" c4c51561d5a92c74ad3043a2717c6f4e91f514c9
git push origin v0.4.1

Please sign in to comment.