Skip to content

Commit 672082b

Browse files
author
GitHub Actions
committed
Update Julia source
1 parent a3858b6 commit 672082b

File tree

6 files changed

+81
-16
lines changed

6 files changed

+81
-16
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TabulatedQuadratureRules"
22
uuid = "3da39775-d94e-428b-a709-24e9ab7fe27d"
33
authors = ["Matthew Scroggs"]
4-
version = "0.7.9"
4+
version = "0.9.0"
55

66
[compat]
77
julia = "1.6.7"

src/TabulatedQuadratureRules.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ include("hammer_marlowe_stroud.jl")
77
include("sauter_schwab.jl")
88
include("xiao_gimbutas.jl")
99
include("centroid_quadrature.jl")
10+
include("closed_newton_cotes.jl")
11+
include("open_newton_cotes.jl")
1012
include("vertex_quadrature.jl")
1113

1214
@enum QuadratureRule begin
@@ -16,6 +18,8 @@ include("vertex_quadrature.jl")
1618
QR_SauterSchwab = 7
1719
QR_XiaoGimbutas = 2
1820
QR_CentroidQuadrature = 5
21+
QR_ClosedNewtonCotes = 8
22+
QR_OpenNewtonCotes = 9
1923
QR_VertexQuadrature = 4
2024
end
2125

