Skip to content

Commit 81826c2

Browse files
committed
implemented review suggestions
1 parent 35ce25f commit 81826c2

File tree

7 files changed

+17
-29
lines changed

7 files changed

+17
-29
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- uses: julia-actions/cache@v2
4040
- uses: julia-actions/julia-buildpkg@v1
4141
- name: Run tests julia 1.11 ubuntu-latest and count rules
42-
if: matrix.version == '1.11' && matrix.os == 'ubuntu-latest'
42+
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
4343
run: |
4444
julia --project=. -e "
4545
using SymbolicIntegration

src/SymbolicIntegration.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ __precompile__()
22

33
module SymbolicIntegration
44

5+
using Symbolics
6+
using SymbolicUtils # TODO is this import really needed?
7+
58
# Include Risch method algorithm components
69
include("methods/risch/general.jl")
710
include("methods/risch/rational_functions.jl")
@@ -15,12 +18,15 @@ include("methods/risch/algebraic_functions.jl")
1518
include("methods/risch/frontend.jl")
1619

1720
# include rule based method
21+
include("methods/rule_based/rules_loader.jl")
22+
include("methods/rule_based/frontend.jl")
23+
include("methods/rule_based/rules_utility_functions.jl")
1824
include("methods/rule_based/general.jl")
1925

2026
# Add method dispatch system
2127
include("methods.jl")
2228

2329
# Export method interface and integrate function
24-
export AbstractIntegrationMethod, RischMethod, RuleBasedMethod, integrate
30+
export AbstractIntegrationMethod, RischMethod, RuleBasedMethod, integrate, reload_rules
2531

2632
end # module

src/methods.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ No rule found for ∫(abs(x), x)
8989
function integrate(f::Symbolics.Num, x::Symbolics.Num; kwargs...)
9090
result = integrate_risch(f.val, x.val; kwargs...)
9191
!contains_int(result) && return result
92-
92+
93+
# TODO make them verbose?
9394
printstyled("\n > RischMethod(use_algebraic_closure=false, catch_errors=true) failed, returning $result \n";color=:red)
9495
printstyled(" > Trying with RuleBasedMethod(use_gamma=false, verbose=true)...\n\n"; color=:red)
9596
result = integrate_rule_based(f, x; kwargs...)
@@ -203,6 +204,10 @@ function integrate(f::Symbolics.Num, x::Symbolics.Num, method::RuleBasedMethod;
203204
verbose=method.verbose, use_gamma=method.use_gamma, kwargs...)
204205
end
205206

207+
<<<<<<< HEAD
208+
=======
209+
# integrate_rule_based(integrand::Number, x::Symbolics.Num; kwargs...) = integrand*x
210+
>>>>>>> 1e1e70a (implemented review suggestions)
206211

207212
"""
208213
method_supports_rational(method::RischMethod)

src/methods/risch/frontend.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Symbolics
2-
using SymbolicUtils
31
using Logging
42

53
"""

src/methods/rule_based/frontend.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ end
110110
function integrate_rule_based(integrand::Symbolics.Num, int_var::Symbolics.Num; use_gamma::Bool=false, verbose::Bool=true, kwargs...)
111111
global VERBOSE
112112
VERBOSE = verbose
113-
result = simplify(repeated_prewalk((integrand,int_var)))
114-
println()
115-
return result
113+
return simplify(repeated_prewalk((integrand,int_var)))
116114
end
117115

118116
integrate_rule_based(integrand::SymbolicUtils.BasicSymbolic{Real}, int_var::SymbolicUtils.BasicSymbolic{Real}; kwargs...) =

src/methods/rule_based/general.jl

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using Symbolics
2-
3-
4-
51
# ===== Special functions from a lot of packages
6-
# TODO maybe transform all these imports to package extensions? so they dont get imported if not needed?
2+
# TODO extension to Symbolics?
73

84
# function from SpecialFunctions.jl that are not yet registered
95
@register_symbolic SymbolicUtils.expinti(x)
@@ -53,21 +49,6 @@ coshintegral(x::Any) = println("hyperbolic cosine integral Chi(z) function (http
5349
@register_symbolic coshintegral(x)
5450

5551

56-
57-
58-
59-
# ===== Include and Exports
60-
61-
include("rules_loader.jl")
62-
include("frontend.jl")
63-
include("rules_utility_functions.jl")
64-
65-
export reload_rules
66-
67-
68-
69-
70-
7152
# ===== Global variables
7253
# symbolic functions
7354
# ∫(intgerand, intgeration variable)

src/methods/rule_based/rules_utility_functions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ function int_and_subst(integrand, int_var, from, to, rule_from_identifier)
433433
end
434434

435435
result = integrate_rule_based(integrand, int_var;verbose=VERBOSE)
436-
push!(SILENCE, rule_from_identifier)
436+
push!(SILENCE, rule_from_identifier) # this is needed to not print again rule_from_identifier after the return of this function
437437
if !contains_int(result)
438438
return substitute(result, from => to)
439439
end

0 commit comments

Comments
 (0)