Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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)) &&
Expand All @@ -28,6 +21,7 @@ end
!contains_var((~a), (~x)) ?
(~a)*(~x) : nothing))

# constants out of the integral
("0_1_12",
:(*(~~a)) => :(
let
Expand Down
16 changes: 2 additions & 14 deletions test/methods/rule_based/test_rule2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,15 @@ 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)
@test eq(SymbolicIntegration.rule2(rs, x^(1//2)), x)
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
Expand Down
3 changes: 3 additions & 0 deletions test/methods/rule_based/test_special_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading