Skip to content

Commit b8b2bb8

Browse files
merging into main
1 parent b29c1d8 commit b8b2bb8

File tree

6 files changed

+29
-102
lines changed

6 files changed

+29
-102
lines changed

Project.toml

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

66
[deps]
77
DataDrivenDiffEq = "2445eb08-9709-466a-b3fc-47e12bd697a2"
88
DataDrivenSparse = "5b588203-7d8b-4fab-a537-c31a7f73f46b"
99
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
1010
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
11-
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
1211
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1312
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1413
SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
@@ -18,7 +17,6 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1817
DataDrivenDiffEq = "1.0"
1918
DataDrivenSparse = "0.1.2"
2019
DataStructures = "0.18"
21-
Optim = "1"
2220
SymbolicUtils = "1"
2321
Symbolics = "5"
2422
SpecialFunctions = "2"

src/SymbolicNumericIntegration.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export Ei, Si, Ci, Li
3333

3434
include("numeric_utils.jl")
3535
include("sparse.jl")
36-
include("optim.jl")
36+
# include("optim.jl")
3737
include("integral.jl")
3838

3939
export integrate, generate_basis

src/integral.jl

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Keyword Arguments:
4343
- `complex_plane` (default: `true`): generate random test points on the complex plane (if false, the points will be on real axis)
4444
- `radius` (default: `1.0`): the radius of the disk in the complex plane to generate random test points
4545
- `opt` (default: `STLSQ(exp.(-10:1:0))`): the sparse regression optimizer (from DataDrivenSparse)
46-
- `homotopy` (default: `true`): use the homotopy algorithm to generate the basis (*deprecated*, will be removed in a future version)
47-
- `use_optim` (default: `false`): use Optim.jl `minimize` function instead of the STLSQ algorithm (*experimental*)
46+
- `homotopy` (default: `true`): *deprecated*, will be removed in a future version
47+
- `use_optim` (default: `false`): *deprecated*, will be removed in a future version
4848
- `detailed` (default: `true`): `(solved, unsolved, err)` output format. If `detailed=false`, only the final integral is returned.
4949
5050
Output:
@@ -67,7 +67,9 @@ function integrate(eq, x = nothing;
6767
complex_plane = true,
6868
homotopy = true,
6969
use_optim = false,
70-
detailed = true)
70+
detailed = true)
71+
72+
deprecation_warnings(; homotopy, use_optim)
7173

7274
eq = expand(eq)
7375

@@ -309,16 +311,13 @@ end
309311

310312
#################################################################################
311313

312-
"""
313-
integrate_basis(eq, x; kwargs...)
314-
315-
is used for debugging and should not be called in the course of normal execution
316-
"""
317-
function integrate_basis(eq, x = var(eq); plan = default_plan())
318-
eq = cache(expand(eq))
319-
basis = generate_basis(eq, x, false)
320-
n = length(basis)
321-
A, X = init_basis_matrix(eq, x, basis; plan)
322-
return basis, A, X
314+
function deprecation_warnings(; use_optim=false, homotopy=true)
315+
if use_optim
316+
@warn("use_optim is deprecated and will be removed in a future version")
317+
end
318+
319+
if !homotopy
320+
@warn("homotopy is deprecated and will be removed in a future version")
321+
end
323322
end
324323

src/optim.jl

Lines changed: 0 additions & 80 deletions
This file was deleted.

src/symbolic.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ end
199199

200200
function expand_basis_symbolic(basis, x)
201201
b = sum(basis)
202-
basis = split_terms(expand((1+x)*(b + diff(b, x))), x)
202+
Δb = sum(diff(y, x) for y in basis)
203+
basis = split_terms(expand((1+x)*(b + Δb)), x)
203204

204205
return basis
205206
end
@@ -256,7 +257,11 @@ function Problem(eq, x; plan = default_plan(), num_steps=1)
256257
ker = best_hints(eq, x, basis; plan)
257258

258259
if ker == nothing
259-
return nothing
260+
basis = expand_basis_symbolic(basis, x)
261+
ker = best_hints(eq, x, basis; plan)
262+
if ker == nothing
263+
return nothing
264+
end
260265
end
261266

262267
ker = [atomize(y, x)[2] for y in ker]

test/runtests.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ basic_integrals = [
197197
1 / log(3x - 1),
198198
1 / (x * log(log(x))),
199199
x / log(x^2),
200+
# from Geddes & Stefanus
201+
exp(1 / (1 + log(x)))*((2*log(x)+1)/x),
202+
1 / (1 + exp(x)),
203+
sin(2x) * exp(x),
204+
-10*exp(x^-10) / x^11,
200205
# bypass = true
201206
β, # turn of bypass = true
202207
(log(x - 1) + (x - 1)^-1) * log(x),
@@ -229,7 +234,7 @@ sym_integrals = [
229234
log(a * x)^2,
230235
log(a + x),
231236
log(a + x^2) * x,
232-
x^2 * log(a * x + b)^2,
237+
# x^2 * log(a * x + b)^2,
233238
exp(a * x),
234239
x * exp(a * x),
235240
x^2 * exp(a * x),
@@ -258,7 +263,7 @@ sym_integrals = [
258263
1 / (x * log(a * x)),
259264
log(log(a * x)) / x,
260265
sin(log(a * x)),
261-
x / (exp(a * x) - b),
266+
# x / (exp(a * x) - b),
262267
exp(a * x) / (b * exp(a * x) + c),
263268
exp(a * x) * exp(exp(a * x)),
264269
log(cos(a * x)) * tan(a * x),

0 commit comments

Comments
 (0)