Skip to content

Commit 7558b18

Browse files
format
1 parent f7a60d9 commit 7558b18

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ To perform one-dimensional quadrature, we can simply construct an `IntegralProbl
3131
into the problem as the fourth argument of `IntegralProblem`.
3232

3333
```julia
34-
using Integrals
35-
f(x, p) = sin(x*p)
34+
using Integrals
35+
f(x, p) = sin(x * p)
3636
p = 1.7
3737
prob = IntegralProblem(f, -2, 5, p)
3838
sol = solve(prob, QuadGKJL())
3939
```
4040

41-
For basic multidimensional quadrature we can construct and solve a `IntegralProblem`. Since we are using no arguments `p` in this example, we omit the fourth argument of `IntegralProblem`
41+
For basic multidimensional quadrature we can construct and solve a `IntegralProblem`. Since we are using no arguments `p` in this example, we omit the fourth argument of `IntegralProblem`
4242
from above. The lower and upper bounds are now passed as vectors, with the `i`th elements of
4343
the bounds giving the interval of integration for `x[i]`.
4444

ext/IntegralsFastGaussQuadratureExt.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ function Integrals.__solvebp_call(prob::IntegralProblem, alg::Integrals.GaussLeg
4848
err = nothing
4949
SciMLBase.build_solution(prob, alg, val, err, retcode = ReturnCode.Success)
5050
end
51-
end
51+
end

src/algorithms.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ function GaussLegendre(; n = 250, subintervals = 1, nodes = nothing, weights = n
121121
nodes, weights = gausslegendre(n)
122122
end
123123
return GaussLegendre(nodes, weights, subintervals)
124-
end
124+
end

test/gaussian_quadrature_tests.jl

+14-14
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,36 @@ alg = GaussLegendre(subintervals = 7)
5959
sol = solve(prob, alg)
6060
@test sol.u -exp(3) * 3.3 + 3.3 / exp(5) - 40 + cos(5) - cos(3)
6161

62-
f = (x, p) -> exp(-x^2)
62+
f = (x, p) -> exp(-x^2)
6363
prob = IntegralProblem(f, 0.0, Inf)
6464
alg = GaussLegendre()
6565
sol = solve(prob, alg)
66-
@test sol.u sqrt(π)/2
67-
alg = GaussLegendre(subintervals=1)
68-
@test sol.u sqrt(π)/2
69-
alg = GaussLegendre(subintervals=17)
70-
@test sol.u sqrt(π)/2
66+
@test sol.u sqrt(π) / 2
67+
alg = GaussLegendre(subintervals = 1)
68+
@test sol.u sqrt(π) / 2
69+
alg = GaussLegendre(subintervals = 17)
70+
@test sol.u sqrt(π) / 2
7171

7272
prob = IntegralProblem(f, -Inf, Inf)
7373
alg = GaussLegendre()
7474
sol = solve(prob, alg)
7575
@test sol.u sqrt(π)
76-
alg = GaussLegendre(subintervals=1)
76+
alg = GaussLegendre(subintervals = 1)
7777
@test sol.u sqrt(π)
78-
alg = GaussLegendre(subintervals=17)
78+
alg = GaussLegendre(subintervals = 17)
7979
@test sol.u sqrt(π)
8080

8181
prob = IntegralProblem(f, -Inf, 0.0)
8282
alg = GaussLegendre()
8383
sol = solve(prob, alg)
84-
@test sol.u sqrt(π)/2
85-
alg = GaussLegendre(subintervals=1)
86-
@test sol.u sqrt(π)/2
87-
alg = GaussLegendre(subintervals=17)
88-
@test sol.u sqrt(π)/2
84+
@test sol.u sqrt(π) / 2
85+
alg = GaussLegendre(subintervals = 1)
86+
@test sol.u sqrt(π) / 2
87+
alg = GaussLegendre(subintervals = 17)
88+
@test sol.u sqrt(π) / 2
8989

9090
# Make sure broadcasting correctly handles the argument p
91-
f = (x, p) -> 1 + x + x^p[1] - cos(x*p[2]) + exp(x)*p[3]
91+
f = (x, p) -> 1 + x + x^p[1] - cos(x * p[2]) + exp(x) * p[3]
9292
p = [0.3, 1.3, -0.5]
9393
prob = IntegralProblem(f, 2, 6.3, p)
9494
alg = GaussLegendre()

0 commit comments

Comments
 (0)