Skip to content

Commit b228ada

Browse files
Merge pull request #67 from shahriariravanian/main
update to ver 1.3
2 parents a592093 + 07e03a6 commit b228ada

17 files changed

+599
-681
lines changed

Diff for: Project.toml

+1-3
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.0"
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"

Diff for: README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ the documentation, which contains the unreleased features.
2121
## Example
2222

2323
```julia
24-
julia> using SymbolicNumericIntegration
25-
julia> using Symbolics
24+
using Symbolics
25+
using SymbolicNumericIntegration
2626

27-
julia> @variables x a b
27+
@variables x a b
2828

29-
julia> integrate(3x^3 + 2x - 5)
30-
(x^2 + (3//4)*(x^4) - (5//1)*x, 0, 0)
29+
integrate(3x^3 + 2x - 5)
30+
(x^2 + (3 // 4) * (x^4) - (5 // 1) * x, 0, 0)
3131

32-
julia> integrate(exp(a * x), x; symbolic = true)
33-
(exp(a*x) / a, 0, 0)
32+
integrate(exp(a * x), x; symbolic = true)
33+
(exp(a * x) / a, 0, 0)
3434

35-
julia> integrate(sin(a * x) * cos(b * x), x; symbolic = true, detailed = false)
36-
(-a*cos(a*x)*cos(b*x) - b*sin(a*x)*sin(b*x)) / (a^2 - (b^2))
35+
integrate(sin(a * x) * cos(b * x), x; symbolic = true, detailed = false)
36+
(-a * cos(a * x) * cos(b * x) - b * sin(a * x) * sin(b * x)) / (a^2 - (b^2))
3737
```
3838

