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
3 changes: 3 additions & 0 deletions src/methods/rule_based/general.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,7 @@ all_rules_paths = [
"7 Inverse hyperbolic functions/7.3 Inverse hyperbolic tangent/7.3.3 (d+e x)^m (a+b arctanh(c x^n))^p.jl"

"8 Special functions/8.1 Bessel functions.jl"
"8 Special functions/8.2 Airy functions.jl"
"8 Special functions/8.3 Error and exponential integral functions.jl"
"8 Special functions/8.4 Trigonometric integral functions.jl"
]
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,48 @@ file_rules = [
),
)

(
"8_1_9",
:((~x)^(~!nu) * hankelh1((~!mu), (~!a) * (~x))) => :(
!contains_var((~a), (~mu), (~nu), (~x)) &&
eq((~mu), (~nu) - 1) &&
!eq((~a), 0) ?
(~x)^(~nu) * SpecialFunctions.hankelh1((~nu), (~a) * (~x)) ⨸ (~a) : nothing
),
)

(
"8_1_10",
:((~x)^(~!nu) * hankelh2((~!mu), (~!a) * (~x))) => :(
!contains_var((~a), (~mu), (~nu), (~x)) &&
eq((~mu), (~nu) - 1) &&
!eq((~a), 0) ?
(~x)^(~nu) * SpecialFunctions.hankelh2((~nu), (~a) * (~x)) ⨸ (~a) : nothing
),
)

(
"8_1_11",
:((~x)^(~!m) * hankelh1((~!nu), (~!a) * (~x))) => :(
!contains_var((~a), (~m), (~nu), (~x)) &&
igt(simplify((~m) - (~nu) - 1), 0) &&
ext_iseven(simplify((~m) - (~nu) - 1)) &&
!eq((~a), 0) ?
(~x)^(~m) * SpecialFunctions.hankelh1((~nu) + 1, (~a) * (~x)) ⨸ (~a) -
simplify((~m) - (~nu) - 1) ⨸ (~a) * ∫((~x)^((~m) - 1) * SpecialFunctions.hankelh1((~nu) + 1, (~a) * (~x)), (~x)) : nothing
),
)

