diff --git a/src/methods/rule_based/rules2/8 Special functions/8.1 Bessel functions.jl b/src/methods/rule_based/rules2/8 Special functions/8.1 Bessel functions.jl index 7072ddf..34c3fa5 100644 --- a/src/methods/rule_based/rules2/8 Special functions/8.1 Bessel functions.jl +++ b/src/methods/rule_based/rules2/8 Special functions/8.1 Bessel functions.jl @@ -1,6 +1,13 @@ file_rules = [ #(* ::Subsection::Closed:: *) #(* 8.1 Bessel functions *) + ("8_1_0", + :(*(~~a)) => :( + let + terms = distribute_special_function_product(arguments(~a), ~x) + terms === nothing ? nothing : sum(map(term -> ∫(term, ~x), terms)) + end + )) ( "8_1_1", diff --git a/src/methods/rule_based/rules2/9 Miscellaneous/0.1 Integrand simplification rules.jl b/src/methods/rule_based/rules2/9 Miscellaneous/0.1 Integrand simplification rules.jl index 98c5279..49ba6c7 100644 --- a/src/methods/rule_based/rules2/9 Miscellaneous/0.1 Integrand simplification rules.jl +++ b/src/methods/rule_based/rules2/9 Miscellaneous/0.1 Integrand simplification rules.jl @@ -1,14 +1,7 @@ file_rules = [ +# 0_1_0: integral of the sum is sum of the integrals ("0_1_0", :(+(~~a)) => :(sum(map(f -> ∫(f,~x), arguments(~a)))) ) -("0_1_1", -:(*(~~a)) => :( -let - terms = distribute_special_function_product(arguments(~a), ~x) - terms === nothing ? nothing : sum(map(term -> ∫(term, ~x), terms)) -end -)) - ("0_1_6", :((~!u)*((~!a)*(~v) + (~!b)*(~v) + (~!w))^(~!p)) => :( !contains_var((~a), (~b), (~x)) && @@ -28,6 +21,7 @@ end !contains_var((~a), (~x)) ? (~a)*(~x) : nothing)) +# constants out of the integral ("0_1_12", :(*(~~a)) => :( let diff --git a/test/methods/rule_based/test_rule2.jl b/test/methods/rule_based/test_rule2.jl index cbab46e..5231213 100644 --- a/test/methods/rule_based/test_rule2.jl +++ b/test/methods/rule_based/test_rule2.jl @@ -47,7 +47,8 @@ end @test eq(SymbolicIntegration.rule2(r, 1/exp(x)), -x) end -@testset "special functions in rules" begin +# This testset is for functions that are shorthand notation for powers, like exp and sqrt +@testset "power shorthand functions in rules" begin @syms x rs = :(sqrt(~x)) => :(~x) @test eq(SymbolicIntegration.rule2(rs, sqrt(x)), x) @@ -55,19 +56,6 @@ end rs = :(exp(~x)) => :(~x) @test eq(SymbolicIntegration.rule2(rs, exp(x+1)), x+1) @test eq(SymbolicIntegration.rule2(rs, ℯ^x), x) - - rbj = :(besselj(~nu, ~z)) => :(~nu, ~z) - besselj_match = SymbolicUtils.arguments(SymbolicIntegration.rule2(rbj, SpecialFunctions.besselj(0, x))) - @test SymbolicUtils.unwrap_const(besselj_match[1]) == 0 - @test isequal(besselj_match[2], x) - - rbi = :(besseli(~nu, ~z)) => :(~nu, ~z) - besseli_match = SymbolicUtils.arguments(SymbolicIntegration.rule2(rbi, SpecialFunctions.besseli(1, x))) - @test SymbolicUtils.unwrap_const(besseli_match[1]) == 1 - @test isequal(besseli_match[2], x) - - rai = :(airyai(~z)) => :(~z) - @test eq(SymbolicIntegration.rule2(rai, SpecialFunctions.airyai(x)), x) end @testset "Segment" begin diff --git a/test/methods/rule_based/test_special_functions.jl b/test/methods/rule_based/test_special_functions.jl index 6788fb6..3fa5229 100644 --- a/test/methods/rule_based/test_special_functions.jl +++ b/test/methods/rule_based/test_special_functions.jl @@ -3,6 +3,9 @@ using SymbolicIntegration using SpecialFunctions using Symbolics +# TODO move these tests to rundifficulttests.jl together with all the other integrals +# putting all the integrals in a test files with the solutions + @testset "RuleBased special-function integrals" begin @variables x a method = RuleBasedMethod()