3939
# Citation
@@ -43,7 +43,7 @@ If you use SymbolicNumericIntegration.jl in your research, please cite [this pap
4343
```
4444
4545
@article{Iravanian2022,
46-
author = {Shahriar Iravanian and Carl Julius Martensen and Alessandro Cheli and Shashi Gowda and Anand Jain and Julia Computing and Yingbo Ma and Chris Rackauckas},
46+
author = {Shahriar Iravanian and Carl Julius Martensen and Alessandro Cheli and Shashi Gowda and Anand Jain and Yingbo Ma and Chris Rackauckas},
4747
doi = {10.48550/arxiv.2201.12468},
4848
month = {1},
4949
title = {Symbolic-Numeric Integration of Univariate Expressions based on Sparse Regression},

Diff for: docs/make.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ makedocs(sitename = "SymbolicNumericIntegration.jl",
99
authors = "Shahriar Iravanian",
1010
modules = [SymbolicNumericIntegration],
1111
clean = true, doctest = false, linkcheck = true,
12-
warnonly = [:missing_docs],
12+
# warnonly = [:missing_docs],
1313
format = Documenter.HTML(assets = ["assets/favicon.ico"],
1414
canonical = "https://docs.sciml.ai/SymbolicNumericIntegration/stable/"),
1515
pages = pages)

Diff for: docs/src/index.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -22,53 +22,53 @@ Pkg.add("SymbolicNumericIntegration")
2222
Examples:
2323

2424
```julia
25-
julia> using SymbolicNumericIntegration
26-
julia> using Symbolics
25+
using Symbolics
26+
using SymbolicNumericIntegration
2727

28-
julia> @variables x a b
28+
@variables x a b
2929

3030
# if `detailed = true` (default), the output is a tuple of (solution, unsolved portion, err)
3131

32-
julia> integrate(3x^3 + 2x - 5)
33-
(x^2 + (3//4)*(x^4) - (5x), 0, 0)
32+
integrate(3x^3 + 2x - 5)
33+
(x^2 + (3 // 4) * (x^4) - (5x), 0, 0)
3434

35-
julia> integrate((5 + 2x)^-1)
36-
((1//2)*log((5//2) + x), 0, 0.0)
35+
integrate((5 + 2x)^-1)
36+
((1 // 2) * log((5 // 2) + x), 0, 0.0)
3737

3838
# `detailed = false` simplifies the output to just the resulting integral
3939

40-
julia> integrate(x^2 / (16 + x^2); detailed = false)
41-
x + 4atan((-1//4)*x)
40+
integrate(x^2 / (16 + x^2); detailed = false)
41+
x + 4atan((-1 // 4) * x)
4242

43-
julia> integrate(x^2 * log(x); detailed = false)
44-
(1//3)*(x^3)*log(x) - (1//9)*(x^3)
43+
integrate(x^2 * log(x); detailed = false)
44+
(1 // 3) * (x^3) * log(x) - (1 // 9) * (x^3)
4545

46-
julia> integrate(sec(x) * tan(x); detailed = false)
46+
integrate(sec(x) * tan(x); detailed = false)
4747
sec(x)
4848

4949
# Symbolic integration. Here, a is a symbolic constant; therefore, we need
5050
# to explicitly define the independent variable (say, x). Also, we set
5151
# `symbolic = true` to force using the symbolic solver
5252

53-
julia> integrate(sin(a * x), x; detailed = false, symbolic = true)
54-
(-cos(a*x)) / a
53+
integrate(sin(a * x), x; detailed = false, symbolic = true)
54+
(-cos(a * x)) / a
5555

56-
julia> integrate(x^2 * cos(a * x), x; detailed = false, symbolic = true)
57-
((a^2)*(x^2)*sin(a*x) + 2.0a*x*cos(a*x) - 2.0sin(a*x)) / (a^3)
56+
integrate(x^2 * cos(a * x), x; detailed = false, symbolic = true)
57+
((a^2) * (x^2) * sin(a * x) + 2.0a * x * cos(a * x) - 2.0sin(a * x)) / (a^3)
5858

59-
julia> integrate(log(log(a * x)) / x, x; detailed = false, symbolic = true)
60-
log(a*x)*log(log(a*x)) - log(a*x)
59+
integrate(log(log(a * x)) / x, x; detailed = false, symbolic = true)
60+
log(a * x) * log(log(a * x)) - log(a * x)
6161

6262
# multiple symbolic constants
6363

64-
julia> integrate(cosh(a * x) * exp(b * x), x; detailed = false, symbolic = true)
65-
(a*sinh(a*x)*exp(b*x) - b*cosh(a*x)*exp(b*x)) / (a^2 - (b^2))
64+
integrate(cosh(a * x) * exp(b * x), x; detailed = false, symbolic = true)
65+
(a * sinh(a * x) * exp(b * x) - b * cosh(a * x) * exp(b * x)) / (a^2 - (b^2))
6666

6767
# definite integration, passing a tuple of (x, lower bound, higher bound) in the
6868
# second argument
6969

70-
julia> integrate(x * sin(a * x), (x, 0, 1); symbolic = true, detailed = false)
71-
(sin(a) - a*cos(a)) / (a^2)
70+
integrate(x * sin(a * x), (x, 0, 1); symbolic = true, detailed = false)
71+
(sin(a) - a * cos(a)) / (a^2)
7272
```
7373

7474
SymbolicNumericIntegration.jl exports some special integral functions (defined over Complex numbers) and uses them in solving integrals:
@@ -81,13 +81,13 @@ SymbolicNumericIntegration.jl exports some special integral functions (defined o
8181
For examples:
8282

8383
```julia
84-
julia> integrate(exp(x + 1) / (x + 1))
84+
integrate(exp(x + 1) / (x + 1))
8585
(SymbolicNumericIntegration.Ei(1 + x), 0, 0.0)
8686

87-
julia> integrate(x * cos(a*x^2 - 1) / (a*x^2 - 1), x; detailed=false, symbolic=true)
88-
((1//2)*SymbolicNumericIntegration.Ci(a*(x^2) - 1)) / a
87+
integrate(x * cos(a * x^2 - 1) / (a * x^2 - 1), x; detailed = false, symbolic = true)
88+
((1 // 2) * SymbolicNumericIntegration.Ci(a * (x^2) - 1)) / a
8989

90-
julia> integrate(1 / (x*log(log(x))), x; detailed=false, symbolic=true)
90+
integrate(1 / (x * log(log(x))), x; detailed = false, symbolic = true)
9191
SymbolicNumericIntegration.Li(log(x))
9292
```
9393

@@ -213,4 +213,4 @@ file and the
213213
[project]($link_project)
214214
file.
215215
""")
216-
```
216+
```

Diff for: src/SymbolicNumericIntegration.jl

+12-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@ module SymbolicNumericIntegration
33
using SymbolicUtils
44
using SymbolicUtils: istree, operation, arguments
55
using Symbolics
6-
using Symbolics: value, get_variables, expand_derivatives
6+
using Symbolics: value, get_variables, expand_derivatives, coeff, Equation
77
using SymbolicUtils.Rewriters
88
using SymbolicUtils: exprtype, BasicSymbolic
99

1010
using DataDrivenDiffEq, DataDrivenSparse
1111

12+
struct NumericalPlan
13+
abstol::Float64
14+
radius::Float64
15+
complex_plane::Bool
16+
opt::DataDrivenDiffEq.AbstractDataDrivenAlgorithm
17+
end
18+
19+
default_plan() = NumericalPlan(1e-6, 5.0, true, STLSQ(exp.(-10:1:0)))
20+
1221
include("utils.jl")
1322
include("tree.jl")
1423
include("special.jl")
@@ -24,10 +33,10 @@ export Ei, Si, Ci, Li
2433

2534
include("numeric_utils.jl")
2635
include("sparse.jl")
27-
include("optim.jl")
36+
# include("optim.jl")
2837
include("integral.jl")
2938

30-
export integrate, generate_basis
39+
export integrate, generate_basis, best_hints
3140

3241
include("symbolic.jl")
3342

Diff for: src/candidates.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using DataStructures
22

3-
# this is the main heurisctic used to find the test fragments
3+
# this is the old heurisctic used to find the test fragments
44
function generate_basis(eq, x, try_kernel = true)
55
if !try_kernel
66
S = sum(generate_homotopy(expr(eq), x))

0 commit comments

Comments
 (0)