@@ -40,6 +44,12 @@ function single_integral_quadrature(
4044
if rtype == QR_CentroidQuadrature
4145
return centroid_quadrature(domain, order)
4246
end
47+
if rtype == QR_ClosedNewtonCotes
48+
return closed_newton_cotes(domain, order)
49+
end
50+
if rtype == QR_OpenNewtonCotes
51+
return open_newton_cotes(domain, order)
52+
end
4353
if rtype == QR_VertexQuadrature
4454
return vertex_quadrature(domain, order)
4555
end

src/closed_newton_cotes.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function closed_newton_cotes(
2+
domain::Domain,
3+
order::Integer,
4+
)
5+
if domain == Domain_Interval && order == 1
6+
return [[1.0, 0.0] [0.0, 1.0]], [0.5, 0.5]
7+
end
8+
if domain == Domain_Interval && order == 2
9+
return [[1.0, 0.0] [0.5, 0.5] [0.0, 1.0]], [0.16666666666666666, 0.6666666666666666, 0.16666666666666666]
10+
end
11+
if domain == Domain_Interval && order == 3
12+
return [[1.0, 0.0] [0.6666666666666666, 0.3333333333333333] [0.3333333333333333, 0.6666666666666666] [0.0, 1.0]], [0.125, 0.375, 0.375, 0.125]
13+
end
14+
if domain == Domain_Interval && order == 4
15+
return [[1.0, 0.0] [0.75, 0.25] [0.5, 0.5] [0.25, 0.75] [0.0, 1.0]], [0.07777777777777778, 0.35555555555555557, 0.13333333333333333, 0.35555555555555557, 0.07777777777777778]
16+
end
17+
if domain == Domain_Interval && order == 5
18+
return [[1.0, 0.0] [0.8, 0.2] [0.6, 0.4] [0.4, 0.6] [0.2, 0.8] [0.0, 1.0]], [0.06597222222222222, 0.2604166666666667, 0.1736111111111111, 0.1736111111111111, 0.2604166666666667, 0.06597222222222222]
19+
end
20+
if domain == Domain_Interval && order == 6
21+
return [[1.0, 0.0] [0.8333333333333334, 0.16666666666666666] [0.6666666666666667, 0.3333333333333333] [0.5, 0.5] [0.33333333333333337, 0.6666666666666666] [0.16666666666666663, 0.8333333333333334] [0.0, 1.0]], [0.04880952380952381, 0.2571428571428571, 0.03214285714285714, 0.3238095238095238, 0.03214285714285714, 0.2571428571428571, 0.04880952380952381]
22+
end
23+
throw("Invalid domain or order: ($domain, $order)")
24+
end
25+
26+
export closed_newton_cotes

src/gauss_lobatto_legendre.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function gauss_lobatto_legendre(
2121
return [[1.0, 0.0] [0.9151119481392833, 0.08488805186071663] [0.7344243967353571, 0.2655756032646429] [0.4999999999999998, 0.5000000000000002] [0.265575603264643, 0.734424396735357] [0.08488805186071657, 0.9151119481392834] [0.0, 1.0]], [0.02380952380952369, 0.13841302368078276, 0.21587269060493128, 0.24380952380952378, 0.2158726906049315, 0.1384130236807831, 0.023809523809523666]
2222
end
2323
if domain == Domain_Interval && order == 6
24-
return [[0.1, 0.0] [0.9358700742548034, 0.06412992574519655] [0.7958500907165712, 0.2041499092834288] [0.6046496089512394, 0.3953503910487606] [0.39535039104876035, 0.6046496089512396] [0.20414990928342858, 0.7958500907165714] [0.0641299257451966, 0.9358700742548034] [0.0, 1.0]], [0.017857142857142815, 0.10535211357175311, 0.17056134624175223, 0.20622939732935186, 0.20622939732935172, 0.17056134624175218, 0.10535211357175316, 0.01785714285714291]
24+
return [[1.0, 0.0] [0.9358700742548034, 0.06412992574519655] [0.7958500907165712, 0.2041499092834288] [0.6046496089512394, 0.3953503910487606] [0.39535039104876035, 0.6046496089512396] [0.20414990928342858, 0.7958500907165714] [0.0641299257451966, 0.9358700742548034] [0.0, 1.0]], [0.017857142857142815, 0.10535211357175311, 0.17056134624175223, 0.20622939732935186, 0.20622939732935172, 0.17056134624175218, 0.10535211357175316, 0.01785714285714291]
2525
end
2626
if domain == Domain_Interval && order == 7
2727
return [[1.0, 0.0] [0.9498789977057301, 0.050121002294269856] [0.8385931397553688, 0.16140686024463125] [0.6815587319130891, 0.3184412680869109] [0.5, 0.49999999999999994] [0.318441268086911, 0.681558731913089] [0.16140686024463102, 0.838593139755369] [0.050121002294269856, 0.9498789977057301] [0.0, 1.0]], [0.013888888888888826, 0.08274768078040293, 0.13726935625008083, 0.1732142554865229, 0.18575963718820857, 0.17321425548652275, 0.13726935625008096, 0.08274768078040268, 0.013888888888888928]

src/open_newton_cotes.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function open_newton_cotes(
2+
domain::Domain,
3+
order::Integer,
4+
)
5+
if domain == Domain_Interval && order == 0
6+
return [[0.5, 0.5]], [1.0]
7+
end
8+
if domain == Domain_Interval && order == 1
9+
return [[0.6666666666666667, 0.3333333333333333] [0.33333333333333337, 0.6666666666666666]], [0.5, 0.5]
10+
end
11+
if domain == Domain_Interval && order == 2
12+
return [[0.75, 0.25] [0.5, 0.5] [0.25, 0.75]], [0.6666666666666666, -0.3333333333333333, 0.6666666666666666]
13+
end
14+
if domain == Domain_Interval && order == 3
15+
return [[0.8, 0.2] [0.6, 0.4] [0.4, 0.6] [0.2, 0.8]], [0.4583333333333333, 0.041666666666666664, 0.041666666666666664, 0.4583333333333333]
16+
end
17+
if domain == Domain_Interval && order == 4
18+
return [[0.8333333333333334, 0.16666666666666666] [0.6666666666666667, 0.3333333333333333] [0.5, 0.5] [0.33333333333333337, 0.6666666666666666] [0.16666666666666663, 0.8333333333333334]], [0.55, -0.7, 1.3, -0.7, 0.55]
19+
end
20+
if domain == Domain_Interval && order == 5
21+
return [[0.8571428571428572, 0.14285714285714285] [0.7142857142857143, 0.2857142857142857] [0.5714285714285714, 0.42857142857142855] [0.4285714285714286, 0.5714285714285714] [0.2857142857142857, 0.7142857142857143] [0.1428571428571429, 0.8571428571428571]], [0.42430555555555555, -0.3145833333333333, 0.3902777777777778, 0.3902777777777778, -0.3145833333333333, 0.42430555555555555]
22+
end
23+
if domain == Domain_Interval && order == 6
24+
return [[0.875, 0.125] [0.75, 0.25] [0.625, 0.375] [0.5, 0.5] [0.375, 0.625] [0.25, 0.75] [0.125, 0.875]], [0.48677248677248675, -1.0095238095238095, 2.323809523809524, -2.602116402116402, 2.323809523809524, -1.0095238095238095, 0.48677248677248675]
25+
end
26+
throw("Invalid domain or order: ($domain, $order)")
27+
end
28+
29+
export open_newton_cotes

0 commit comments

Comments
 (0)