(
"8_1_12",
:((~x)^(~!m) * hankelh2((~!nu), (~!a) * (~x))) => :(
!contains_var((~a), (~m), (~nu), (~x)) &&
igt(simplify((~m) - (~nu) - 1), 0) &&
ext_iseven(simplify((~m) - (~nu) - 1)) &&
!eq((~a), 0) ?
(~x)^(~m) * SpecialFunctions.hankelh2((~nu) + 1, (~a) * (~x)) ⨸ (~a) -
simplify((~m) - (~nu) - 1) ⨸ (~a) * ∫((~x)^((~m) - 1) * SpecialFunctions.hankelh2((~nu) + 1, (~a) * (~x)), (~x)) : nothing
),
)

]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
file_rules = [
#(* ::Subsection::Closed:: *)
#(* 8.2 Airy functions *)

(
"8_2_1",
:(airyaiprime((~!a) + (~!b) * (~x))) => :(
!contains_var((~a), (~b), (~x)) &&
!eq((~b), 0) ?
SpecialFunctions.airyai((~a) + (~b) * (~x)) ⨸ (~b) : nothing
),
)

(
"8_2_2",
:(airybiprime((~!a) + (~!b) * (~x))) => :(
!contains_var((~a), (~b), (~x)) &&
!eq((~b), 0) ?
SpecialFunctions.airybi((~a) + (~b) * (~x)) ⨸ (~b) : nothing
),
)

(
"8_2_3",
:((~x) * airyai(~x)) => :(
SpecialFunctions.airyaiprime(~x)
),
)

(
"8_2_4",
:((~x) * airybi(~x)) => :(
SpecialFunctions.airybiprime(~x)
),
)

]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
file_rules = [
#(* ::Subsection::Closed:: *)
#(* 8.3 Error and exponential integral functions *)

(
"8_3_1",
:(erf((~!a) + (~!b) * (~x))) => :(
!contains_var((~a), (~b), (~x)) &&
!eq((~b), 0) ?
(((~a) + (~b) * (~x)) * SymbolicUtils.erf((~a) + (~b) * (~x)) +
exp(-((~a) + (~b) * (~x))^2) ⨸ sqrt(π)) ⨸ (~b) : nothing
),
)

(
"8_3_2",
:(erfi((~!a) + (~!b) * (~x))) => :(
!contains_var((~a), (~b), (~x)) &&
!eq((~b), 0) ?
(((~a) + (~b) * (~x)) * SymbolicUtils.erfi((~a) + (~b) * (~x)) -
exp(((~a) + (~b) * (~x))^2) ⨸ sqrt(π)) ⨸ (~b) : nothing
),
)

(
"8_3_3",
:(expinti((~!a) + (~!b) * (~x))) => :(
!contains_var((~a), (~b), (~x)) &&
!eq((~b), 0) ?
(((~a) + (~b) * (~x)) * SymbolicUtils.expinti((~a) + (~b) * (~x)) -
exp((~a) + (~b) * (~x))) ⨸ (~b) : nothing
),
)

]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
file_rules = [
#(* ::Subsection::Closed:: *)
#(* 8.4 Trigonometric integral functions *)

(
"8_4_1",
:(sinint((~!a) + (~!b) * (~x))) => :(
!contains_var((~a), (~b), (~x)) &&
!eq((~b), 0) ?
(((~a) + (~b) * (~x)) * SymbolicUtils.sinint((~a) + (~b) * (~x)) +
cos((~a) + (~b) * (~x))) ⨸ (~b) : nothing
),
)

(
"8_4_2",
:(cosint((~!a) + (~!b) * (~x))) => :(
!contains_var((~a), (~b), (~x)) &&
!eq((~b), 0) ?
(((~a) + (~b) * (~x)) * SymbolicUtils.cosint((~a) + (~b) * (~x)) -
sin((~a) + (~b) * (~x))) ⨸ (~b) : nothing
),
)

]
50 changes: 48 additions & 2 deletions test/methods/rule_based/test_special_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ using Symbolics
)
@test isequal(
integrate((1 + x) * SpecialFunctions.airyai(x), x, method),
SymbolicIntegration.∫(SpecialFunctions.airyai(x), x) +
SymbolicIntegration.∫(x * SpecialFunctions.airyai(x), x),
SpecialFunctions.airyaiprime(x) +
SymbolicIntegration.∫(SpecialFunctions.airyai(x), x),
)
@test isequal(
integrate(x^3 * SpecialFunctions.besseli(0, a * x), x, method),
Expand All @@ -60,4 +60,50 @@ using Symbolics
-x^3 * SpecialFunctions.besselk(1, a * x) / a -
2 * x^2 * SpecialFunctions.besselk(2, a * x) / a^2,
)

@test isequal(
integrate(x * SpecialFunctions.hankelh1(0, a * x), x, method),
x * SpecialFunctions.hankelh1(1, a * x) / a,
)
@test isequal(
integrate(x^3 * SpecialFunctions.hankelh2(0, a * x), x, method),
x^3 * SpecialFunctions.hankelh2(1, a * x) / a -
2 * x^2 * SpecialFunctions.hankelh2(2, a * x) / a^2,
)
@test isequal(
integrate(SpecialFunctions.airyaiprime(a * x), x, method),
SpecialFunctions.airyai(a * x) / a,
)
@test isequal(
integrate(SpecialFunctions.airybiprime(a * x), x, method),
SpecialFunctions.airybi(a * x) / a,
)
@test isequal(
integrate(x * SpecialFunctions.airyai(x), x, method),
SpecialFunctions.airyaiprime(x),
)
@test isequal(
integrate(x * SpecialFunctions.airybi(x), x, method),
SpecialFunctions.airybiprime(x),
)
@test isequal(
integrate(SpecialFunctions.erf(a * x), x, method),
(exp(-(a^2) * (x^2)) / sqrt(π) + a * x * SpecialFunctions.erf(a * x)) / a,
)
@test isequal(
integrate(SpecialFunctions.erfi(a * x), x, method),
(a * x * SpecialFunctions.erfi(a * x) - exp((a^2) * (x^2)) / sqrt(π)) / a,
)
@test isequal(
integrate(SpecialFunctions.expinti(a * x), x, method),
(-exp(a * x) + a * x * SpecialFunctions.expinti(a * x)) / a,
)
@test isequal(
integrate(SpecialFunctions.sinint(a * x), x, method),
(cos(a * x) + a * x * SpecialFunctions.sinint(a * x)) / a,
)
@test isequal(
integrate(SpecialFunctions.cosint(a * x), x, method),
(-sin(a * x) + a * x * SpecialFunctions.cosint(a * x)) / a,
)
end
Loading