Skip to content

Commit ad17102

Browse files
Merge pull request #71 from shahriariravanian/main
accept updated to allow for integration constants
2 parents b519369 + e31fe37 commit ad17102

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SymbolicNumericIntegration"
22
uuid = "78aadeae-fbc0-11eb-17b6-c7ec0477ba9e"
33
authors = ["Shahriar Iravanian <[email protected]>"]
4-
version = "1.3.0"
4+
version = "1.3.1"
55

66
[deps]
77
DataDrivenDiffEq = "2445eb08-9709-466a-b3fc-47e12bd697a2"

src/symbolic.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,18 @@ end
262262
# returns true if sol solves the integration problem represented by prob
263263
function accept(prob, sol)
264264
if sol != nothing
265-
ε = accept_solution(prob.eq, prob.x, sol; prob.plan)
266-
return ε < prob.plan.abstol
265+
ε1 = accept_solution(prob.eq, prob.x, sol; prob.plan)
266+
267+
if ε1 < prob.plan.abstol
268+
return true
269+
end
270+
271+
ε2 = accept_solution(prob.eq, prob.x, sol; prob.plan)
272+
273+
# accept if integrals differ by a constant
274+
if abs(ε1 - ε2) < prob.plan.abstol
275+
return true
276+
end
267277
end
268278
return false
269279
end

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ sym_integrals = [
214214
# Basic Forms
215215
a * x^2,
216216
a * x + b * x^2 - c * x^3,
217+
(3(x^2) + 3(a^2) - 4) / (4 * a * b),
217218
a / x,
218219
1 / (a * x + 5),
219220
1 / (x + a),

0 commit comments

Comments
 (0)