Skip to content

Commit e39039e

Browse files
fixing homotopy
1 parent 18999b3 commit e39039e

File tree

5 files changed

+155
-302
lines changed

5 files changed

+155
-302
lines changed

src/SymbolicNumericIntegration.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module SymbolicNumericIntegration
1+
# module SymbolicNumericIntegration
22

33
using SymbolicUtils
44
using SymbolicUtils: istree, operation, arguments
@@ -27,4 +27,4 @@ include("integration_by_parts.jl")
2727
include("logger.jl")
2828
include("prune.jl")
2929

30-
end # module
30+
# end # module

src/candidates.jl

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
using DataStructures
22

33
# this is the main heurisctic used to find the test fragments
4-
function generate_basis(eq, x)
4+
function generate_basis(eq, x; homotopy=false)
5+
if homotopy
6+
return generate_homotopy(eq, x)
7+
end
8+
59
eq = expand(eq)
610
S = Set{Any}()
711
for t in terms(eq)
812
q = t / coef(t, x)
913
f = kernel(q)
10-
C₁ = closure(f, x) # find_candidates(f, x)
11-
C₂ = find_candidates_nonsolvable(q * inverse(f), x)
12-
# C₂ = generate_by_parts(q * inverse(f), x)
14+
15+
C₁ = closure(f, x)
16+
p = q * inverse(f)
17+
18+
if homotopy
19+
if isdependent(p, x)
20+
C₂ = generate_homotopy2(p, x)
21+
else
22+
C₂ = 1
23+
end
24+
else
25+
C₂ = find_candidates_nonsolvable(p, x)
26+
end
1327

1428
for c₁ in C₁
1529
enqueue_expr_ex!(S, c₁, x)
@@ -28,6 +42,15 @@ function generate_basis(eq, x)
2842
return unique([one(x); [s for s in S]])
2943
end
3044

45+
function expand_basis(basis, x; homotopy=false)
46+
if homotopy
47+
I, deg = homotopy_integrand(sum(basis), x)
48+
return expand_integrand(I, x, deg)
49+
else
50+
return unique([basis; basis*x])
51+
end
52+
end
53+
3154
function closure(eq, x; max_terms=50)
3255
if !isdependent(eq, x) return [one(x)] end
3356
D = Differential(x)

0 commit comments

Comments
 (0)