diff --git a/dev/DCsOPF/index.html b/dev/DCsOPF/index.html index 72e760d..8b993fe 100644 --- a/dev/DCsOPF/index.html +++ b/dev/DCsOPF/index.html @@ -9,11 +9,11 @@ Nl, N = size(A, 1), size(A, 2) Bbr = diagm(0 => -(2 .+ 10 * rand(Nl))) # line parameters Ψ = [zeros(Nl) -Bbr * A[:, 2:end] * inv(A[:, 2:end]' * Bbr * A[:, 2:end])] # PTDF matrix
5×4 Matrix{Float64}:
- 0.0  -0.668271  -0.37715   -0.171734
- 0.0  -0.123812  -0.232467  -0.105853
- 0.0  -0.207917  -0.390383  -0.722413
- 0.0  -0.331729   0.37715    0.171734
- 0.0   0.207917   0.390383  -0.277587

Now we can continue the remaining ingredients that specify our systems:

Cp, Cd = [1 0; 0 0; 0 0; 0 1], [0 0; 1 0; 0 1; 0 0] # book-keeping
+ 0.0  -0.439936  -0.201744  -0.132798
+ 0.0  -0.439369  -0.62623   -0.412215
+ 0.0  -0.120695  -0.172025  -0.454987
+ 0.0  -0.560064   0.201744   0.132798
+ 0.0   0.120695   0.172025  -0.545013

Now we can continue the remaining ingredients that specify our systems:

Cp, Cd = [1 0; 0 0; 0 0; 0 1], [0 0; 1 0; 0 1; 0 0] # book-keeping
 Ng, Nd = size(Cp, 2), size(Cd, 2)
 c = 4 .+ 10 * rand(Ng) # cost function parameters
 λp, λl = 1.6 * ones(Ng), 1.6 * ones(Nl) # lambdas for chance constraint reformulations
@@ -43,4 +43,4 @@
             [1 / λl[i] * (mean(pl[1, :], mop) - plmin[i]); buildSOC(pl[i, :], mop)] in SecondOrderCone())
 @objective(model, Min, sum(mean(p[i, :], mop) * c[i] for i in 1:Ng))
 optimize!(model) # here we go

Let's extract the numerical values of the optimal solution.

@assert termination_status(model)==MOI.OPTIMAL "Model not solved to optimality."
-psol, plsol, obj = value.(p), value.(pl), objective_value(model)

Great, we've solved the problem. How do we now make sense of the solution? For instance, we can look at the moments of the generated power:

p_moments = [[mean(psol[i, :], mop) var(psol[i, :], mop)] for i in 1:Ng]

Similarly, we can study the moments for the branch flows:

pbr_moments = [[mean(plsol[i, :], mop) var(plsol[i, :], mop)] for i in 1:Nl]
+psol, plsol, obj = value.(p), value.(pl), objective_value(model)

Great, we've solved the problem. How do we now make sense of the solution? For instance, we can look at the moments of the generated power:

p_moments = [[mean(psol[i, :], mop) var(psol[i, :], mop)] for i in 1:Ng]

Similarly, we can study the moments for the branch flows:

pbr_moments = [[mean(plsol[i, :], mop) var(plsol[i, :], mop)] for i in 1:Nl]
diff --git a/dev/assets/Manifest.toml b/dev/assets/Manifest.toml index c9d3475..ca152fc 100644 --- a/dev/assets/Manifest.toml +++ b/dev/assets/Manifest.toml @@ -1,13 +1,13 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.9.4" +julia_version = "1.10.0" manifest_format = "2.0" project_hash = "bfa3dc9cd1ae3c23657e318ece8ae422441c2709" [[deps.ADTypes]] -git-tree-sha1 = "332e5d7baeff8497b923b730b994fa480601efc7" +git-tree-sha1 = "41c37aa88889c171f1300ceac1313c06e891d245" uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b" -version = "0.2.5" +version = "0.2.6" [[deps.ANSIColoredPrinters]] git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" @@ -33,25 +33,6 @@ git-tree-sha1 = "faa260e4cb5aba097a73fab382dd4b5819d8ec8c" uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" version = "0.4.4" -[[deps.Accessors]] -deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "LinearAlgebra", "MacroTools", "Test"] -git-tree-sha1 = "a7055b939deae2455aa8a67491e034f735dd08d3" -uuid = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" -version = "0.1.33" - - [deps.Accessors.extensions] - AccessorsAxisKeysExt = "AxisKeys" - AccessorsIntervalSetsExt = "IntervalSets" - AccessorsStaticArraysExt = "StaticArrays" - AccessorsStructArraysExt = "StructArrays" - - [deps.Accessors.weakdeps] - AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5" - IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953" - Requires = "ae029012-a4dd-5104-9daa-d747884805df" - StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" - StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" - [[deps.Adapt]] deps = ["LinearAlgebra", "Requires"] git-tree-sha1 = "cde29ddf7e5726c9fb511f340244ea3481267608" @@ -80,9 +61,9 @@ version = "0.2.0" [[deps.ArrayInterface]] deps = ["Adapt", "LinearAlgebra", "Requires", "SparseArrays", "SuiteSparse"] -git-tree-sha1 = "247efbccf92448be332d154d6ca56b9fcdd93c31" +git-tree-sha1 = "bbec08a37f8722786d87bedf84eae19c020c4efa" uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "7.6.1" +version = "7.7.0" [deps.ArrayInterface.extensions] ArrayInterfaceBandedMatricesExt = "BandedMatrices" @@ -102,9 +83,9 @@ version = "7.6.1" [[deps.ArrayLayouts]] deps = ["FillArrays", "LinearAlgebra"] -git-tree-sha1 = "b08a4043e1c14096ef8efe4dd97e07de5cacf240" +git-tree-sha1 = "6364e1f449627f9ca6ba9dd2e48527dd4a682a5e" uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" -version = "1.4.5" +version = "1.5.1" weakdeps = ["SparseArrays"] [deps.ArrayLayouts.extensions] @@ -261,16 +242,7 @@ weakdeps = ["Dates", "LinearAlgebra"] [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.5+0" - -[[deps.CompositionsBase]] -git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad" -uuid = "a33af91c-f02d-484b-be07-31d278c5ca2b" -version = "0.1.2" -weakdeps = ["InverseFunctions"] - - [deps.CompositionsBase.extensions] - CompositionsBaseInverseFunctionsExt = "InverseFunctions" +version = "1.0.5+1" [[deps.ConcreteStructs]] git-tree-sha1 = "f749037478283d372048690eb3b5f92a79432b34" @@ -315,9 +287,9 @@ version = "1.15.0" [[deps.DataStructures]] deps = ["Compat", "InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "3dbd312d370723b6bb43ba9d02fc36abade4518d" +git-tree-sha1 = "ac67408d9ddf207de5cfa9a97e114352430f01ed" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.18.15" +version = "0.18.16" [[deps.DataValueInterfaces]] git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" @@ -330,9 +302,9 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" [[deps.DelayDiffEq]] deps = ["ArrayInterface", "DataStructures", "DiffEqBase", "LinearAlgebra", "Logging", "OrdinaryDiffEq", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SimpleNonlinearSolve", "SimpleUnPack"] -git-tree-sha1 = "e40378efd2af7658d0a0579aa9e15b17137368f4" +git-tree-sha1 = "dd3dfeca90deb4b38be9598d7c51cd558816e596" uuid = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb" -version = "5.44.0" +version = "5.45.1" [[deps.DelimitedFiles]] deps = ["Mmap"] @@ -342,9 +314,9 @@ version = "1.9.1" [[deps.DiffEqBase]] deps = ["ArrayInterface", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "ForwardDiff", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PreallocationTools", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Static", "StaticArraysCore", "Statistics", "Tricks", "TruncatedStacktraces"] -git-tree-sha1 = "e2e4e794fb1f7d53acfd307473e6261c4ab7da2e" +git-tree-sha1 = "044648af911974c3928058c1f8c83f159dece274" uuid = "2b5f629d-d688-5b77-993f-72d75c75574e" -version = "6.144.0" +version = "6.145.6" [deps.DiffEqBase.extensions] DiffEqBaseChainRulesCoreExt = "ChainRulesCore" @@ -372,9 +344,9 @@ version = "6.144.0" [[deps.DiffEqCallbacks]] deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "Functors", "LinearAlgebra", "Markdown", "NLsolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"] -git-tree-sha1 = "d0b94b3694d55e7eedeee918e7daee9e3b873399" +git-tree-sha1 = "cf334da651a6e42c50e1477d6ab978f1b8be3057" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" -version = "2.35.0" +version = "2.36.1" weakdeps = ["OrdinaryDiffEq", "Sundials"] [[deps.DiffEqNoiseProcess]] @@ -403,9 +375,9 @@ version = "1.15.1" [[deps.DifferentialEquations]] deps = ["BoundaryValueDiffEq", "DelayDiffEq", "DiffEqBase", "DiffEqCallbacks", "DiffEqNoiseProcess", "JumpProcesses", "LinearAlgebra", "LinearSolve", "NonlinearSolve", "OrdinaryDiffEq", "Random", "RecursiveArrayTools", "Reexport", "SciMLBase", "SteadyStateDiffEq", "StochasticDiffEq", "Sundials"] -git-tree-sha1 = "19a5b6314715139ddefea4108a105bb9b90dc4fb" +git-tree-sha1 = "8864b6a953eeba7890d23258aca468d90ca73fd6" uuid = "0c46a032-eb83-5123-abaf-570d42b7fbaa" -version = "7.11.0" +version = "7.12.0" [[deps.Distances]] deps = ["LinearAlgebra", "Statistics", "StatsAPI"] @@ -427,9 +399,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[deps.Distributions]] deps = ["FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"] -git-tree-sha1 = "9242eec9b7e2e14f9952e8ea1c7e31a50501d587" +git-tree-sha1 = "a4532d110ce91bd744b99280193a317310960c46" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" -version = "0.25.104" +version = "0.25.106" [deps.Distributions.extensions] DistributionsChainRulesCoreExt = "ChainRulesCore" @@ -470,10 +442,13 @@ uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56" version = "1.0.4" [[deps.EnzymeCore]] -deps = ["Adapt"] -git-tree-sha1 = "2efe862de93cd87f620ad6ac9c9e3f83f1b2841b" +git-tree-sha1 = "59c44d8fbc651c0395d8a6eda64b05ce316f58b4" uuid = "f151be2c-9106-41f4-ab19-57ee4f262869" -version = "0.6.4" +version = "0.6.5" +weakdeps = ["Adapt"] + + [deps.EnzymeCore.extensions] + AdaptExt = "Adapt" [[deps.EpollShim_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -483,9 +458,9 @@ version = "0.0.20230411+0" [[deps.ExceptionUnwrapping]] deps = ["Test"] -git-tree-sha1 = "e90caa41f5a86296e014e148ee061bd6c3edec96" +git-tree-sha1 = "dcb08a0d93ec0b1cdc4af184b26b591e9695423a" uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4" -version = "0.1.9" +version = "0.1.10" [[deps.Expat_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -568,9 +543,9 @@ weakdeps = ["PDMats", "SparseArrays", "Statistics"] [[deps.FiniteDiff]] deps = ["ArrayInterface", "LinearAlgebra", "Requires", "Setfield", "SparseArrays"] -git-tree-sha1 = "c6e4a1fbe73b31a3dea94b1da449503b8830c306" +git-tree-sha1 = "73d1214fec245096717847c62d389a5d2ac86504" uuid = "6a86dc24-6348-571c-b903-95158fe2bd41" -version = "2.21.1" +version = "2.22.0" [deps.FiniteDiff.extensions] FiniteDiffBandedMatricesExt = "BandedMatrices" @@ -644,10 +619,10 @@ deps = ["Random"] uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" [[deps.GLFW_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Libglvnd_jll", "Pkg", "Xorg_libXcursor_jll", "Xorg_libXi_jll", "Xorg_libXinerama_jll", "Xorg_libXrandr_jll"] -git-tree-sha1 = "d972031d28c8c8d9d7b41a536ad7bb0c2579caca" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Libglvnd_jll", "Xorg_libXcursor_jll", "Xorg_libXi_jll", "Xorg_libXinerama_jll", "Xorg_libXrandr_jll"] +git-tree-sha1 = "ff38ba61beff76b8f4acad8ab0c97ef73bb670cb" uuid = "0656b61e-2033-5cc2-a64a-77c0f6c09b89" -version = "3.3.8+0" +version = "3.3.9+0" [[deps.GPUArraysCore]] deps = ["Adapt"] @@ -748,27 +723,16 @@ git-tree-sha1 = "ea8031dea4aff6bd41f1df8f2fdfb25b33626381" uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" version = "0.1.4" -[[deps.IntegerMathUtils]] -git-tree-sha1 = "b8ffb903da9f7b8cf695a8bead8e01814aa24b30" -uuid = "18e54dd8-cb9d-406c-a71d-865a43cbb235" -version = "0.1.2" - [[deps.IntelOpenMP_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "31d6adb719886d4e32e38197aae466e98881320b" +git-tree-sha1 = "5fdf2fe6724d8caabf43b557b84ce53f3b7e2f6b" uuid = "1d5cc7b8-4909-519e-a0f8-d0f5ad9712d0" -version = "2024.0.0+0" +version = "2024.0.2+0" [[deps.InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" -[[deps.InverseFunctions]] -deps = ["Test"] -git-tree-sha1 = "68772f49f54b479fa88ace904f6127f0a3bb2e46" -uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.12" - [[deps.IrrationalConstants]] git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" @@ -804,10 +768,10 @@ uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8" version = "3.0.1+0" [[deps.JuMP]] -deps = ["LinearAlgebra", "MacroTools", "MathOptInterface", "MutableArithmetics", "OrderedCollections", "Printf", "SnoopPrecompile", "SparseArrays"] -git-tree-sha1 = "cd161958e8b47f9696a6b03f563afb4e5fe8f703" +deps = ["LinearAlgebra", "MacroTools", "MathOptInterface", "MutableArithmetics", "OrderedCollections", "PrecompileTools", "Printf", "SparseArrays"] +git-tree-sha1 = "adef1dfbafeab635664fb3249b58be8d290ed49d" uuid = "4076af6c-e467-56ae-b986-b466b2749572" -version = "1.17.0" +version = "1.18.1" [deps.JuMP.extensions] JuMPDimensionalDataExt = "DimensionalData" @@ -850,10 +814,10 @@ uuid = "88015f11-f218-50d7-93a8-a6af411a945d" version = "3.0.0+1" [[deps.LLVMOpenMP_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "f689897ccbe049adb19a065c495e75f372ecd42b" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "d986ce2d884d49126836ea94ed5bfb0f12679713" uuid = "1d63c593-3942-5779-bab2-d838dc0a180e" -version = "15.0.4+0" +version = "15.0.7+0" [[deps.LZO_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -880,12 +844,6 @@ version = "0.16.1" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8" -[[deps.LatticeRules]] -deps = ["Random"] -git-tree-sha1 = "7f5b02258a3ca0221a6a9710b0a0a2e8fb4957fe" -uuid = "73f95e8e-ec14-4e6a-8b18-0d2e271c4e55" -version = "0.0.1" - [[deps.LayoutPointers]] deps = ["ArrayInterface", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface"] git-tree-sha1 = "62edfee3211981241b57ff1cedf4d74d79519277" @@ -929,9 +887,14 @@ uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" version = "8.4.0+0" [[deps.LibGit2]] -deps = ["Base64", "NetworkOptions", "Printf", "SHA"] +deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" +[[deps.LibGit2_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] +uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" +version = "1.6.4+0" + [[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" @@ -999,10 +962,10 @@ deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.LinearSolve]] -deps = ["ArrayInterface", "ConcreteStructs", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "MKL_jll", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "Requires", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "StaticArraysCore", "UnPack"] -git-tree-sha1 = "03cd36673f050ec49f9bdfce31e0e7e22d877e64" +deps = ["ArrayInterface", "ConcreteStructs", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "MKL_jll", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "StaticArraysCore", "UnPack"] +git-tree-sha1 = "6f8e084deabe3189416c4e505b1c53e1b590cae8" uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" -version = "2.21.0" +version = "2.22.1" [deps.LinearSolve.extensions] LinearSolveBandedMatricesExt = "BandedMatrices" @@ -1081,9 +1044,9 @@ version = "2024.0.0+0" [[deps.MacroTools]] deps = ["Markdown", "Random"] -git-tree-sha1 = "9ee1618cbf5240e6d4e0371d6f24065083f60c48" +git-tree-sha1 = "b211c553c199c111d998ecdaf7623d1b89b69f93" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -version = "0.5.11" +version = "0.5.12" [[deps.ManualMemory]] git-tree-sha1 = "bcaef4fc7a0cfe2cba636d84cda54b5e4e4ca3cd" @@ -1096,9 +1059,9 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[deps.MathOptInterface]] deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "DataStructures", "ForwardDiff", "JSON", "LinearAlgebra", "MutableArithmetics", "NaNMath", "OrderedCollections", "PrecompileTools", "Printf", "SparseArrays", "SpecialFunctions", "Test", "Unicode"] -git-tree-sha1 = "362ae34a5291a79e16b8eb87b5738532c5e799ff" +git-tree-sha1 = "372dfbc815ddd820ae9a83990e4f625d95c9bca9" uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" -version = "1.23.0" +version = "1.25.0" [[deps.MatrixFactorizations]] deps = ["ArrayLayouts", "LinearAlgebra", "Printf", "Random"] @@ -1106,6 +1069,12 @@ git-tree-sha1 = "78f6e33434939b0ac9ba1df81e6d005ee85a7396" uuid = "a3b82374-2e81-5b9e-98ce-41277c0e4c87" version = "2.1.0" +[[deps.MaybeInplace]] +deps = ["ArrayInterface", "LinearAlgebra", "MacroTools", "SparseArrays"] +git-tree-sha1 = "a85c6a98c9e5a2a7046bc1bb89f28a3241e1de4d" +uuid = "bb5d69b7-63fc-4a16-80bd-7e42200c7bdb" +version = "0.1.1" + [[deps.MbedTLS]] deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "NetworkOptions", "Random", "Sockets"] git-tree-sha1 = "c067a280ddc25f196b5e7df3877c6b226d390aaf" @@ -1115,7 +1084,7 @@ version = "1.1.9" [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+0" +version = "2.28.2+1" [[deps.Measures]] git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102" @@ -1145,7 +1114,7 @@ version = "0.14.0" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2022.10.11" +version = "2023.1.10" [[deps.MuladdMacro]] git-tree-sha1 = "cac9cc5499c25554cba55cd3c30543cff5ca4fab" @@ -1181,26 +1150,43 @@ uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" version = "1.2.0" [[deps.NonlinearSolve]] -deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "EnumX", "FastBroadcast", "FiniteDiff", "ForwardDiff", "LineSearches", "LinearAlgebra", "LinearSolve", "PrecompileTools", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SimpleNonlinearSolve", "SparseArrays", "SparseDiffTools", "StaticArraysCore", "UnPack"] -git-tree-sha1 = "6166ccd8f79c93c636ca61ab4cd18f555932563d" +deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "EnumX", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "LazyArrays", "LineSearches", "LinearAlgebra", "LinearSolve", "MaybeInplace", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SimpleNonlinearSolve", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"] +git-tree-sha1 = "72b036b728461272ae1b1c3f7096cb4c319d8793" uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" -version = "2.8.2" +version = "3.4.0" [deps.NonlinearSolve.extensions] NonlinearSolveBandedMatricesExt = "BandedMatrices" NonlinearSolveFastLevenbergMarquardtExt = "FastLevenbergMarquardt" + NonlinearSolveFixedPointAccelerationExt = "FixedPointAcceleration" NonlinearSolveLeastSquaresOptimExt = "LeastSquaresOptim" + NonlinearSolveMINPACKExt = "MINPACK" + NonlinearSolveNLsolveExt = "NLsolve" + NonlinearSolveSIAMFANLEquationsExt = "SIAMFANLEquations" + NonlinearSolveSpeedMappingExt = "SpeedMapping" + NonlinearSolveSymbolicsExt = "Symbolics" + NonlinearSolveZygoteExt = "Zygote" [deps.NonlinearSolve.weakdeps] BandedMatrices = "aae01518-5342-5314-be14-df237901396f" FastLevenbergMarquardt = "7a0df574-e128-4d35-8cbd-3d84502bf7ce" + FixedPointAcceleration = "817d07cb-a79a-5c30-9a31-890123675176" LeastSquaresOptim = "0fc2ff8b-aaa3-5acd-a817-1944a5e08891" + MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9" + NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" + SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4" + SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412" + Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" + Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [[deps.OffsetArrays]] -deps = ["Adapt"] -git-tree-sha1 = "2ac17d29c523ce1cd38e27785a7d23024853a4bb" +git-tree-sha1 = "6a731f2b5c03157418a20c12195eb4b74c8f8621" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.12.10" +version = "1.13.0" +weakdeps = ["Adapt"] + + [deps.OffsetArrays.extensions] + OffsetArraysAdaptExt = "Adapt" [[deps.Ogg_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -1211,12 +1197,12 @@ version = "1.3.5+1" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.21+4" +version = "0.3.23+2" [[deps.OpenLibm_jll]] deps = ["Artifacts", "Libdl"] uuid = "05823500-19ac-5b8b-9628-191a04bc5112" -version = "0.8.1+0" +version = "0.8.1+2" [[deps.OpenSSL]] deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"] @@ -1254,15 +1240,15 @@ uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" version = "1.6.3" [[deps.OrdinaryDiffEq]] -deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "ExponentialUtilities", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "IfElse", "InteractiveUtils", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "LoopVectorization", "MacroTools", "MuladdMacro", "NLsolve", "NonlinearSolve", "Polyester", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLNLSolve", "SciMLOperators", "SimpleNonlinearSolve", "SimpleUnPack", "SparseArrays", "SparseDiffTools", "StaticArrayInterface", "StaticArrays", "TruncatedStacktraces"] -git-tree-sha1 = "5f9e7ce227d0e447c3803cc05ef5d8f75f84b9ea" +deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "ExponentialUtilities", "FastBroadcast", "FastClosures", "FillArrays", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "IfElse", "InteractiveUtils", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "MacroTools", "MuladdMacro", "NonlinearSolve", "Polyester", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SimpleNonlinearSolve", "SimpleUnPack", "SparseArrays", "SparseDiffTools", "StaticArrayInterface", "StaticArrays", "TruncatedStacktraces"] +git-tree-sha1 = "7c6738f21fba2ccd07b7eaa9d23b437a8a97f1a1" uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" -version = "6.59.3" +version = "6.69.0" [[deps.PCRE2_jll]] deps = ["Artifacts", "Libdl"] uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15" -version = "10.42.0+0" +version = "10.42.0+1" [[deps.PDMats]] deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] @@ -1284,9 +1270,9 @@ version = "0.12.3" [[deps.Parsers]] deps = ["Dates", "PrecompileTools", "UUIDs"] -git-tree-sha1 = "a935806434c9d4c506ba941871b327b96d41f2bf" +git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.8.0" +version = "2.8.1" [[deps.Pipe]] git-tree-sha1 = "6842804e7867b115ca9de748a0cf6b364523c16d" @@ -1302,7 +1288,7 @@ version = "0.42.2+0" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.9.2" +version = "1.10.0" [[deps.PlotThemes]] deps = ["PlotUtils", "Statistics"] @@ -1312,9 +1298,9 @@ version = "3.1.0" [[deps.PlotUtils]] deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "Statistics"] -git-tree-sha1 = "f92e1315dadf8c46561fb9396e525f7200cdc227" +git-tree-sha1 = "862942baf5663da528f66d24996eb6da85218e76" uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043" -version = "1.3.5" +version = "1.4.0" [[deps.Plots]] deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Preferences", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs", "UnicodeFun", "UnitfulLatexify", "Unzip"] @@ -1367,10 +1353,10 @@ uuid = "85a6dd25-e78a-55b7-8502-1745935b8125" version = "0.2.4" [[deps.PreallocationTools]] -deps = ["Adapt", "ArrayInterface", "ForwardDiff", "Requires"] -git-tree-sha1 = "01ac95fca7daabe77a9cb705862bd87016af9ddb" +deps = ["Adapt", "ArrayInterface", "ForwardDiff"] +git-tree-sha1 = "64bb68f76f789f5fe5930a80af310f19cdafeaed" uuid = "d236fae5-4411-538c-8e31-a6e3d9e00b46" -version = "0.4.13" +version = "0.4.17" [deps.PreallocationTools.extensions] PreallocationToolsReverseDiffExt = "ReverseDiff" @@ -1390,12 +1376,6 @@ git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e" uuid = "21216c6a-2e73-6563-6e65-726566657250" version = "1.4.1" -[[deps.Primes]] -deps = ["IntegerMathUtils"] -git-tree-sha1 = "1d05623b5952aed1307bf8b43bec8b8d1ef94b6e" -uuid = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae" -version = "0.5.5" - [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" @@ -1416,29 +1396,19 @@ git-tree-sha1 = "9ebcd48c498668c7fa0e97a9cae873fbee7bfee1" uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" version = "2.9.1" -[[deps.QuasiMonteCarlo]] -deps = ["Accessors", "ConcreteStructs", "LatticeRules", "LinearAlgebra", "Primes", "Random", "Requires", "Sobol", "StatsBase"] -git-tree-sha1 = "cc086f8485bce77b6187141e1413c3b55f9a4341" -uuid = "8a4e6c94-4038-4cdc-81c3-7e6ffdb2a71b" -version = "0.3.3" -weakdeps = ["Distributions"] - - [deps.QuasiMonteCarlo.extensions] - QuasiMonteCarloDistributionsExt = "Distributions" - [[deps.REPL]] deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[deps.Random]] -deps = ["SHA", "Serialization"] +deps = ["SHA"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[deps.Random123]] deps = ["Random", "RandomNumbers"] -git-tree-sha1 = "552f30e847641591ba3f39fd1bed559b9deb0ef3" +git-tree-sha1 = "c860e84651f58ce240dd79e5d9e055d55234c35a" uuid = "74087812-796a-5b5d-8853-05524746bad3" -version = "1.6.1" +version = "1.6.2" [[deps.RandomNumbers]] deps = ["Random", "Requires"] @@ -1459,18 +1429,20 @@ uuid = "01d81517-befc-4cb6-b9ec-a95719d0359c" version = "0.6.12" [[deps.RecursiveArrayTools]] -deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "Requires", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"] -git-tree-sha1 = "d7087c013e8a496ff396bae843b1e16d9a30ede8" +deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "SparseArrays", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"] +git-tree-sha1 = "4873672a6d7990c683b4badf8671c50043ad321b" uuid = "731186ca-8d62-57ce-b412-fbd966d074cd" -version = "2.38.10" +version = "3.4.2" [deps.RecursiveArrayTools.extensions] + RecursiveArrayToolsFastBroadcastExt = "FastBroadcast" RecursiveArrayToolsMeasurementsExt = "Measurements" RecursiveArrayToolsMonteCarloMeasurementsExt = "MonteCarloMeasurements" RecursiveArrayToolsTrackerExt = "Tracker" RecursiveArrayToolsZygoteExt = "Zygote" [deps.RecursiveArrayTools.weakdeps] + FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca" Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" @@ -1539,10 +1511,10 @@ uuid = "476501e8-09a2-5ece-8869-fb82de89a1fa" version = "0.6.42" [[deps.SciMLBase]] -deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FillArrays", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "QuasiMonteCarlo", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables", "TruncatedStacktraces"] -git-tree-sha1 = "32ea825941f7b58a6f48268f4b76971ae8eb9eec" +deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FillArrays", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables", "TruncatedStacktraces"] +git-tree-sha1 = "bda8bddc47915ee94bb10a5fc901b112e337e898" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.10.0" +version = "2.17.0" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" @@ -1561,12 +1533,6 @@ version = "2.10.0" RCall = "6f49c342-dc21-5d91-9882-a32aef131414" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" -[[deps.SciMLNLSolve]] -deps = ["DiffEqBase", "LineSearches", "NLsolve", "Reexport", "SciMLBase"] -git-tree-sha1 = "765b788339abd7d983618c09cfc0192e2b6b15fd" -uuid = "e9a6253c-8580-4d32-9898-8661bb511710" -version = "0.1.9" - [[deps.SciMLOperators]] deps = ["ArrayInterface", "DocStringExtensions", "Lazy", "LinearAlgebra", "Setfield", "SparseArrays", "StaticArraysCore", "Tricks"] git-tree-sha1 = "51ae235ff058a64815e0a2c34b1db7578a06813d" @@ -1604,16 +1570,16 @@ uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7" version = "1.1.0" [[deps.SimpleNonlinearSolve]] -deps = ["ArrayInterface", "DiffEqBase", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "PrecompileTools", "Reexport", "SciMLBase", "StaticArraysCore"] -git-tree-sha1 = "69b1a53374dd14d7c165d98cb646aeb5f36f8d07" +deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "MaybeInplace", "PrecompileTools", "Reexport", "SciMLBase", "StaticArraysCore"] +git-tree-sha1 = "8d672bd91dc432fb286b6d4bcf1a5dc417e932a3" uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7" -version = "0.1.25" +version = "1.2.0" [deps.SimpleNonlinearSolve.extensions] - SimpleNonlinearSolveNNlibExt = "NNlib" + SimpleNonlinearSolvePolyesterForwardDiffExt = "PolyesterForwardDiff" [deps.SimpleNonlinearSolve.weakdeps] - NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" + PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b" [[deps.SimpleTraits]] deps = ["InteractiveUtils", "MacroTools"] @@ -1626,30 +1592,19 @@ git-tree-sha1 = "58e6353e72cde29b90a69527e56df1b5c3d8c437" uuid = "ce78b400-467f-4804-87d8-8f486da07d0a" version = "1.1.0" -[[deps.SnoopPrecompile]] -deps = ["Preferences"] -git-tree-sha1 = "e760a70afdcd461cf01a575947738d359234665c" -uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c" -version = "1.0.3" - -[[deps.Sobol]] -deps = ["DelimitedFiles", "Random"] -git-tree-sha1 = "5a74ac22a9daef23705f010f72c81d6925b19df8" -uuid = "ed01d8cd-4d21-5b2a-85b4-cc3bdc58bad4" -version = "1.5.0" - [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[deps.SortingAlgorithms]] deps = ["DataStructures"] -git-tree-sha1 = "5165dfb9fd131cf0c6957a3a7605dede376e7b63" +git-tree-sha1 = "66e0a8e672a0bdfca2c3f5937efb8538b9ddc085" uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" -version = "1.2.0" +version = "1.2.1" [[deps.SparseArrays]] deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +version = "1.10.0" [[deps.SparseDiffTools]] deps = ["ADTypes", "Adapt", "ArrayInterface", "Compat", "DataStructures", "FiniteDiff", "ForwardDiff", "Graphs", "LinearAlgebra", "PackageExtensionCompat", "Random", "Reexport", "SciMLOperators", "Setfield", "SparseArrays", "StaticArrayInterface", "StaticArrays", "Tricks", "UnPack", "VertexSafeGraphs"] @@ -1704,9 +1659,9 @@ weakdeps = ["OffsetArrays", "StaticArrays"] [[deps.StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] -git-tree-sha1 = "fba11dbe2562eecdfcac49a05246af09ee64d055" +git-tree-sha1 = "4e17a790909b17f7bf1496e3aec138cf01b60b3b" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.8.1" +version = "1.9.0" [deps.StaticArrays.extensions] StaticArraysChainRulesCoreExt = "ChainRulesCore" @@ -1724,7 +1679,7 @@ version = "1.4.2" [[deps.Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -version = "1.9.0" +version = "1.10.0" [[deps.StatsAPI]] deps = ["LinearAlgebra"] @@ -1753,10 +1708,10 @@ version = "1.3.0" InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" [[deps.SteadyStateDiffEq]] -deps = ["DiffEqBase", "DiffEqCallbacks", "LinearAlgebra", "NLsolve", "Reexport", "SciMLBase"] -git-tree-sha1 = "2ca69f4be3294e4cd987d83d6019037d420d9fc1" +deps = ["ConcreteStructs", "DiffEqBase", "DiffEqCallbacks", "LinearAlgebra", "Reexport", "SciMLBase"] +git-tree-sha1 = "a735fd5053724cf4de31c81b4e2cc429db844be5" uuid = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f" -version = "1.16.1" +version = "2.0.1" [[deps.StochasticDiffEq]] deps = ["Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqNoiseProcess", "DocStringExtensions", "FiniteDiff", "ForwardDiff", "JumpProcesses", "LevyArea", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "OrdinaryDiffEq", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"] @@ -1775,27 +1730,26 @@ deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" [[deps.SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] +deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" -version = "5.10.1+6" +version = "7.2.1+1" [[deps.Sundials]] deps = ["CEnum", "DataStructures", "DiffEqBase", "Libdl", "LinearAlgebra", "Logging", "PrecompileTools", "Reexport", "SciMLBase", "SparseArrays", "Sundials_jll"] -git-tree-sha1 = "f8992f3fe2388e0de5f67376ce6aaf4c90b4ee4c" +git-tree-sha1 = "ded52f017fe7faa3d004427f10ecce4c0491c16a" uuid = "c3572dad-4567-51f8-b174-8c6c989267f4" -version = "4.22.1" +version = "4.23.1" [[deps.Sundials_jll]] -deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "OpenBLAS_jll", "Pkg", "SuiteSparse_jll"] -git-tree-sha1 = "04777432d74ec5bc91ca047c9e0e0fd7f81acdb6" +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "SuiteSparse_jll", "libblastrampoline_jll"] +git-tree-sha1 = "ba4d38faeb62de7ef47155ed321dce40a549c305" uuid = "fb77eaff-e24c-56d4-86b1-d163f2edb164" -version = "5.2.1+0" +version = "5.2.2+0" [[deps.SymbolicIndexingInterface]] -deps = ["DocStringExtensions"] -git-tree-sha1 = "f8ab052bfcbdb9b48fad2c80c873aa0d0344dfe5" +git-tree-sha1 = "74502f408d99fc217a9d7cd901d9ffe45af892b1" uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5" -version = "0.2.2" +version = "0.3.3" [[deps.TOML]] deps = ["Dates"] @@ -1889,12 +1843,15 @@ deps = ["Dates", "LinearAlgebra", "Random"] git-tree-sha1 = "3c793be6df9dd77a0cf49d80984ef9ff996948fa" uuid = "1986cc42-f94f-5a68-af5c-568840ba703d" version = "1.19.0" -weakdeps = ["ConstructionBase", "InverseFunctions"] [deps.Unitful.extensions] ConstructionBaseUnitfulExt = "ConstructionBase" InverseFunctionsUnitfulExt = "InverseFunctions" + [deps.Unitful.weakdeps] + ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + [[deps.UnitfulLatexify]] deps = ["LaTeXStrings", "Latexify", "Unitful"] git-tree-sha1 = "e2d817cc500e960fdbafcf988ac8436ba3208bfd" @@ -1932,9 +1889,9 @@ version = "1.21.0+1" [[deps.Wayland_protocols_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "4528479aa01ee1b3b4cd0e6faef0e04cf16466da" +git-tree-sha1 = "93f43ab61b16ddfb2fd3bb13b3ce241cafb0e6c9" uuid = "2381bf8a-dfd0-557d-9999-79630e7b1b91" -version = "1.25.0+0" +version = "1.31.0+0" [[deps.XML2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"] @@ -2101,7 +2058,7 @@ version = "1.5.0+0" [[deps.Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+0" +version = "1.2.13+1" [[deps.Zstd_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -2142,7 +2099,7 @@ version = "0.15.1+0" [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.8.0+0" +version = "5.8.0+1" [[deps.libevdev_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -2188,7 +2145,7 @@ version = "1.52.0+1" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+0" +version = "17.4.0+2" [[deps.x264_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] diff --git a/dev/chi_squared_k1/index.html b/dev/chi_squared_k1/index.html index cbafba8..3a60532 100644 --- a/dev/chi_squared_k1/index.html +++ b/dev/chi_squared_k1/index.html @@ -58,371 +58,267 @@ plot!(t, ρ.(t), w = 4) - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/chi_squared_k_greater1/index.html b/dev/chi_squared_k_greater1/index.html index b646d34..5d7e3c7 100644 --- a/dev/chi_squared_k_greater1/index.html +++ b/dev/chi_squared_k_greater1/index.html @@ -103,160 +103,175 @@ plot!(t, ρ.(t), w = 4) - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/functions/index.html b/dev/functions/index.html index 667d33d..38ccf93 100644 --- a/dev/functions/index.html +++ b/dev/functions/index.html @@ -3,14 +3,14 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-90474609-3', {'page_path': location.pathname + location.search + location.hash}); -

Functions

Note

The core interface of all essential functions are not dependent on specialized types such as AbstractOrthoPoly. Having said that, for exactly those essential functions, there exist overloaded functions that accept specialized types such as AbstractOrthoPoly as arguments.

Too abstract? For example, the function evaluate that evaluates a polynomial of degree n at points x has the core interface

    evaluate(n::Int,x::Array{<:Real},a::Vector{<:Real},b::Vector{<:Real})

where a and b are the vectors of recurrence coefficients. For simplicity, there also exists the interface

    evaluate(n::Int64,x::Vector{<:Real},op::AbstractOrthoPoly)

So fret not upon the encounter of multiple-dispatched versions of the same thing. It's there to simplify your life.

The idea of this approach is to make it simpler for others to copy and paste code snippets and use them in their own work.

List of all functions in PolyChaos.

Recurrence Coefficients for Monic Orthogonal Polynomials

The functions below provide analytic expressions for the recurrence coefficients of common orthogonal polynomials. All of these provide monic orthogonal polynomials relative to the weights.

Note

The number N of recurrence coefficients has to be positive for all functions below.

PolyChaos.r_scaleFunction
r_scale(c::Real,β::AbstractVector{<:Real},α::AbstractVector{<:Real})

Given the recursion coefficients (α,β) for a system of orthogonal polynomials that are orthogonal with respect to some positive weight $m(t)$, this function returns the recursion coefficients (α_,β_) for the scaled measure $c m(t)$ for some positive $c$.

source
PolyChaos.rm_computeFunction
rm_compute(weight::Function,lb::Real,ub::Real,Npoly::Int=4,Nquad::Int=10;quadrature::Function=clenshaw_curtis)

Given a positive weight function with domain (lb,ub), i.e. a function $w: [lb, ub ] \rightarrow \mathbb{R}_{\geq 0}$, this function creates Npoly recursion coefficients (α,β).

The keyword quadrature specifies what quadrature rule is being used.

source
PolyChaos.rm_logisticFunction
rm_logistic(N::Int)

Creates N recurrence coefficients for monic polynomials that are orthogonal on $(-\infty,\infty)$ relative to $w(t) = \frac{\mathrm{e}^{-t}}{(1 - \mathrm{e}^{-t})^2}$

source
PolyChaos.rm_hermiteFunction
rm_hermite(N::Int,mu::Real)
-rm_hermite(N::Int)

Creates N recurrence coefficients for monic generalized Hermite polynomials that are orthogonal on $(-\infty,\infty)$ relative to $w(t) = |t|^{2 \mu} \mathrm{e}^{-t^2}$

The call rm_hermite(N) is the same as rm_hermite(N,0).

source
PolyChaos.rm_hermite_probFunction
rm_hermite_prob(N::Int)

Creates N recurrence coefficients for monic probabilists' Hermite polynomials that are orthogonal on $(-\infty,\infty)$ relative to $w(t) = \mathrm{e}^{-0.5t^2}$

source
PolyChaos.rm_laguerreFunction
rm_laguerre(N::Int,a::Real)
-rm_laguerre(N::Int)

Creates N recurrence coefficients for monic generalized Laguerre polynomials that are orthogonal on $(0,\infty)$ relative to $w(t) = t^a \mathrm{e}^{-t}$.

The call rm_laguerre(N) is the same as rm_laguerre(N,0).

source
PolyChaos.rm_legendreFunction
rm_legendre(N::Int)

Creates N recurrence coefficients for monic Legendre polynomials that are orthogonal on $(-1,1)$ relative to $w(t) = 1$.

source
PolyChaos.rm_legendre01Function
rm_legendre01(N::Int)

Creates N recurrence coefficients for monic Legendre polynomials that are orthogonal on $(0,1)$ relative to $w(t) = 1$.

source
PolyChaos.rm_jacobiFunction
rm_jacobi(N::Int,a::Real,b::Real)
+

Functions

Note

The core interface of all essential functions are not dependent on specialized types such as AbstractOrthoPoly. Having said that, for exactly those essential functions, there exist overloaded functions that accept specialized types such as AbstractOrthoPoly as arguments.

Too abstract? For example, the function evaluate that evaluates a polynomial of degree n at points x has the core interface

    evaluate(n::Int,x::Array{<:Real},a::Vector{<:Real},b::Vector{<:Real})

where a and b are the vectors of recurrence coefficients. For simplicity, there also exists the interface

    evaluate(n::Int64,x::Vector{<:Real},op::AbstractOrthoPoly)

So fret not upon the encounter of multiple-dispatched versions of the same thing. It's there to simplify your life.

The idea of this approach is to make it simpler for others to copy and paste code snippets and use them in their own work.

List of all functions in PolyChaos.

Recurrence Coefficients for Monic Orthogonal Polynomials

The functions below provide analytic expressions for the recurrence coefficients of common orthogonal polynomials. All of these provide monic orthogonal polynomials relative to the weights.

Note

The number N of recurrence coefficients has to be positive for all functions below.

PolyChaos.r_scaleFunction
r_scale(c::Real,β::AbstractVector{<:Real},α::AbstractVector{<:Real})

Given the recursion coefficients (α,β) for a system of orthogonal polynomials that are orthogonal with respect to some positive weight $m(t)$, this function returns the recursion coefficients (α_,β_) for the scaled measure $c m(t)$ for some positive $c$.

source
PolyChaos.rm_computeFunction
rm_compute(weight::Function,lb::Real,ub::Real,Npoly::Int=4,Nquad::Int=10;quadrature::Function=clenshaw_curtis)

Given a positive weight function with domain (lb,ub), i.e. a function $w: [lb, ub ] \rightarrow \mathbb{R}_{\geq 0}$, this function creates Npoly recursion coefficients (α,β).

The keyword quadrature specifies what quadrature rule is being used.

source
PolyChaos.rm_logisticFunction
rm_logistic(N::Int)

Creates N recurrence coefficients for monic polynomials that are orthogonal on $(-\infty,\infty)$ relative to $w(t) = \frac{\mathrm{e}^{-t}}{(1 - \mathrm{e}^{-t})^2}$

source
PolyChaos.rm_hermiteFunction
rm_hermite(N::Int,mu::Real)
+rm_hermite(N::Int)

Creates N recurrence coefficients for monic generalized Hermite polynomials that are orthogonal on $(-\infty,\infty)$ relative to $w(t) = |t|^{2 \mu} \mathrm{e}^{-t^2}$

The call rm_hermite(N) is the same as rm_hermite(N,0).

source
PolyChaos.rm_hermite_probFunction
rm_hermite_prob(N::Int)

Creates N recurrence coefficients for monic probabilists' Hermite polynomials that are orthogonal on $(-\infty,\infty)$ relative to $w(t) = \mathrm{e}^{-0.5t^2}$

source
PolyChaos.rm_laguerreFunction
rm_laguerre(N::Int,a::Real)
+rm_laguerre(N::Int)

Creates N recurrence coefficients for monic generalized Laguerre polynomials that are orthogonal on $(0,\infty)$ relative to $w(t) = t^a \mathrm{e}^{-t}$.

The call rm_laguerre(N) is the same as rm_laguerre(N,0).

source
PolyChaos.rm_legendreFunction
rm_legendre(N::Int)

Creates N recurrence coefficients for monic Legendre polynomials that are orthogonal on $(-1,1)$ relative to $w(t) = 1$.

source
PolyChaos.rm_legendre01Function
rm_legendre01(N::Int)

Creates N recurrence coefficients for monic Legendre polynomials that are orthogonal on $(0,1)$ relative to $w(t) = 1$.

source
PolyChaos.rm_jacobiFunction
rm_jacobi(N::Int,a::Real,b::Real)
 rm_jacobi(N::Int,a::Real)
-rm_jacobi(N::Int)

Creates N recurrence coefficients for monic Jacobi polynomials that are orthogonal on $(-1,1)$ relative to $w(t) = (1-t)^a (1+t)^b$.

The call rm_jacobi(N,a) is the same as rm_jacobi(N,a,a) and rm_jacobi(N) the same as rm_jacobi(N,0,0).

source
PolyChaos.rm_jacobi01Function
rm_jacobi01(N::Int,a::Real,b::Real)
+rm_jacobi(N::Int)

Creates N recurrence coefficients for monic Jacobi polynomials that are orthogonal on $(-1,1)$ relative to $w(t) = (1-t)^a (1+t)^b$.

The call rm_jacobi(N,a) is the same as rm_jacobi(N,a,a) and rm_jacobi(N) the same as rm_jacobi(N,0,0).

source
PolyChaos.rm_jacobi01Function
rm_jacobi01(N::Int,a::Real,b::Real)
 rm_jacobi01(N::Int,a::Real)
-rm_jacobi01(N::Int)

Creates N recurrence coefficients for monic Jacobi polynomials that are orthogonal on $(0,1)$ relative to $w(t) = (1-t)^a t^b$.

The call rm_jacobi01(N,a) is the same as rm_jacobi01(N,a,a) and rm_jacobi01(N) the same as rm_jacobi01(N,0,0).

source
PolyChaos.rm_meixner_pollaczekFunction
rm_meixner_pollaczek(N::Int,lambda::Real,phi::Real)
-rm_meixner_pollaczek(N::Int,lambda::Real)

Creates N recurrence coefficients for monic Meixner-Pollaczek polynomials with parameters λ and ϕ. These are orthogonal on $[-\infty,\infty]$ relative to the weight function $w(t)=(2 \pi)^{-1} \exp{(2 \phi-\pi)t} |\Gamma(\lambda+ i t)|^2$.

The call rm_meixner_pollaczek(n,lambda) is the same as rm_meixner_pollaczek(n,lambda,pi/2).

source
PolyChaos.stieltjesFunction
stieltjes(N::Int,nodes_::AbstractVector{<:Real},weights_::AbstractVector{<:Real};removezeroweights::Bool=true)

Stieltjes procedure–-Given the nodes and weights, the function generates the firstN recurrence coefficients of the corresponding discrete orthogonal polynomials.

Set the Boolean removezeroweights to true if zero weights should be removed.

source
PolyChaos.lanczosFunction
lanczos(N::Int,nodes::AbstractVector{<:Real},weights::AbstractVector{<:Real};removezeroweights::Bool=true)

Lanczos procedure–-given the nodes and weights, the function generates the first N recurrence coefficients of the corresponding discrete orthogonal polynomials.

Set the Boolean removezeroweights to true if zero weights should be removed.

The script is adapted from the routine RKPW in W.B. Gragg and W.J. Harrod, The numerically stable reconstruction of Jacobi matrices from spectral data, Numer. Math. 44 (1984), 317-335.

source
PolyChaos.mcdiscretizationFunction
mcdiscretization(N::Int,quads::Vector{},discretemeasure::AbstractMatrix{<:Real}=zeros(0,2);discretization::Function=stieltjes,Nmax::Integer=300,ε::Float64=1e-8,gaussquad::Bool=false)

This routine returns $N$ recurrence coefficients of the polynomials that are orthogonal relative to a weight function $w$ that is decomposed as a sum of $m$ weights $w_i$ with domains $[a_i,b_i]$ for $i=1,\dots,m$,

\[w(t) = \sum_{i}^{m} w_i(t) \quad \text{with } \operatorname{dom}(w_i) = [a_i, b_i].\]

For each weight $w_i$ and its domain $[a_i, b_i]$ the function mcdiscretization() expects a quadrature rule of the form nodes::AbstractVector{<:Real}, weights::AbstractVector{<:Real} = myquadi(N::Int) all of which are stacked in the parameter quad quad = [ myquad1, ..., myquadm ] If the weight function has a discrete part (specified by discretemeasure) it is added on to the discretized continuous weight function.

The function mcdiscretization() performs a sequence of discretizations of the given weight $w(t)$, each discretization being followed by an application of the Stieltjes or Lanczos procedure (keyword discretization in [stieltjes, lanczos]) to produce approximations to the desired recurrence coefficients. The function applies to each subinterval $i$ an N-point quadrature rule (the $i$th entry of quad) to discretize the weight function $w_i$ on that subinterval. If the procedure converges to within a prescribed accuracy ε before N reaches its maximum allowed value Nmax. If the function does not converge, the function prompts an error message.

The keyword gaussquad should be set to true if Gauss quadrature rules are available for all $m$ weights $w_i(t)$ with $i = 1, \dots, m$.

For further information, please see W. Gautschi "Orthogonal Polynomials: Approximation and Computation", Section 2.2.4.

source

Show Orthogonal Polynomials

To get a human-readable output of the orthogonal polynomials, there is the function showpoly

PolyChaos.showpolyFunction
showpoly(coeffs::Vector{<:Real};sym::String,digits::Integer)

Show the monic polynomial with coefficients coeffs in a human-readable way. The keyword sym sets the name of the variable, and digits controls the number of shown digits.

julia> using PolyChaos
+rm_jacobi01(N::Int)

Creates N recurrence coefficients for monic Jacobi polynomials that are orthogonal on $(0,1)$ relative to $w(t) = (1-t)^a t^b$.

The call rm_jacobi01(N,a) is the same as rm_jacobi01(N,a,a) and rm_jacobi01(N) the same as rm_jacobi01(N,0,0).

source
PolyChaos.rm_meixner_pollaczekFunction
rm_meixner_pollaczek(N::Int,lambda::Real,phi::Real)
+rm_meixner_pollaczek(N::Int,lambda::Real)

Creates N recurrence coefficients for monic Meixner-Pollaczek polynomials with parameters λ and ϕ. These are orthogonal on $[-\infty,\infty]$ relative to the weight function $w(t)=(2 \pi)^{-1} \exp{(2 \phi-\pi)t} |\Gamma(\lambda+ i t)|^2$.

The call rm_meixner_pollaczek(n,lambda) is the same as rm_meixner_pollaczek(n,lambda,pi/2).

source
PolyChaos.stieltjesFunction
stieltjes(N::Int,nodes_::AbstractVector{<:Real},weights_::AbstractVector{<:Real};removezeroweights::Bool=true)

Stieltjes procedure–-Given the nodes and weights, the function generates the firstN recurrence coefficients of the corresponding discrete orthogonal polynomials.

Set the Boolean removezeroweights to true if zero weights should be removed.

source
PolyChaos.lanczosFunction
lanczos(N::Int,nodes::AbstractVector{<:Real},weights::AbstractVector{<:Real};removezeroweights::Bool=true)

Lanczos procedure–-given the nodes and weights, the function generates the first N recurrence coefficients of the corresponding discrete orthogonal polynomials.

Set the Boolean removezeroweights to true if zero weights should be removed.

The script is adapted from the routine RKPW in W.B. Gragg and W.J. Harrod, The numerically stable reconstruction of Jacobi matrices from spectral data, Numer. Math. 44 (1984), 317-335.

source
PolyChaos.mcdiscretizationFunction
mcdiscretization(N::Int,quads::Vector{},discretemeasure::AbstractMatrix{<:Real}=zeros(0,2);discretization::Function=stieltjes,Nmax::Integer=300,ε::Float64=1e-8,gaussquad::Bool=false)

This routine returns $N$ recurrence coefficients of the polynomials that are orthogonal relative to a weight function $w$ that is decomposed as a sum of $m$ weights $w_i$ with domains $[a_i,b_i]$ for $i=1,\dots,m$,

\[w(t) = \sum_{i}^{m} w_i(t) \quad \text{with } \operatorname{dom}(w_i) = [a_i, b_i].\]

For each weight $w_i$ and its domain $[a_i, b_i]$ the function mcdiscretization() expects a quadrature rule of the form nodes::AbstractVector{<:Real}, weights::AbstractVector{<:Real} = myquadi(N::Int) all of which are stacked in the parameter quad quad = [ myquad1, ..., myquadm ] If the weight function has a discrete part (specified by discretemeasure) it is added on to the discretized continuous weight function.

The function mcdiscretization() performs a sequence of discretizations of the given weight $w(t)$, each discretization being followed by an application of the Stieltjes or Lanczos procedure (keyword discretization in [stieltjes, lanczos]) to produce approximations to the desired recurrence coefficients. The function applies to each subinterval $i$ an N-point quadrature rule (the $i$th entry of quad) to discretize the weight function $w_i$ on that subinterval. If the procedure converges to within a prescribed accuracy ε before N reaches its maximum allowed value Nmax. If the function does not converge, the function prompts an error message.

The keyword gaussquad should be set to true if Gauss quadrature rules are available for all $m$ weights $w_i(t)$ with $i = 1, \dots, m$.

For further information, please see W. Gautschi "Orthogonal Polynomials: Approximation and Computation", Section 2.2.4.

source

Show Orthogonal Polynomials

To get a human-readable output of the orthogonal polynomials, there is the function showpoly

PolyChaos.showpolyFunction
showpoly(coeffs::Vector{<:Real};sym::String,digits::Integer)

Show the monic polynomial with coefficients coeffs in a human-readable way. The keyword sym sets the name of the variable, and digits controls the number of shown digits.

julia> using PolyChaos
 
 julia> showpoly([1.2, 2.3, 3.4456])
 x^3 + 3.45x^2 + 2.3x + 1.2
@@ -44,7 +44,7 @@
 t^2 - 1.0
 t^3 - 3.0t
 t^4 - 6.0t^2 + 3.0
-t^5 - 10.0t^3 + 15.0t

Thanks @pfitzseb for providing this functionality.

source

In case you want to see the entire basis, just use showbasis

In case you want to see the entire basis, just use showbasis

PolyChaos.showbasisFunction
showbasis(α::Vector{<:Real},β::Vector{<:Real};sym::String,digits::Integer)

Show all basis polynomials given the recurrence coefficients α, β. The keyword sym sets the name of the variable, and digits controls the number of shown digits.

julia> using PolyChaos
 
 julia> α, β = rm_hermite(5);
 
@@ -63,8 +63,8 @@
 x
 x^2 - 0.33
 x^3 - 0.6x
-x^4 - 0.86x^2 + 0.09
source

Both of these functions make excessive use of

PolyChaos.rec2coeffFunction
rec2coeff(deg::Int,a::Vector{<:Real},b::Vector{<:Real})
-rec2coeff(a,b) = rec2coeff(length(a),a,b)

Get the coefficients of the orthogonal polynomial of degree up to deg specified by its recurrence coefficients (a,b). The function returns the values $c_i^{(k)}$ from

\[p_k (t) = t^d + \sum_{i=0}^{k-1} c_i t^i,\]

where $k$ runs from 1 to deg.

The call rec2coeff(a,b) outputs all possible recurrence coefficients given (a,b).

source

Evaluate Orthogonal Polynomials

PolyChaos.evaluateFunction

Univariate

evaluate(n::Int,x::Array{<:Real},a::AbstractVector{<:Real},b::AbstractVector{<:Real})
+x^4 - 0.86x^2 + 0.09
source

Both of these functions make excessive use of

PolyChaos.rec2coeffFunction
rec2coeff(deg::Int,a::Vector{<:Real},b::Vector{<:Real})
+rec2coeff(a,b) = rec2coeff(length(a),a,b)

Get the coefficients of the orthogonal polynomial of degree up to deg specified by its recurrence coefficients (a,b). The function returns the values $c_i^{(k)}$ from

\[p_k (t) = t^d + \sum_{i=0}^{k-1} c_i t^i,\]

where $k$ runs from 1 to deg.

The call rec2coeff(a,b) outputs all possible recurrence coefficients given (a,b).

source

Evaluate Orthogonal Polynomials

PolyChaos.evaluateFunction

Univariate

evaluate(n::Int,x::Array{<:Real},a::AbstractVector{<:Real},b::AbstractVector{<:Real})
 evaluate(n::Int,x::Real,a::AbstractVector{<:Real},b::AbstractVector{<:Real})
 evaluate(n::Int,x::AbstractVector{<:Real},op::AbstractOrthoPoly)
 evaluate(n::Int,x::Real,op::AbstractOrthoPoly)

Evaluate the n-th univariate basis polynomial at point(s) x The function is multiple-dispatched to facilitate its use with the composite type AbstractOrthoPoly

If several basis polynomials (stored in ns) are to be evaluated at points x, then call

evaluate(ns::AbstractVector{<:Int},x::AbstractVector{<:Real},op::AbstractOrthoPoly) = evaluate(ns,x,op.α,op.β)
@@ -73,39 +73,39 @@
 evaluate(n::AbstractVector{<:Int},x::AbstractVector{<:Real},a::Vector{<:AbstractVector{<:Real}},b::Vector{<:AbstractVector{<:Real}})
 evaluate(n::AbstractVector{<:Int},x::AbstractMatrix{<:Real},op::MultiOrthoPoly)
 evaluate(n::AbstractVector{<:Int},x::AbstractVector{<:Real},op::MultiOrthoPoly)

Evaluate the n-th p-variate basis polynomial at point(s) x The function is multiply dispatched to facilitate its use with the composite type MultiOrthoPoly

If several basis polynomials are to be evaluated at points x, then call

evaluate(ind::AbstractMatrix{<:Int},x::AbstractMatrix{<:Real},a::Vector{<:AbstractVector{<:Real}},b::Vector{<:AbstractVector{<:Real}})
-evaluate(ind::AbstractMatrix{<:Int},x::AbstractMatrix{<:Real},op::MultiOrthoPoly)

where ind is a matrix of multi-indices.

If all basis polynomials are to be evaluated at points x, then call

evaluate(x::AbstractMatrix{<:Real},mop::MultiOrthoPoly) = evaluate(mop.ind,x,mop)

which returns an array of dimensions (mop.dim,size(x,1)).

Note
  • n is a multi-index
  • length(n) == p, i.e. a p-variate basis polynomial
  • size(x) = (N,p), where N is the number of points
  • size(a)==size(b)=p.
source

Scalar Products

PolyChaos.computeSP2Function
computeSP2(n::Integer,β::AbstractVector{<:Real})
+evaluate(ind::AbstractMatrix{<:Int},x::AbstractMatrix{<:Real},op::MultiOrthoPoly)

where ind is a matrix of multi-indices.

If all basis polynomials are to be evaluated at points x, then call

evaluate(x::AbstractMatrix{<:Real},mop::MultiOrthoPoly) = evaluate(mop.ind,x,mop)

which returns an array of dimensions (mop.dim,size(x,1)).

Note
  • n is a multi-index
  • length(n) == p, i.e. a p-variate basis polynomial
  • size(x) = (N,p), where N is the number of points
  • size(a)==size(b)=p.
source

Scalar Products

PolyChaos.computeSP2Function
computeSP2(n::Integer,β::AbstractVector{<:Real})
 computeSP2(n::Integer,op::AbstractOrthoPoly) = computeSP2(n,op.β)
-computeSP2(op::AbstractOrthoPoly) = computeSP2(op.deg,op.β)

Computes the n regular scalar products aka 2-norms of the orthogonal polynomials, namely

\[\|ϕ_i\|^2 = \langle \phi_i,\phi_i\rangle \quad \forall i \in \{ 0,\dots,n \}.\]

Notice that only the values of β of the recurrence coefficients (α,β) are required. The computation is based on equation (1.3.7) from Gautschi, W. "Orthogonal Polynomials: Computation and Approximation". Whenever there exists an analytical expression for β, this function should be used.

The function is multiple-dispatched to facilitate its use with AbstractOrthoPoly.

source
PolyChaos.computeSPFunction

Univariate

computeSP(a::AbstractVector{<:Integer},α::AbstractVector{<:Real},β::AbstractVector{<:Real},nodes::AbstractVector{<:Real},weights::AbstractVector{<:Real};issymmetric::Bool=false)
+computeSP2(op::AbstractOrthoPoly) = computeSP2(op.deg,op.β)

Computes the n regular scalar products aka 2-norms of the orthogonal polynomials, namely

\[\|ϕ_i\|^2 = \langle \phi_i,\phi_i\rangle \quad \forall i \in \{ 0,\dots,n \}.\]

Notice that only the values of β of the recurrence coefficients (α,β) are required. The computation is based on equation (1.3.7) from Gautschi, W. "Orthogonal Polynomials: Computation and Approximation". Whenever there exists an analytical expression for β, this function should be used.

The function is multiple-dispatched to facilitate its use with AbstractOrthoPoly.

source
PolyChaos.computeSPFunction

Univariate

computeSP(a::AbstractVector{<:Integer},α::AbstractVector{<:Real},β::AbstractVector{<:Real},nodes::AbstractVector{<:Real},weights::AbstractVector{<:Real};issymmetric::Bool=false)
 computeSP(a::AbstractVector{<:Integer},op::AbstractOrthoPoly;issymmetric=issymmetric(op))

Multivariate

computeSP( a::AbstractVector{<:Integer},
            α::AbstractVector{<:AbstractVector{<:Real}},β::AbstractVector{<:AbstractVector{<:Real}},
            nodes::AbstractVector{<:AbstractVector{<:Real}},weights::AbstractVector{<:AbstractVector{<:Real}},
            ind::AbstractMatrix{<:Integer};
            issymmetric::BitArray=falses(length(α)))
 computeSP(a::AbstractVector{<:Integer},op::AbstractVector,ind::AbstractMatrix{<:Integer})
-computeSP(a::AbstractVector{<:Integer},mOP::MultiOrthoPoly)

Computes the scalar product

\[\langle \phi_{a_1},\phi_{a_2},\cdots,\phi_{a_n} \rangle,\]

where n = length(a). This requires to provide the recurrence coefficients (α,β) and the quadrature rule (nodes,weights), as well as the multi-index ind. If provided via the keyword issymmetric, symmetry of the weight function is exploited. All computations of the multivariate scalar products resort back to efficient computations of the univariate scalar products. Mathematically, this follows from Fubini's theorem.

The function is dispatched to facilitate its use with AbstractOrthoPoly and its quadrature rule Quad.

Note
  • Zero entries of $a$ are removed automatically to simplify computations, which follows from

\[\langle \phi_i, \phi_j, \phi_0,\cdots,\phi_0 \rangle = \langle \phi_i, \phi_j \rangle,\]

because \phi_0 = 1.

  • It is checked whether enough quadrature points are supplied to solve the integral exactly.
source

Quadrature Rules

PolyChaos.quadgpFunction
quadgp(weight::Function,lb::Real,ub::Real,N::Int=10;quadrature::Function=clenshaw_curtis,bnd::Float64=Inf)

general purpose quadrature based on Gautschi, "Orthogonal Polynomials: Computation and Approximation", Section 2.2.2, pp. 93-95

Compute the N-point quadrature rule for weight with support (lb, ub). The quadrature rule can be specified by the keyword quadrature. The keyword bnd sets the numerical value for infinity.

source
PolyChaos.gaussFunction
gauss(N::Int,α::AbstractVector{<:Real},β::AbstractVector{<:Real})
+computeSP(a::AbstractVector{<:Integer},mOP::MultiOrthoPoly)

Computes the scalar product

\[\langle \phi_{a_1},\phi_{a_2},\cdots,\phi_{a_n} \rangle,\]

where n = length(a). This requires to provide the recurrence coefficients (α,β) and the quadrature rule (nodes,weights), as well as the multi-index ind. If provided via the keyword issymmetric, symmetry of the weight function is exploited. All computations of the multivariate scalar products resort back to efficient computations of the univariate scalar products. Mathematically, this follows from Fubini's theorem.

The function is dispatched to facilitate its use with AbstractOrthoPoly and its quadrature rule Quad.

Note
  • Zero entries of $a$ are removed automatically to simplify computations, which follows from

\[\langle \phi_i, \phi_j, \phi_0,\cdots,\phi_0 \rangle = \langle \phi_i, \phi_j \rangle,\]

because \phi_0 = 1.

  • It is checked whether enough quadrature points are supplied to solve the integral exactly.
source

Quadrature Rules

PolyChaos.quadgpFunction
quadgp(weight::Function,lb::Real,ub::Real,N::Int=10;quadrature::Function=clenshaw_curtis,bnd::Float64=Inf)

general purpose quadrature based on Gautschi, "Orthogonal Polynomials: Computation and Approximation", Section 2.2.2, pp. 93-95

Compute the N-point quadrature rule for weight with support (lb, ub). The quadrature rule can be specified by the keyword quadrature. The keyword bnd sets the numerical value for infinity.

source
PolyChaos.gaussFunction
gauss(N::Int,α::AbstractVector{<:Real},β::AbstractVector{<:Real})
 gauss(α::AbstractVector{<:Real},β::AbstractVector{<:Real})
 gauss(N::Int,op::Union{OrthoPoly,AbstractCanonicalOrthoPoly})
-gauss(op::Union{OrthoPoly,AbstractCanonicalOrthoPoly})

Gauss quadrature rule, also known as Golub-Welsch algorithm

gauss() generates the N Gauss quadrature nodes and weights for a given weight function. The weight function is represented by the N recurrence coefficients for the monic polynomials orthogonal with respect to the weight function.

Note

The function gauss accepts at most N = length(α) - 1 quadrature points, hence providing at most an (length(α) - 1)-point quadrature rule.

Note

If no N is provided, then N = length(α) - 1.

source
PolyChaos.radauFunction
radau(N::Int,α::AbstractVector{<:Real},β::AbstractVector{<:Real},end0::Real)
+gauss(op::Union{OrthoPoly,AbstractCanonicalOrthoPoly})

Gauss quadrature rule, also known as Golub-Welsch algorithm

gauss() generates the N Gauss quadrature nodes and weights for a given weight function. The weight function is represented by the N recurrence coefficients for the monic polynomials orthogonal with respect to the weight function.

Note

The function gauss accepts at most N = length(α) - 1 quadrature points, hence providing at most an (length(α) - 1)-point quadrature rule.

Note

If no N is provided, then N = length(α) - 1.

source
PolyChaos.radauFunction
radau(N::Int,α::AbstractVector{<:Real},β::AbstractVector{<:Real},end0::Real)
 radau(α::AbstractVector{<:Real},β::AbstractVector{<:Real},end0::Real)
 radau(N::Int,op::Union{OrthoPoly,AbstractCanonicalOrthoPoly},end0::Real)
-radau(op::Union{OrthoPoly,AbstractCanonicalOrthoPoly},end0::Real)

Gauss-Radau quadrature rule. Given a weight function encoded by the recurrence coefficients (α,β)for the associated orthogonal polynomials, the function generates the nodes and weights (N+1)-point Gauss-Radau quadrature rule for the weight function having a prescribed node end0 (typically at one of the end points of the support interval of w, or outside thereof).

Note

The function radau accepts at most N = length(α) - 2 as an input, hence providing at most an (length(α) - 1)-point quadrature rule.

Note

Reference: OPQ: A MATLAB SUITE OF PROGRAMS FOR GENERATING ORTHOGONAL POLYNOMIALS AND RELATED QUADRATURE RULES by Walter Gautschi

source
PolyChaos.lobattoFunction
lobatto(N::Int,α::AbstractVector{<:Real},β::AbstractVector{<:Real},endl::Real,endr::Real)
+radau(op::Union{OrthoPoly,AbstractCanonicalOrthoPoly},end0::Real)

Gauss-Radau quadrature rule. Given a weight function encoded by the recurrence coefficients (α,β)for the associated orthogonal polynomials, the function generates the nodes and weights (N+1)-point Gauss-Radau quadrature rule for the weight function having a prescribed node end0 (typically at one of the end points of the support interval of w, or outside thereof).

Note

The function radau accepts at most N = length(α) - 2 as an input, hence providing at most an (length(α) - 1)-point quadrature rule.

Note

Reference: OPQ: A MATLAB SUITE OF PROGRAMS FOR GENERATING ORTHOGONAL POLYNOMIALS AND RELATED QUADRATURE RULES by Walter Gautschi

source
PolyChaos.lobattoFunction
lobatto(N::Int,α::AbstractVector{<:Real},β::AbstractVector{<:Real},endl::Real,endr::Real)
 lobatto(α::AbstractVector{<:Real},β::AbstractVector{<:Real},endl::Real,endr::Real)
 lobatto(N::Int,op::Union{OrthoPoly,AbstractCanonicalOrthoPoly},endl::Real,endr::Real)
-lobatto(op::Union{OrthoPoly,AbstractCanonicalOrthoPoly},endl::Real,endr::Real)

Gauss-Lobatto quadrature rule. Given a weight function encoded by the recurrence coefficients for the associated orthogonal polynomials, the function generates the nodes and weights of the (N+2)-point Gauss-Lobatto quadrature rule for the weight function, having two prescribed nodes endl, endr (typically the left and right end points of the support interval, or points to the left resp. to the right thereof).

Note

The function radau accepts at most N = length(α) - 3 as an input, hence providing at most an (length(α) - 1)-point quadrature rule.

Note

Reference: OPQ: A MATLAB SUITE OF PROGRAMS FOR GENERATING ORTHOGONAL POLYNOMIALS AND RELATED QUADRATURE RULES by Walter Gautschi

source

Polynomial Chaos

Statistics.meanFunction

Univariate

mean(x::AbstractVector,op::AbstractOrthoPoly)

Multivariate

mean(x::AbstractVector,mop::MultiOrthoPoly)

compute mean of random variable with PCE x

source
Statistics.varFunction

Univariate

var(x::AbstractVector,op::AbstractOrthoPoly)
+lobatto(op::Union{OrthoPoly,AbstractCanonicalOrthoPoly},endl::Real,endr::Real)

Gauss-Lobatto quadrature rule. Given a weight function encoded by the recurrence coefficients for the associated orthogonal polynomials, the function generates the nodes and weights of the (N+2)-point Gauss-Lobatto quadrature rule for the weight function, having two prescribed nodes endl, endr (typically the left and right end points of the support interval, or points to the left resp. to the right thereof).

Note

The function radau accepts at most N = length(α) - 3 as an input, hence providing at most an (length(α) - 1)-point quadrature rule.

Note

Reference: OPQ: A MATLAB SUITE OF PROGRAMS FOR GENERATING ORTHOGONAL POLYNOMIALS AND RELATED QUADRATURE RULES by Walter Gautschi

source

Polynomial Chaos

Statistics.meanFunction

Univariate

mean(x::AbstractVector,op::AbstractOrthoPoly)

Multivariate

mean(x::AbstractVector,mop::MultiOrthoPoly)

compute mean of random variable with PCE x

source
Statistics.varFunction

Univariate

var(x::AbstractVector,op::AbstractOrthoPoly)
 var(x::AbstractVector,t2::Tensor)

Multivariate

var(x::AbstractVector,mop::MultiOrthoPoly)
-var(x::AbstractVector,t2::Tensor)

compute variance of random variable with PCE x

source
Statistics.stdFunction

Univariate

std(x::AbstractVector,op::AbstractOrthoPoly)

Multivariate

std(x::AbstractVector,mop::MultiOrthoPoly)

compute standard deviation of random variable with PCE x

source
PolyChaos.sampleMeasureFunction

Univariate

sampleMeasure(n::Int,name::String,w::Function,dom::Tuple{<:Real,<:Real},symm::Bool,d::Dict;method::String="adaptiverejection")
+var(x::AbstractVector,t2::Tensor)

compute variance of random variable with PCE x

source
Statistics.stdFunction

Univariate

std(x::AbstractVector,op::AbstractOrthoPoly)

Multivariate

std(x::AbstractVector,mop::MultiOrthoPoly)

compute standard deviation of random variable with PCE x

source
PolyChaos.sampleMeasureFunction

Univariate

sampleMeasure(n::Int,name::String,w::Function,dom::Tuple{<:Real,<:Real},symm::Bool,d::Dict;method::String="adaptiverejection")
 sampleMeasure(n::Int,m::Measure;method::String="adaptiverejection")
 sampleMeasure(n::Int,op::AbstractOrthoPoly;method::String="adaptiverejection")

Draw n samples from the measure m described by its

  • name
  • weight function w,
  • domain dom,
  • symmetry property symm,
  • and, if applicable, parameters stored in the dictionary d. By default, an adaptive rejection sampling method is used (from AdaptiveRejectionSampling.jl), unless it is a common random variable for which Distributions.jl is used.

The function is dispatched to accept AbstractOrthoPoly.

Multivariate

sampleMeasure(n::Int,m::ProductMeasure;method::Vector{String}=["adaptiverejection" for i=1:length(m.name)])
-sampleMeasure(n::Int,mop::MultiOrthoPoly;method::Vector{String}=["adaptiverejection" for i=1:length(mop.meas.name)])

Multivariate extension, which provides an array of samples with n rows and as many columns as the multimeasure has univariate measures.

source
PolyChaos.evaluatePCEFunction
evaluatePCE(x::AbstractVector{<:Real},ξ::AbstractVector{<:Real},α::AbstractVector{<:Real},β::AbstractVector{<:Real})

Evaluation of polynomial chaos expansion

\[\mathsf{x} = \sum_{i=0}^{L} x_i \phi_i{\xi_j},\]

where L+1 = length(x) and $x_j$ is the $j$th sample where $j=1,\dots,m$ with m = length(ξ).

source
PolyChaos.samplePCEFunction

Univariate

samplePCE(n::Int,x::AbstractVector{<:Real},op::AbstractOrthoPoly;method::String="adaptiverejection")

Combines sampleMeasure and evaluatePCE, i.e. it first draws n samples from the measure, then evaluates the PCE for those samples.

Multivariate

samplePCE(n::Int,x::AbstractVector{<:Real},mop::MultiOrthoPoly;method::Vector{String}=["adaptiverejection" for i=1:length(mop.meas.name)])
source
PolyChaos.calculateAffinePCEFunction
calculateAffinePCE(α::AbstractVector{<:Real})

Computes the affine PCE coefficients $x_0$ and $x_1$ from recurrence coefficients $lpha$.

source
PolyChaos.convert2affinePCEFunction
convert2affinePCE(mu::Real, sigma::Real, op::AbstractCanonicalOrthoPoly; kind::String)

Computes the affine PCE coefficients $x_0$ and $x_1$ from

\[X = a_1 + a_2 \Xi = x_0 + x_1 \phi_1(\Xi),\]

where $\phi_1(t) = t-\alpha_0$ is the first-order monic basis polynomial.

Works for subtypes of AbstractCanonicalOrthoPoly. The keyword kind in ["lbub", "μσ"] specifies whether p1 and p2 have the meaning of lower/upper bounds or mean/standard deviation.

source

Auxiliary Functions

PolyChaos.nwFunction
nw(q::EmptyQuad)
+sampleMeasure(n::Int,mop::MultiOrthoPoly;method::Vector{String}=["adaptiverejection" for i=1:length(mop.meas.name)])

Multivariate extension, which provides an array of samples with n rows and as many columns as the multimeasure has univariate measures.

source
PolyChaos.evaluatePCEFunction
evaluatePCE(x::AbstractVector{<:Real},ξ::AbstractVector{<:Real},α::AbstractVector{<:Real},β::AbstractVector{<:Real})

Evaluation of polynomial chaos expansion

\[\mathsf{x} = \sum_{i=0}^{L} x_i \phi_i{\xi_j},\]

where L+1 = length(x) and $x_j$ is the $j$th sample where $j=1,\dots,m$ with m = length(ξ).

source
PolyChaos.samplePCEFunction

Univariate

samplePCE(n::Int,x::AbstractVector{<:Real},op::AbstractOrthoPoly;method::String="adaptiverejection")

Combines sampleMeasure and evaluatePCE, i.e. it first draws n samples from the measure, then evaluates the PCE for those samples.

Multivariate

samplePCE(n::Int,x::AbstractVector{<:Real},mop::MultiOrthoPoly;method::Vector{String}=["adaptiverejection" for i=1:length(mop.meas.name)])
source
PolyChaos.calculateAffinePCEFunction
calculateAffinePCE(α::AbstractVector{<:Real})

Computes the affine PCE coefficients $x_0$ and $x_1$ from recurrence coefficients $lpha$.

source
PolyChaos.convert2affinePCEFunction
convert2affinePCE(mu::Real, sigma::Real, op::AbstractCanonicalOrthoPoly; kind::String)

Computes the affine PCE coefficients $x_0$ and $x_1$ from

\[X = a_1 + a_2 \Xi = x_0 + x_1 \phi_1(\Xi),\]

where $\phi_1(t) = t-\alpha_0$ is the first-order monic basis polynomial.

Works for subtypes of AbstractCanonicalOrthoPoly. The keyword kind in ["lbub", "μσ"] specifies whether p1 and p2 have the meaning of lower/upper bounds or mean/standard deviation.

source

Auxiliary Functions

PolyChaos.nwFunction
nw(q::EmptyQuad)
 nw(q::AbstractQuad)
 nw(opq::AbstractOrthoPoly)
 nw(opq::AbstractVector)
-nw(mop::MultiOrthoPoly)

returns nodes and weights in matrix form

source
PolyChaos.coeffsFunction
coeffs(op::AbstractOrthoPoly)
+nw(mop::MultiOrthoPoly)

returns nodes and weights in matrix form

source
PolyChaos.coeffsFunction
coeffs(op::AbstractOrthoPoly)
 coeffs(op::AbstractVector)
-coeffs(mop::MultiOrthoPoly)

returns recurrence coefficients of in matrix form

source
PolyChaos.integrateFunction
integrate(f::Function,nodes::AbstractVector{<:Real},weights::AbstractVector{<:Real})
+coeffs(mop::MultiOrthoPoly)

returns recurrence coefficients of in matrix form

source
PolyChaos.integrateFunction
integrate(f::Function,nodes::AbstractVector{<:Real},weights::AbstractVector{<:Real})
 integrate(f::Function,q::AbstractQuad)
 integrate(f::Function,opq::AbstractOrthoPoly)

integrate function f using quadrature rule specified via nodes, weights. For example $\int_0^1 6x^5 = 1$ can be solved as follows:

julia> opq = Uniform01OrthoPoly(3) # a quadrature rule is added by default
 
 julia> integrate(x -> 6x^5, opq)
-0.9999999999999993
Note
  • function $f$ is assumed to return a scalar.
  • interval of integration is "hidden" in nodes.
source
LinearAlgebra.issymmetricFunction
issymmetric(m::AbstractMeasure)
-issymmetric(op::AbstractOrthoPoly)

Is the measure symmetric (around any point in the domain)?

source
+0.9999999999999993
Note
  • function $f$ is assumed to return a scalar.
  • interval of integration is "hidden" in nodes.
source
LinearAlgebra.issymmetricFunction
issymmetric(m::AbstractMeasure)
+issymmetric(op::AbstractOrthoPoly)

Is the measure symmetric (around any point in the domain)?

source
diff --git a/dev/gaussian_mixture_model/index.html b/dev/gaussian_mixture_model/index.html index 437473b..a2e2b77 100644 --- a/dev/gaussian_mixture_model/index.html +++ b/dev/gaussian_mixture_model/index.html @@ -13,47 +13,47 @@ ylabel!("rho(x)"); - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +

This looks nice!

What are now the polynomials that are orthogonal relative to this specific density?

using PolyChaos
 deg = 4
 meas = Measure("my_GaussMixture", ρ, (-Inf, Inf), false, Dict(:μ => μ, :σ => σ)) # build measure
@@ -68,4 +68,4 @@
  0.0  0.1875  0.0     0.0        0.0
  0.0  0.0     0.0385  0.0        0.0
  0.0  0.0     0.0     0.0128086  0.0
- 0.0  0.0     0.0     0.0        0.00485189

Great!

+ 0.0 0.0 0.0 0.0 0.00485189

Great!

diff --git a/dev/index.html b/dev/index.html index 519bfd4..67adc67 100644 --- a/dev/index.html +++ b/dev/index.html @@ -37,10 +37,10 @@ eprint = {2004.03970}, }

Of course, you are more than welcome to partake in GitHub's gamification: starring and forking is much appreciated.

Enjoy.

Reproducibility

The documentation of this SciML package was built using these direct dependencies,
Status `~/work/PolyChaos.jl/PolyChaos.jl/docs/Project.toml`
   [1520ce14] AbstractTrees v0.4.4
-  [0c46a032] DifferentialEquations v7.11.0
+  [0c46a032] DifferentialEquations v7.12.0
 ⌅ [e30172f5] Documenter v0.27.25
 ⌅ [28b8d3ca] GR v0.72.10
-  [4076af6c] JuMP v1.17.0
+  [4076af6c] JuMP v1.18.1
   [b964fa9f] LaTeXStrings v1.3.1
 ⌅ [1ec41992] MosekTools v0.14.0
   [91a5bcdd] Plots v1.39.0
@@ -48,8 +48,8 @@
   [1fd47b50] QuadGK v2.9.1
   [276daf66] SpecialFunctions v2.3.1
   [37e2e46d] LinearAlgebra
-Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`
and using this machine and Julia version.
Julia Version 1.9.4
-Commit 8e5136fa297 (2023-11-14 08:46 UTC)
+Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`
and using this machine and Julia version.
Julia Version 1.10.0
+Commit 3120989f39b (2023-12-25 18:01 UTC)
 Build Info:
   Official https://julialang.org/ release
 Platform Info:
@@ -57,23 +57,22 @@
   CPU: 4 × AMD EPYC 7763 64-Core Processor
   WORD_SIZE: 64
   LIBM: libopenlibm
-  LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
+  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
   Threads: 1 on 4 virtual cores
A more complete overview of all dependencies and their versions is also provided.
Status `~/work/PolyChaos.jl/PolyChaos.jl/docs/Manifest.toml`
-  [47edcb42] ADTypes v0.2.5
+  [47edcb42] ADTypes v0.2.6
   [a4c015fc] ANSIColoredPrinters v0.0.1
   [621f4979] AbstractFFTs v1.5.0
   [1520ce14] AbstractTrees v0.4.4
-  [7d9f7c33] Accessors v0.1.33
-  [79e6a3ab] Adapt v3.7.2
+⌅ [79e6a3ab] Adapt v3.7.2
 ⌅ [c75e803d] AdaptiveRejectionSampling v0.1.2
   [ec485272] ArnoldiMethod v0.2.0
-  [4fba245c] ArrayInterface v7.6.1
-  [4c555306] ArrayLayouts v1.4.5
+  [4fba245c] ArrayInterface v7.7.0
+  [4c555306] ArrayLayouts v1.5.1
   [aae01518] BandedMatrices v1.4.0
   [6e4b80f9] BenchmarkTools v1.4.0
   [d1d4a3ce] BitFlags v0.1.8
   [62783981] BitTwiddlingConvenienceFunctions v0.1.5
-  [764a87c0] BoundaryValueDiffEq v5.6.0
+⌃ [764a87c0] BoundaryValueDiffEq v5.6.0
   [fa961155] CEnum v0.5.0
   [2a0fbf3d] CPUSummary v0.2.4
   [49dc2e85] Calculus v0.5.1
@@ -88,31 +87,30 @@
   [38540f10] CommonSolve v0.2.4
   [bbf7d656] CommonSubexpressions v0.3.0
   [34da2185] Compat v4.10.1
-  [a33af91c] CompositionsBase v0.1.2
   [2569d6c7] ConcreteStructs v0.2.3
   [f0e56b4a] ConcurrentUtilities v2.3.0
   [187b0558] ConstructionBase v1.5.4
   [d38c429a] Contour v0.6.2
   [adafc99b] CpuId v0.3.1
   [9a962f9c] DataAPI v1.15.0
-  [864edb3b] DataStructures v0.18.15
+  [864edb3b] DataStructures v0.18.16
   [e2d170a0] DataValueInterfaces v1.0.0
-⌃ [bcd4f6db] DelayDiffEq v5.44.0
+  [bcd4f6db] DelayDiffEq v5.45.1
   [8bb1440f] DelimitedFiles v1.9.1
-  [2b5f629d] DiffEqBase v6.144.0
-  [459566f4] DiffEqCallbacks v2.35.0
+  [2b5f629d] DiffEqBase v6.145.6
+  [459566f4] DiffEqCallbacks v2.36.1
   [77a26b50] DiffEqNoiseProcess v5.20.0
   [163ba53b] DiffResults v1.1.0
   [b552c78f] DiffRules v1.15.1
-  [0c46a032] DifferentialEquations v7.11.0
+  [0c46a032] DifferentialEquations v7.12.0
   [b4f34e82] Distances v0.10.11
-  [31c24e10] Distributions v0.25.104
+  [31c24e10] Distributions v0.25.106
   [ffbed154] DocStringExtensions v0.9.3
 ⌅ [e30172f5] Documenter v0.27.25
   [fa6b7ba4] DualNumbers v0.6.8
   [4e289a0a] EnumX v1.0.4
-  [f151be2c] EnzymeCore v0.6.4
-  [460bff9d] ExceptionUnwrapping v0.1.9
+  [f151be2c] EnzymeCore v0.6.5
+  [460bff9d] ExceptionUnwrapping v0.1.10
   [d4d017d3] ExponentialUtilities v1.25.0
   [e2ba6199] ExprTools v0.1.10
   [c87230d0] FFMPEG v0.4.1
@@ -122,14 +120,14 @@
   [9aa1b823] FastClosures v0.3.2
   [29a986be] FastLapackInterface v2.0.0
   [1a297f60] FillArrays v1.9.3
-  [6a86dc24] FiniteDiff v2.21.1
+  [6a86dc24] FiniteDiff v2.22.0
   [53c48c17] FixedPointNumbers v0.8.4
   [59287772] Formatting v0.4.2
   [f6369f11] ForwardDiff v0.10.36
   [069b7b12] FunctionWrappers v1.1.3
   [77dc65aa] FunctionWrappersWrappers v0.1.3
   [d9f16b24] Functors v0.4.5
-  [46192b85] GPUArraysCore v0.1.5
+⌃ [46192b85] GPUArraysCore v0.1.5
 ⌅ [28b8d3ca] GR v0.72.10
   [d54b0c1a] GaussQuadrature v0.5.8
   [c145ed77] GenericSchur v0.5.3
@@ -141,33 +139,31 @@
   [b5f81e59] IOCapture v0.2.3
   [615f187c] IfElse v0.1.1
   [d25df0c9] Inflate v0.1.4
-  [18e54dd8] IntegerMathUtils v0.1.2
-  [3587e190] InverseFunctions v0.1.12
   [92d709cd] IrrationalConstants v0.2.2
   [82899510] IteratorInterfaceExtensions v1.0.0
   [1019f520] JLFzf v0.1.7
   [692b3bcd] JLLWrappers v1.5.0
   [682c06a0] JSON v0.21.4
-  [4076af6c] JuMP v1.17.0
+  [4076af6c] JuMP v1.18.1
   [ccbc3e58] JumpProcesses v9.10.1
   [ef3ab10e] KLU v0.4.1
   [ba0b0d4f] Krylov v0.9.5
   [b964fa9f] LaTeXStrings v1.3.1
   [23fbe1c1] Latexify v0.16.1
-  [73f95e8e] LatticeRules v0.0.1
   [10f19ff3] LayoutPointers v0.1.15
   [50d2b5c4] Lazy v0.15.1
   [5078a376] LazyArrays v1.8.3
   [2d8b4e74] LevyArea v1.0.0
   [d3d80556] LineSearches v7.2.0
-  [7ed4a6bd] LinearSolve v2.21.0
+  [7ed4a6bd] LinearSolve v2.22.1
   [2ab3a3ac] LogExpFunctions v0.3.26
   [e6f89c97] LoggingExtras v1.0.3
   [bdcacae8] LoopVectorization v0.12.166
-  [1914dd2f] MacroTools v0.5.11
+  [1914dd2f] MacroTools v0.5.12
   [d125e4d3] ManualMemory v0.1.8
-  [b8f27783] MathOptInterface v1.23.0
+  [b8f27783] MathOptInterface v1.25.0
   [a3b82374] MatrixFactorizations v2.1.0
+  [bb5d69b7] MaybeInplace v0.1.1
   [739be429] MbedTLS v1.1.9
   [442fdcdd] Measures v0.3.2
   [e1d29d7a] Missings v1.1.0
@@ -178,36 +174,34 @@
   [d41bc354] NLSolversBase v7.8.3
   [2774e3e8] NLsolve v4.5.1
   [77ba4419] NaNMath v1.0.2
-⌅ [8913a72c] NonlinearSolve v2.8.2
-  [6fe1bfb0] OffsetArrays v1.12.10
+  [8913a72c] NonlinearSolve v3.4.0
+  [6fe1bfb0] OffsetArrays v1.13.0
   [4d8831e6] OpenSSL v1.4.1
   [429524aa] Optim v1.7.8
   [bac558e1] OrderedCollections v1.6.3
-⌃ [1dea7af3] OrdinaryDiffEq v6.59.3
+  [1dea7af3] OrdinaryDiffEq v6.69.0
   [90014a1f] PDMats v0.11.31
   [65ce6f38] PackageExtensionCompat v1.0.2
   [d96e819e] Parameters v0.12.3
-  [69de0a69] Parsers v2.8.0
+  [69de0a69] Parsers v2.8.1
   [b98c9c47] Pipe v1.3.0
   [ccf2f8ad] PlotThemes v3.1.0
-  [995b91a9] PlotUtils v1.3.5
+  [995b91a9] PlotUtils v1.4.0
   [91a5bcdd] Plots v1.39.0
   [e409e4f3] PoissonRandom v0.4.4
   [8d666b04] PolyChaos v0.2.11 `~/work/PolyChaos.jl/PolyChaos.jl`
   [f517fe37] Polyester v0.7.9
   [1d0040c9] PolyesterWeave v0.2.1
   [85a6dd25] PositiveFactorizations v0.2.4
-  [d236fae5] PreallocationTools v0.4.13
+  [d236fae5] PreallocationTools v0.4.17
   [aea7be01] PrecompileTools v1.2.0
   [21216c6a] Preferences v1.4.1
-  [27ebfcd6] Primes v0.5.5
   [1fd47b50] QuadGK v2.9.1
-  [8a4e6c94] QuasiMonteCarlo v0.3.3
-  [74087812] Random123 v1.6.1
+  [74087812] Random123 v1.6.2
   [e6cf234a] RandomNumbers v1.5.3
   [3cdcf5f2] RecipesBase v1.3.4
   [01d81517] RecipesPipeline v0.6.12
-⌅ [731186ca] RecursiveArrayTools v2.38.10
+  [731186ca] RecursiveArrayTools v3.4.2
   [f2c3362d] RecursiveFactorization v0.2.21
   [189a3867] Reexport v1.2.2
   [05181044] RelocatableFolders v1.0.1
@@ -217,34 +211,31 @@
   [7e49a35a] RuntimeGeneratedFunctions v0.5.12
   [94e857df] SIMDTypes v0.1.0
   [476501e8] SLEEFPirates v0.6.42
-⌃ [0bca4576] SciMLBase v2.10.0
-  [e9a6253c] SciMLNLSolve v0.1.9
+  [0bca4576] SciMLBase v2.17.0
   [c0aeaf25] SciMLOperators v0.3.7
   [6c6a2e73] Scratch v1.2.1
   [efcf1570] Setfield v1.1.1
   [992d4aef] Showoff v1.0.3
   [777ac1f9] SimpleBufferStream v1.1.0
-⌅ [727e6d20] SimpleNonlinearSolve v0.1.25
+  [727e6d20] SimpleNonlinearSolve v1.2.0
   [699a6c99] SimpleTraits v0.9.4
   [ce78b400] SimpleUnPack v1.1.0
-  [66db9d55] SnoopPrecompile v1.0.3
-  [ed01d8cd] Sobol v1.5.0
-  [a2af1166] SortingAlgorithms v1.2.0
+  [a2af1166] SortingAlgorithms v1.2.1
   [47a9eef4] SparseDiffTools v2.15.0
   [e56a9233] Sparspak v0.3.9
   [276daf66] SpecialFunctions v2.3.1
   [aedffcd0] Static v0.8.8
   [0d7ed370] StaticArrayInterface v1.5.0
-  [90137ffa] StaticArrays v1.8.1
+  [90137ffa] StaticArrays v1.9.0
   [1e83bf80] StaticArraysCore v1.4.2
   [82ae8749] StatsAPI v1.7.0
   [2913bbd2] StatsBase v0.34.2
   [4c63d2b9] StatsFuns v1.3.0
-⌅ [9672c7b4] SteadyStateDiffEq v1.16.1
+  [9672c7b4] SteadyStateDiffEq v2.0.1
   [789caeaf] StochasticDiffEq v6.64.0
   [7792a7ef] StrideArraysCore v0.5.2
-  [c3572dad] Sundials v4.22.1
-⌅ [2efcf032] SymbolicIndexingInterface v0.2.2
+  [c3572dad] Sundials v4.23.1
+  [2efcf032] SymbolicIndexingInterface v0.3.3
   [3783bdb8] TableTraits v1.0.1
   [bd369af6] Tables v1.11.1
   [62fd8b95] TensorCore v0.1.1
@@ -270,17 +261,17 @@
   [a3f928ae] Fontconfig_jll v2.13.93+0
   [d7e528f0] FreeType2_jll v2.13.1+0
   [559328eb] FriBidi_jll v1.0.10+0
-  [0656b61e] GLFW_jll v3.3.8+0
+  [0656b61e] GLFW_jll v3.3.9+0
 ⌅ [d2c73de3] GR_jll v0.72.10+0
   [78b55507] Gettext_jll v0.21.0+0
   [7746bdde] Glib_jll v2.76.5+0
   [3b182d85] Graphite2_jll v1.3.14+0
   [2e76f6c2] HarfBuzz_jll v2.8.1+1
-  [1d5cc7b8] IntelOpenMP_jll v2024.0.0+0
+  [1d5cc7b8] IntelOpenMP_jll v2024.0.2+0
   [aacddb02] JpegTurbo_jll v3.0.1+0
   [c1c5ebd0] LAME_jll v3.100.1+0
   [88015f11] LERC_jll v3.0.0+1
-  [1d63c593] LLVMOpenMP_jll v15.0.4+0
+  [1d63c593] LLVMOpenMP_jll v15.0.7+0
   [dd4b983a] LZO_jll v2.10.1+0
 ⌅ [e9f186c6] Libffi_jll v3.2.2+1
   [d4300ac3] Libgcrypt_jll v1.8.7+0
@@ -298,10 +289,10 @@
   [30392449] Pixman_jll v0.42.2+0
   [c0090381] Qt6Base_jll v6.5.3+1
   [f50d1b31] Rmath_jll v0.4.0+0
-⌅ [fb77eaff] Sundials_jll v5.2.1+0
+⌅ [fb77eaff] Sundials_jll v5.2.2+0
   [a44049a8] Vulkan_Loader_jll v1.3.243+0
   [a2964d1f] Wayland_jll v1.21.0+1
-  [2381bf8a] Wayland_protocols_jll v1.25.0+0
+  [2381bf8a] Wayland_protocols_jll v1.31.0+0
   [02c8fc9c] XML2_jll v2.12.2+0
   [aed1982a] XSLT_jll v1.1.34+0
   [ffd25f8a] XZ_jll v5.4.5+0
@@ -362,7 +353,7 @@
   [d6f4376e] Markdown
   [a63ad114] Mmap
   [ca575930] NetworkOptions v1.2.0
-  [44cfe95a] Pkg v1.9.2
+  [44cfe95a] Pkg v1.10.0
   [de0858da] Printf
   [9abbd945] Profile
   [3fa0cd96] REPL
@@ -371,27 +362,28 @@
   [9e88b42a] Serialization
   [1a1011a3] SharedArrays
   [6462fe0b] Sockets
-  [2f01184e] SparseArrays
-  [10745b16] Statistics v1.9.0
+  [2f01184e] SparseArrays v1.10.0
+  [10745b16] Statistics v1.10.0
   [4607b0f0] SuiteSparse
   [fa267f1f] TOML v1.0.3
   [a4e569a6] Tar v1.10.0
   [8dfed614] Test
   [cf7118a7] UUIDs
   [4ec0a83e] Unicode
-  [e66e0078] CompilerSupportLibraries_jll v1.0.5+0
+  [e66e0078] CompilerSupportLibraries_jll v1.0.5+1
   [deac9b47] LibCURL_jll v8.4.0+0
+  [e37daf67] LibGit2_jll v1.6.4+0
   [29816b5a] LibSSH2_jll v1.11.0+1
-  [c8ffd9c3] MbedTLS_jll v2.28.2+0
-  [14a3606d] MozillaCACerts_jll v2022.10.11
-  [4536629a] OpenBLAS_jll v0.3.21+4
-  [05823500] OpenLibm_jll v0.8.1+0
-  [efcefdf7] PCRE2_jll v10.42.0+0
-  [bea87d4a] SuiteSparse_jll v5.10.1+6
-  [83775a58] Zlib_jll v1.2.13+0
-  [8e850b90] libblastrampoline_jll v5.8.0+0
+  [c8ffd9c3] MbedTLS_jll v2.28.2+1
+  [14a3606d] MozillaCACerts_jll v2023.1.10
+  [4536629a] OpenBLAS_jll v0.3.23+2
+  [05823500] OpenLibm_jll v0.8.1+2
+  [efcefdf7] PCRE2_jll v10.42.0+1
+  [bea87d4a] SuiteSparse_jll v7.2.1+1
+  [83775a58] Zlib_jll v1.2.13+1
+  [8e850b90] libblastrampoline_jll v5.8.0+1
   [8e850ede] nghttp2_jll v1.52.0+1
-  [3f19e933] p7zip_jll v17.4.0+0
+  [3f19e933] p7zip_jll v17.4.0+2
 Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
You can also download the manifest file and the -project file. +project file. diff --git a/dev/math/index.html b/dev/math/index.html index bf94ccd..b11f999 100644 --- a/dev/math/index.html +++ b/dev/math/index.html @@ -17,4 +17,4 @@ \end{aligned}\]

Note

Within the package, the coefficients (α,β) are the building block to represent (monic) orthogonal polynomials.

Notice that $\beta_0$ is arbitrary. Nevertheless, it is convenient to define it as

\[\beta_0(\mathrm{d}\lambda) = \langle \pi_0, \pi_0 \rangle_{\mathrm{d} \lambda} = \int_{\mathcal{W}} \mathrm{d} \lambda (t),\]

because it allows to compute the norms of the polynomials based on $\beta_k$ alone

\[\| \pi_n \|_{\mathrm{d} \lambda} = \beta_n(\mathrm{d} \lambda) \beta_{n-1}(\mathrm{d} \lambda) \cdots \beta_0(\mathrm{d} \lambda), \quad n = 0,1, \dots\]

Let the support be $\mathcal{W} = [a,b]$ for $0 < a,b < \infty$, then

\[\begin{aligned} & a < \alpha_k(\mathrm{d} \lambda) < b && k = 0,1,2, \dots \\ & 0 < \beta_k(\mathrm{d} \lambda) < \max(a^2, b^2) && k = 1, 2, \dots -\end{aligned}\]

Quadrature Rules

An $n$-point quadrature rule for the measure $\mathrm{d} \lambda t$ is a formula of the form

\[\int_{\mathcal{W}} f(t) \mathrm{d} \lambda(t) = \sum_{\nu = 1}^{n} w_\nu f(\tau_\nu) + R_n(f).\]

The quadrature rule $\{ (\tau_\nu, w_\nu) \}_{\nu=1}^n$ composed of (mutually distinct) nodes $\tau_\nu$ and weights $w_\nu$ provides an approximation to the integral. The respective error is given by $R_n(f)$. If, for polynomials $p \in \mathcal{P}_d$, the error $R_n(p)$ vanishes, the respective quadrature rule is said to have a degree of exactness $d$. Gauss quadrature rule are special quadrature rules that have a degree of exactness $d = 2n - 1$. That means, taking a $n =3$-point quadrature rule, polynomials up to degree 5 can be integrated exactly. The nodes and weights for the Gauss quadrature rules have some remarkable properties:

  • all Gauss nodes are mutually distinct and contained in the interior of the support of $\mathrm{d} \lambda$;
  • the $n$ Gauss nodes are the zeros of $\pi_n$, the monic orthogonal polynomial of degree $n$ relative to the measure $\mathrm{d} \lambda$;
  • all Gauss weights are positive.

The Gauss nodes and weights can be computed using the Golub-Welsch algorithm. This means to solve an eigenvalue problem of a symmetric tridiagonal matrix.

+\end{aligned}\]

Quadrature Rules

An $n$-point quadrature rule for the measure $\mathrm{d} \lambda t$ is a formula of the form

\[\int_{\mathcal{W}} f(t) \mathrm{d} \lambda(t) = \sum_{\nu = 1}^{n} w_\nu f(\tau_\nu) + R_n(f).\]

The quadrature rule $\{ (\tau_\nu, w_\nu) \}_{\nu=1}^n$ composed of (mutually distinct) nodes $\tau_\nu$ and weights $w_\nu$ provides an approximation to the integral. The respective error is given by $R_n(f)$. If, for polynomials $p \in \mathcal{P}_d$, the error $R_n(p)$ vanishes, the respective quadrature rule is said to have a degree of exactness $d$. Gauss quadrature rule are special quadrature rules that have a degree of exactness $d = 2n - 1$. That means, taking a $n =3$-point quadrature rule, polynomials up to degree 5 can be integrated exactly. The nodes and weights for the Gauss quadrature rules have some remarkable properties:

  • all Gauss nodes are mutually distinct and contained in the interior of the support of $\mathrm{d} \lambda$;
  • the $n$ Gauss nodes are the zeros of $\pi_n$, the monic orthogonal polynomial of degree $n$ relative to the measure $\mathrm{d} \lambda$;
  • all Gauss weights are positive.

The Gauss nodes and weights can be computed using the Golub-Welsch algorithm. This means to solve an eigenvalue problem of a symmetric tridiagonal matrix.

diff --git a/dev/multiple_discretization/index.html b/dev/multiple_discretization/index.html index 0af6173..ac1c54e 100644 --- a/dev/multiple_discretization/index.html +++ b/dev/multiple_discretization/index.html @@ -13,20 +13,20 @@ N = 1000; nodes, weights = fejer(N); int_fejer = dot(weights, my_w.(nodes, γ)) -print("Fejer error:\t$(abs(int_exact - int_fejer))\twith $N nodes")
Fejer error:	0.00034489625618583375	with 1000 nodes

Clearly, that is not satisfying. Well, the term $\gamma$ of the weight $w$ makes us think of Gauss-Legendre integration, so let's try it instead.

function quad_gaussleg(N, γ)
+print("Fejer error:\t$(abs(int_exact - int_fejer))\twith $N nodes")
Fejer error:	0.00034489625618583375	with 1000 nodes

Clearly, that is not satisfying. Well, the term $\gamma$ of the weight $w$ makes us think of Gauss-Legendre integration, so let's try it instead.

function quad_gaussleg(N, γ)
     a, b = rm_legendre(N)
     nodes, weights = golubwelsch(a, b)
 end
 nodes, weights = quad_gaussleg(N + 1, γ)
 int_gaussleg = dot(weights, γ .+ (1 - γ) / sqrt.(1 .- nodes .^ 2))
-print("Gauss-Legendre error:\t$(abs(int_exact-int_gaussleg))\twith $N nodes")
Gauss-Legendre error:	1.5692263158654431	with 1000 nodes

Even worse! Well, we can factor out $\frac{1}{\sqrt{1-t^2}}$, making the integral amenable to a Gauss-Chebyshev rule. So, let's give it another try.

function quad_gausscheb(N, γ)
+print("Gauss-Legendre error:\t$(abs(int_exact-int_gaussleg))\twith $N nodes")

Even worse! Well, we can factor out $\frac{1}{\sqrt{1-t^2}}$, making the integral amenable to a Gauss-Chebyshev rule. So, let's give it another try.

function quad_gausscheb(N, γ)
     a, b = rm_chebyshev1(N)
     nodes, weights = golubwelsch(a, b)
 end
 nodes, weights = quad_gausscheb(N + 1, γ)
 int_gausscheb = dot(weights, γ .+ (1 - γ) * sqrt.(1 .- nodes .^ 2))
 # int=sum(xw(:,2).*(1+sqrt(1-xw(:,1).^2)))
-print("Gauss-Chebyshev error:\t$(abs(int_exact - int_gausscheb))\twith $(length(n)) nodes")
Gauss-Chebyshev error:	4.1123363647699307e-7	with 7 nodes

Okay, that's better, but it took us a lot of nodes to get this result. Is there a different way? Indeed, there is. As we have noticed, the weight $w$ has a lot in common with Gauss-Legendre and Gauss-Chebyshev. We can decompose the integral as follows

\[\int_{-1}^1 f(t) w(t) \mathrm{d}t = \sum_{i=1}^{m} \int_{-1}^{1} f(t) w_i(t) \mathrm{d} t,\]

with

\[\begin{align*} +print("Gauss-Chebyshev error:\t$(abs(int_exact - int_gausscheb))\twith $(length(n)) nodes")

Gauss-Chebyshev error:	4.1123363647699307e-7	with 1000 nodes

Okay, that's better, but it took us a lot of nodes to get this result. Is there a different way? Indeed, there is. As we have noticed, the weight $w$ has a lot in common with Gauss-Legendre and Gauss-Chebyshev. We can decompose the integral as follows

\[\int_{-1}^1 f(t) w(t) \mathrm{d}t = \sum_{i=1}^{m} \int_{-1}^{1} f(t) w_i(t) \mathrm{d} t,\]

with

\[\begin{align*} w_1(t) &= \gamma \\ w_2(t) &= (1-\gamma) \frac{1}{\sqrt{1-t^2}}. \end{align*}\]

To the weight $w_1$ we can apply Gauss-Legendre quadrature, to the weight $w_2$ we can apply Gauss-Chebyshev quadrature (with tiny modifications). This discretization of the measure can be used in our favor. The function mcdiscretization() takes the $m$ discretization rules as an input

function quad_gaussleg_mod(N, γ)
@@ -42,7 +42,7 @@
 a, b = mcdiscretization(N, [n -> quad_gaussleg_mod(n, γ); n -> quad_gausscheb_mod(n, γ)])
 nodes, weights = golubwelsch(a, b)
 int_mc = sum(w)
-print("Discretization error:\t$(abs(int_exact-int_mc))\twith $(length(n)) nodes")
Discretization error:	1.3322676295501878e-15	with 7 nodes

Et voilà, no error with fewer nodes. (For this example, we'd need just a single node.)

The function mcdiscretization() is able to construct the recurrence coefficients of the orthogonal polynomials relative to the weight $w$. Let's inspect the values of the recurrence coefficients a little more. For $\gamma = 0$, we are in the world of Chebyshev polynomials, for $\gamma = 1$, we enter the realm of Legendre polynomials. And in between? That's exactly where the weight $w$ comes in: it can be thought of as an interpolatory weight, interpolating Legendre polynomials and Chebyshev polynomials. Let's verify this by plotting the recurrence coefficients for several values of $\gamma$.

Γ = 0:0.1:1;
+print("Discretization error:\t$(abs(int_exact-int_mc))\twith $(length(n)) nodes")
Discretization error:	0.5707963267948966	with 1000 nodes

Et voilà, no error with fewer nodes. (For this example, we'd need just a single node.)

The function mcdiscretization() is able to construct the recurrence coefficients of the orthogonal polynomials relative to the weight $w$. Let's inspect the values of the recurrence coefficients a little more. For $\gamma = 0$, we are in the world of Chebyshev polynomials, for $\gamma = 1$, we enter the realm of Legendre polynomials. And in between? That's exactly where the weight $w$ comes in: it can be thought of as an interpolatory weight, interpolating Legendre polynomials and Chebyshev polynomials. Let's verify this by plotting the recurrence coefficients for several values of $\gamma$.

Γ = 0:0.1:1;
 ab = [mcdiscretization(N,
                        [n -> quad_gaussleg_mod(n, gam); n -> quad_gausscheb_mod(n, gam)])
       for gam in Γ];
@@ -75,89 +75,89 @@
 ylabel!("Beta")
- + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -

The crosses denote the values of the β recursion coefficients for Chebyshev polynomials; the circles the β recursion coefficients for Legendre polynomials. The interpolating line in between stands for the β recursion coefficients of $w(t; \gamma)$.

+

The crosses denote the values of the β recursion coefficients for Chebyshev polynomials; the circles the β recursion coefficients for Legendre polynomials. The interpolating line in between stands for the β recursion coefficients of $w(t; \gamma)$.

diff --git a/dev/numerical_integration/index.html b/dev/numerical_integration/index.html index df502fc..d226567 100644 --- a/dev/numerical_integration/index.html +++ b/dev/numerical_integration/index.html @@ -56,4 +56,4 @@ julia> print("Numerical error: $(abs(1 - cos(1) - variant0_revisited))") Numerical error: 1.8818280267396403e-13

Comparison

We see that the different variants provide slightly different results:

julia> 1 - cos(1) .- [variant0 variant1 variant0_revisited]
 1×3 Array{Float64,2}:
- -1.88183e-13  -9.85725e-8  -1.88183e-13

with variant0 and variant0_revisited being the same and more accurate than variant1. The increased accuracy is based on the fact that for variant0 and variant0_revisited the quadrature rules are based on the recursion coefficients of the underlying orthogonal polynomials. The quadrature for variant1 is based on a general-purpose method that can be significantly less accurate, see also the next tutorial.

+ -1.88183e-13 -9.85725e-8 -1.88183e-13

with variant0 and variant0_revisited being the same and more accurate than variant1. The increased accuracy is based on the fact that for variant0 and variant0_revisited the quadrature rules are based on the recursion coefficients of the underlying orthogonal polynomials. The quadrature for variant1 is based on a general-purpose method that can be significantly less accurate, see also the next tutorial.

diff --git a/dev/orthogonal_polynomials_canonical/index.html b/dev/orthogonal_polynomials_canonical/index.html index b566869..1b3649f 100644 --- a/dev/orthogonal_polynomials_canonical/index.html +++ b/dev/orthogonal_polynomials_canonical/index.html @@ -131,4 +131,4 @@ 0 1 0 - 1

translates mathematically to

\[\psi_{11}(t) = \pi_0^{(1)}(t_1) \pi_1^{(2)}(t_2) \pi_0^{(3)}(t_3) \pi_1^{(4)}(t_4).\]

Notice that there is an offset by one, because the basis counting starts at 0, but Julia is 1-indexed. The underlying measure of mop is now of type ProductMeasure, and stored in the field measure The weight $w$ can be evaluated as one would expect.

+ 1

translates mathematically to

\[\psi_{11}(t) = \pi_0^{(1)}(t_1) \pi_1^{(2)}(t_2) \pi_0^{(3)}(t_3) \pi_1^{(4)}(t_4).\]

Notice that there is an offset by one, because the basis counting starts at 0, but Julia is 1-indexed. The underlying measure of mop is now of type ProductMeasure, and stored in the field measure The weight $w$ can be evaluated as one would expect.

diff --git a/dev/pce_tutorial/index.html b/dev/pce_tutorial/index.html index 3f388cf..ce48a02 100644 --- a/dev/pce_tutorial/index.html +++ b/dev/pce_tutorial/index.html @@ -33,9 +33,9 @@ [evaluate(degree, points, gaussian) for degree in degrees]
4-element Vector{Vector{Float64}}:
  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
- [-0.05672506541039035, -0.6094626402421635, -0.9954316657440102, 0.4772146734720868, 3.677880050264119, -0.44592269848324795, -0.9987758137981368, -0.6894987301138918, 0.8431424214880716, -0.998715079742736]
- [-1.7698820053126254, 0.8092952708196026, 2.9726108641419358, -3.681124849311277, -3.1847185369256774, -0.017462153044426776, 2.992656381420678, 1.2334034192842367, -4.661680543039518, 2.9922921294764837]
- [14.940153499945719, 0.3459542838599283, -14.794737908308912, 21.96573591985111, -30.369825080429294, 5.498556376561288, -14.944934098559406, -2.4436726842218053, 23.245274665197112, -14.942203351602704]

Finding PCE Coefficients

Having constructed the orthogonal bases, the question remains how to find the PCE coefficients for the common random variables. Every random variable can be characterized exactly by two PCE coefficients. For a Gaussian random variable, this is familiar: the mean and the variance suffice to describe a Gaussian random variable entirely. The same is true for any random variable of finite variance given the right basis. The function convert2affinePCE provides the first two PCE coefficients (hence the name affine) for the common random variables.

Gaussian

Given the Gaussian random variable $\mathsf{x} \sim \mathcal{N}(\mu, \sigma^2)$ with $\sigma > 0$, the affine PCE coefficients are

# Gaussian
+ [-0.39504879865774534, -0.0832923297672803, -0.9550225510653572, -0.9819448775320604, -0.6991339798689737, -0.9245762984670918, -0.06565948603782346, -0.9949522627165367, 0.43013375409382104, 5.626818997075061]
+ [-0.26374125204809085, -1.6598930687328175, 2.732158277304811, 2.8919952526396946, 1.285324241283326, 2.5531465255554755, -1.733050887741955, 2.969739055950903, -3.535519969964441, 7.153816037544551]
+ [6.9547062650557585, 14.41690886792922, -13.006268373560177, -14.192403414909418, -2.7916000240694023, -11.690835386880902, 14.766112164956052, -14.773233888404807, 21.601808233235197, -84.49912828362122]

Finding PCE Coefficients

Having constructed the orthogonal bases, the question remains how to find the PCE coefficients for the common random variables. Every random variable can be characterized exactly by two PCE coefficients. For a Gaussian random variable, this is familiar: the mean and the variance suffice to describe a Gaussian random variable entirely. The same is true for any random variable of finite variance given the right basis. The function convert2affinePCE provides the first two PCE coefficients (hence the name affine) for the common random variables.

Gaussian

Given the Gaussian random variable $\mathsf{x} \sim \mathcal{N}(\mu, \sigma^2)$ with $\sigma > 0$, the affine PCE coefficients are

# Gaussian
 μ, σ = 2.0, 0.2
 pce_gaussian = convert2affinePCE(μ, σ, gaussian)
2-element Vector{Float64}:
  2.0
@@ -57,89 +57,89 @@
 ξ_gaussian = sampleMeasure(N, myops["gaussian"])
 samples_gaussian = evaluatePCE(pce_gaussian, ξ_gaussian, myops["gaussian"])
 # samplePCE(N,pce_gaussian,myops["gaussian"])
1000-element Vector{Float64}:
- 1.6711937229653784
- 2.0258705330290208
- 2.0804985310746993
- 1.9736995395644972
- 1.9049293499452802
- 2.284094278224842
- 1.8866803293727565
- 1.9430020562427852
- 1.9127350617197716
- 2.307984511560443
+ 1.9956312074889164
+ 1.8699884828805238
+ 2.07208222594989
+ 2.2326601351307622
+ 2.1348463698831788
+ 2.0499976018351767
+ 1.6501091901490428
+ 2.1845160118689777
+ 2.0507341701257493
+ 2.096760814781475
  ⋮
- 1.781320311264082
- 2.188683220475695
- 1.9763990549561514
- 2.1949948843245446
- 2.0080737719783213
- 1.7846071099934995
- 1.8382886637277474
- 1.9063074037702032
- 2.0735170854775324

Uniform

ξ_uniform = sampleMeasure(N, myops["uniform01"])
+ 2.3827549734755067
+ 1.9621700872953722
+ 2.076507810413312
+ 2.084257226360071
+ 2.270576579554137
+ 2.080499832896084
+ 2.071746373871507
+ 1.7532239242408973
+ 1.8066880806509125

Uniform

ξ_uniform = sampleMeasure(N, myops["uniform01"])
 samples_uniform = evaluatePCE(pce_uniform, ξ_uniform, myops["uniform01"])
 # samples_uniform = samplePCE(N,pce_uniform,myops["uniform01"])
1000-element Vector{Float64}:
- 2.2804818179688704
- 1.9375333757964646
- 2.059161356638003
- 1.7877450661660255
- 1.7295357546031724
- 2.0590532184198564
- 1.8086133963354292
- 2.205956566456826
- 1.7959886585668567
- 1.7340479017382222
+ 2.2980893642095626
+ 2.1160424174752808
+ 2.0022293910654345
+ 2.3411526343406983
+ 1.7936209328424846
+ 2.0365566715183543
+ 1.984130732613697
+ 2.1674199056929817
+ 1.7380653331380964
+ 1.8709015038811647
  ⋮
- 1.8428717867537592
- 2.2843449379912
- 2.2482030745685604
- 1.724095648755446
- 1.9894646045762958
- 2.0505318461047213
- 2.211888882635231
- 2.025092098232284
- 1.866195277880861

Beta

ξ_beta = sampleMeasure(N, myops["beta01"])
+ 2.2295776986657088
+ 2.266945297709807
+ 2.2564347410160295
+ 2.009029014320334
+ 2.046356350084438
+ 1.6785531869248909
+ 1.9402917952954477
+ 2.1235915121104965
+ 2.146283507396731

Beta

ξ_beta = sampleMeasure(N, myops["beta01"])
 samples_beta = evaluatePCE(pce_beta, ξ_beta, myops["beta01"])
 # samples_beta = samplePCE(N,pce_beta,myops["beta01"])
1000-element Vector{Float64}:
- 1.7149524265022054
- 2.096652575957511
- 1.865122542271865
- 2.1819540918151765
- 1.8454855110629853
- 1.6908286235063263
- 2.0247424832189527
- 2.0567079086700093
- 2.128626466581286
- 2.0891729979775953
+ 1.691905951497814
+ 1.9846049617403105
+ 1.978662991179019
+ 2.151145287471139
+ 2.4847246373768255
+ 1.9224864481796726
+ 1.9641433608802354
+ 1.932350779262258
+ 2.1327820020224517
+ 1.9055769395651807
  ⋮
- 1.7656307686668289
- 1.9027340967764685
- 1.7746867050706494
- 2.1042521333939033
- 2.092802283632432
- 1.8602561713353654
- 1.67664574258231
- 1.9798927991026798
- 1.7620237518880457

Logistic

ξ_logistic = sampleMeasure(N, myops["logistic"])
+ 1.8827971183786067
+ 2.139525636501723
+ 1.995357573736859
+ 1.8001116199699192
+ 1.9411978121811007
+ 1.9135664045321576
+ 1.6975944458261585
+ 2.1911840104399003
+ 2.3672902500190274

Logistic

ξ_logistic = sampleMeasure(N, myops["logistic"])
 samples_logistic = evaluatePCE(pce_logistic, ξ_logistic, myops["logistic"])
 # samples_logistic = samplePCE(N,pce_logistic,myops["logistic"])
1000-element Vector{Float64}:
- 1.7394494018144306
- 1.8594524408294233
- 2.0168189322249175
- 2.069098453054286
- 1.9364947036040239
- 2.1110528789733602
- 2.1250936748948757
- 1.8127572240227896
- 1.8635055176270214
- 2.0455560181596417
+ 2.2039656862686803
+ 1.878510218974152
+ 2.2610952417223955
+ 2.1402878575348723
+ 2.126087738527197
+ 2.0188443157917555
+ 2.003418511517901
+ 1.7099799513320055
+ 1.471801358500802
+ 2.0977341695684664
  ⋮
- 2.259003779435543
- 2.0377043074752277
- 1.9293215753761173
- 1.9181342622376232
- 2.017810626992744
- 2.447038173602529
- 1.7877444438128598
- 1.8283767630337528
- 1.8346386172216205
+ 2.0162723654276373 + 2.14603041429483 + 1.8753413884051298 + 1.9664888531464206 + 2.085649950062657 + 1.6422163955153228 + 2.1036358539240037 + 2.093109441701054 + 1.9310390932843458 diff --git a/dev/quadrature_rules/index.html b/dev/quadrature_rules/index.html index bb69b7b..789ea37 100644 --- a/dev/quadrature_rules/index.html +++ b/dev/quadrature_rules/index.html @@ -43,4 +43,4 @@ print("end point:\t\t $(n_cc[end])\n") print("error Clenshaw-Curtis:\t $(int_cc - int_exact)")
first point:		 1.0
 end point:		 -1.0
-error Clenshaw-Curtis:	 0.026213510850746302

As we can see, for the same number of nodes $N$, the quadrature rules based on the recurrence coefficients can greatly outperform the all-purpose quadratures. So, whenever possible, use quadrature rules based on recurrence coefficients of the orthogonal polynomials relative to the underlying measure. Make sure to check out this tutorial too.

+error Clenshaw-Curtis: 0.026213510850746302

As we can see, for the same number of nodes $N$, the quadrature rules based on the recurrence coefficients can greatly outperform the all-purpose quadratures. So, whenever possible, use quadrature rules based on recurrence coefficients of the orthogonal polynomials relative to the underlying measure. Make sure to check out this tutorial too.

diff --git a/dev/random_ode/index.html b/dev/random_ode/index.html index 59313ab..8cdd411 100644 --- a/dev/random_ode/index.html +++ b/dev/random_ode/index.html @@ -23,7 +23,7 @@ probgalerkin = ODEProblem(ODEgalerkin, xinit, (0, tend), a) solgalerkin = solve(probgalerkin; saveat = 0:Δt:tend) -t, x = solgalerkin.t, solgalerkin.u;
([0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09  …  2.91, 2.92, 2.93, 2.94, 2.95, 2.96, 2.97, 2.98, 2.99, 3.0], [[2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [1.9900252071385, 0.0009950126035692532, 2.4875315089174103e-7, 4.145885853203421e-11, 5.1823554241448126e-15, 5.18237285905222e-19, 4.446367982010917e-23], [1.9801006575270281, 0.0019801006679350595, 9.900482838759917e-7, 3.302217230802034e-10, 7.191587836607126e-14, 2.552297839257542e-16, -9.336417123895168e-19], [1.9702260956550872, 0.0029553391699344914, 2.2164991440224753e-6, 1.1087782320980853e-9, 3.8807568521567125e-13, 7.647078374449646e-16, -3.0601683025036203e-18], [1.9604012673415023, 0.0039208025693738945, 3.920795659105232e-6, 2.6145693296523593e-9, 1.2695719817982335e-12, 1.4309116759425047e-15, -5.3314999776696085e-18], [1.9506259196896107, 0.00487656483071621, 6.095699691025314e-6, 5.080409655788537e-9, 3.1388591538675303e-12, 2.5226473781781953e-15, -6.647822955832995e-18], [1.94089980108726, 0.005822699423080999, 8.734045035810852e-6, 8.734487546531109e-9, 6.5249357671065045e-12, 4.675567823572964e-15, -5.857545001877664e-18], [1.9312226612068097, 0.0067592793202444325, 1.182873742361708e-5, 1.38003650338837e-8, 1.2063344567127589e-11, 8.892172692208816e-15, -1.7572954276258948e-18], [1.92159425100513, 0.007686377000639301, 1.5372754518726328e-5, 2.049697784582893e-8, 2.0496172479472687e-11, 1.6541808464828792e-14, 6.908074908161592e-18], [1.912014322723603, 0.008604064447354941, 1.9359145919547677e-5, 2.903863540632771e-8, 3.267205060960963e-11, 2.9360668422836406e-14, 2.144549359978584e-17]  …  [0.4717682324476052, 0.06864220151579947, 0.004993736418123421, 0.0002421945024001905, 8.80990541705696e-6, 2.5636668810180395e-7, 6.200375982975939e-9], [0.4694494907228331, 0.0685395483131638, 0.005003403453575988, 0.00024349724514499931, 8.887729361711553e-6, 2.595201584541646e-7, 6.29810091993579e-9], [0.46714226194367947, 0.0684362632590968, 0.005012972845694042, 0.0002447984435501969, 8.965822463898329e-6, 2.6269707595812414e-7, 6.396916976417883e-9], [0.4648464883847442, 0.06833235513846007, 0.005022444764258139, 0.00024609805746775044, 9.044182650674575e-6, 2.658974600039844e-7, 6.496830428797747e-9], [0.4625621126313892, 0.06822783265777074, 0.005031819383033397, 0.00024739604704417334, 9.122807836618792e-6, 2.69121328827927e-7, 6.597847538468663e-9], [0.4602890775797431, 0.06812270444520165, 0.005041096879769475, 0.00024869237272052286, 9.201695923830506e-6, 2.7236869951200684e-7, 6.6999745518414345e-9], [0.45802732643669747, 0.06801697905058116, 0.0050502774362005875, 0.00024998699523240224, 9.280844801930425e-6, 2.756395879841574e-7, 6.803217700344575e-9], [0.45577680271990856, 0.06791066494539329, 0.005059361238045495, 0.00025127987560995946, 9.360252348060359e-6, 2.789340090181882e-7, 6.907583200424216e-9], [0.45353745025779707, 0.06780377052277767, 0.005068348475007509, 0.00025257097517788764, 9.439916426883243e-6, 2.822519762337852e-7, 7.013077253544128e-9], [0.4513092131895473, 0.06769630409752951, 0.005077239340774494, 0.0002538602555554254, 9.519834890583153e-6, 2.85593502096512e-7, 7.119706046185749e-9]])

For later purposes, we compute the expected value and the standard deviation at all time instants using PCE.

# an advantage of PCE is that moments can be computed from the PCE coefficients alone; no sampling required
+t, x = solgalerkin.t, solgalerkin.u;
([0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09  …  2.91, 2.92, 2.93, 2.94, 2.95, 2.96, 2.97, 2.98, 2.99, 3.0], [[2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [1.9900252071385, 0.0009950126035692532, 2.487531508917427e-7, 4.145885853203421e-11, 5.1823554241448126e-15, 5.18237285905222e-19, 4.446367982010917e-23], [1.9801006575270281, 0.0019801006679350595, 9.900482838759834e-7, 3.302217230802382e-10, 7.191587836605381e-14, 2.552297839257448e-16, -9.336417123895147e-19], [1.9702260956550872, 0.0029553391699344914, 2.2164991440224457e-6, 1.1087782320981967e-9, 3.880756852156263e-13, 7.647078374449501e-16, -3.0601683025036123e-18], [1.9604012673415023, 0.0039208025693738945, 3.920795659105188e-6, 2.6145693296525264e-9, 1.2695719817981495e-12, 1.4309116759424666e-15, -5.3314999776696016e-18], [1.9506259196896107, 0.00487656483071621, 6.095699691025267e-6, 5.080409655788689e-9, 3.138859153867438e-12, 2.522647378178159e-15, -6.6478229558329896e-18], [1.94089980108726, 0.005822699423080999, 8.734045035810811e-6, 8.734487546531226e-9, 6.524935767106495e-12, 4.675567823572938e-15, -5.857545001877662e-18], [1.9312226612068097, 0.0067592793202444325, 1.1828737423617071e-5, 1.3800365033883713e-8, 1.2063344567127623e-11, 8.892172692208817e-15, -1.7572954276259006e-18], [1.92159425100513, 0.007686377000639301, 1.5372754518726352e-5, 2.049697784582881e-8, 2.049617247947276e-11, 1.6541808464828827e-14, 6.908074908161587e-18], [1.912014322723603, 0.008604064447354941, 1.935914591954773e-5, 2.9038635406327468e-8, 3.267205060960968e-11, 2.936066842283648e-14, 2.1445493599785843e-17]  …  [0.4717682324476057, 0.06864220151579949, 0.004993736418123419, 0.00024219450240019064, 8.80990541705697e-6, 2.5636668810180443e-7, 6.200375982975948e-9], [0.4694494907228336, 0.0685395483131638, 0.0050034034535759876, 0.00024349724514499942, 8.887729361711562e-6, 2.5952015845416507e-7, 6.2981009199358e-9], [0.46714226194367997, 0.06843626325909681, 0.00501297284569404, 0.000244798443550197, 8.965822463898337e-6, 2.626970759581246e-7, 6.396916976417893e-9], [0.4648464883847447, 0.06833235513846007, 0.005022444764258137, 0.0002460980574677505, 9.044182650674584e-6, 2.658974600039849e-7, 6.4968304287977586e-9], [0.4625621126313897, 0.06822783265777074, 0.005031819383033396, 0.0002473960470441734, 9.122807836618798e-6, 2.6912132882792755e-7, 6.5978475384686746e-9], [0.4602890775797436, 0.06812270444520165, 0.005041096879769474, 0.00024869237272052297, 9.201695923830512e-6, 2.723686995120074e-7, 6.699974551841447e-9], [0.45802732643669797, 0.06801697905058116, 0.005050277436200587, 0.0002499869952324023, 9.28084480193043e-6, 2.75639587984158e-7, 6.803217700344587e-9], [0.4557768027199091, 0.06791066494539329, 0.005059361238045494, 0.0002512798756099595, 9.360252348060364e-6, 2.7893400901818877e-7, 6.907583200424231e-9], [0.45353745025779757, 0.06780377052277768, 0.0050683484750075085, 0.0002525709751778877, 9.439916426883248e-6, 2.8225197623378586e-7, 7.0130772535441425e-9], [0.4513092131895478, 0.06769630409752951, 0.005077239340774493, 0.00025386025555542547, 9.519834890583158e-6, 2.855935020965127e-7, 7.119706046185762e-9]])

For later purposes, we compute the expected value and the standard deviation at all time instants using PCE.

# an advantage of PCE is that moments can be computed from the PCE coefficients alone; no sampling required
 mean_pce = [mean(x_, opq) for x_ in x]
 std_pce = [std(x_, opq) for x_ in x]
301-element Vector{Float64}:
  0.0
@@ -38,13 +38,13 @@
  0.008604108005619074
  ⋮
  0.06890642513273801
- 0.06880511185670359
+ 0.0688051118567036
  0.06870317328013559
  0.06860061804929832
  0.068497454732652
  0.06839369182086615
  0.06828933772683328
- 0.06818440078568275
+ 0.06818440078568276
  0.06807888925479468

We compare the solution from PCE to a Monte-Carlo-based solution. That means to solve the ordinary differential equation for many samples of $\mathsf{a}$. We first sample from the measure using sampleMeasure, and then generate samples of $\mathsf{a}$ using evaluatePCE. After that, we solve the ODE and store the results in xmc.

using Statistics
 Nsmpl = 5000
 ξ = sampleMeasure(Nsmpl, opq)     # sample from Gaussian measure; effectively randn() here
@@ -54,63 +54,63 @@
        for aa in asmpl]
 xmc = hcat(xmc...);
301×5000 Matrix{Float64}:
  2.0       2.0       2.0       2.0       …  2.0       2.0       2.0
- 1.99032   1.98864   1.99062   1.98883      1.99072   1.98918   1.9889
- 1.98068   1.97735   1.98129   1.97773      1.98149   1.97842   1.97786
- 1.97109   1.96612   1.972     1.96669      1.9723    1.96772   1.96688
- 1.96154   1.95495   1.96275   1.95571      1.96315   1.95708   1.95597
- 1.95205   1.94385   1.95355   1.94479   …  1.95404   1.94649   1.94511
- 1.94259   1.93281   1.94439   1.93393      1.94498   1.93596   1.93431
- 1.93319   1.92183   1.93527   1.92314      1.93596   1.92549   1.92358
- 1.92383   1.91092   1.92619   1.9124       1.92698   1.91508   1.9129
- 1.91451   1.90007   1.91716   1.90172      1.91804   1.90472   1.90229
+ 1.99134   1.99163   1.98905   1.98867      1.98995   1.99      1.98945
+ 1.98272   1.98329   1.97815   1.97739      1.97995   1.98005   1.97895
+ 1.97414   1.97498   1.96732   1.96619      1.97001   1.97015   1.96851
+ 1.96559   1.96671   1.95655   1.95505      1.96011   1.9603    1.95813
+ 1.95708   1.95848   1.94583   1.94397   …  1.95026   1.9505    1.94779
+ 1.94861   1.95027   1.93517   1.93295      1.94046   1.94075   1.93752
+ 1.94017   1.94211   1.92458   1.92199      1.93071   1.93104   1.9273
+ 1.93177   1.93398   1.91404   1.9111       1.92101   1.92139   1.91713
+ 1.92341   1.92588   1.90355   1.90027      1.91136   1.91178   1.90701
  ⋮                                       ⋱                      
- 0.484728  0.379113  0.506969  0.38999      0.514575  0.410426  0.393752
- 0.482381  0.37696   0.504591  0.387813     0.512188  0.408206  0.391566
- 0.480045  0.374819  0.502225  0.385648     0.509813  0.405998  0.389393
- 0.477721  0.37269   0.49987   0.383495  …  0.507448  0.403802  0.387232
- 0.475408  0.370574  0.497526  0.381354     0.505094  0.401618  0.385083
- 0.473106  0.368469  0.495193  0.379225     0.502751  0.399446  0.382945
- 0.470815  0.366376  0.492871  0.377108     0.500419  0.397285  0.38082
- 0.468535  0.364296  0.49056   0.375002     0.498098  0.395136  0.378706
- 0.466267  0.362227  0.48826   0.372909  …  0.495788  0.392999  0.376604

Now we can compare the Monte Carlo mean and standard deviation to the expression from PCE for every time instant.

[mean(xmc, dims = 2) - mean_pce std(xmc, dims = 2) - std_pce]
301×2 Matrix{Float64}:
- 0.0          0.0
- 1.10107e-5   1.67342e-6
- 2.19131e-5   3.33928e-6
- 3.27082e-5   4.99756e-6
- 4.33968e-5   6.64827e-6
- 5.39795e-5   8.29143e-6
- 6.44572e-5   9.92703e-6
- 7.48308e-5   1.15551e-5
- 8.51008e-5   1.31757e-5
- 9.52682e-5   1.47887e-5
- ⋮            
- 0.000774777  0.000233029
- 0.000773666  0.000233207
- 0.000772547  0.000233382
- 0.00077142   0.000233554
- 0.000770286  0.000233724
- 0.000769144  0.000233892
- 0.000767994  0.000234058
- 0.000766838  0.000234221
- 0.000765674  0.000234382

Clearly, the accuracy of PCE deteriorates over time. Possible remedies are to increase the dimension of PCE, and to tweak the tolerances of the integrator.

Finally, we compare whether the samples follow a log-normal distribution, and compare the result to the analytic mean and standard deviation.

logx_pce = [log.(evaluatePCE(x_, ξ, opq)) for x_ in x]
+ 0.563397  0.587355  0.402367  0.380442     0.459519  0.462795  0.426777
+ 0.560958  0.584896  0.400164  0.378286     0.457211  0.460481  0.424525
+ 0.558529  0.582446  0.397972  0.376143     0.454914  0.458178  0.422286
+ 0.556111  0.580008  0.395793  0.374011  …  0.452628  0.455888  0.420058
+ 0.553704  0.577579  0.393625  0.371891     0.450354  0.453608  0.417842
+ 0.551307  0.57516   0.39147   0.369784     0.448091  0.45134   0.415637
+ 0.54892   0.572752  0.389326  0.367688     0.44584   0.449084  0.413444
+ 0.546543  0.570354  0.387194  0.365604     0.4436    0.446838  0.411263
+ 0.544177  0.567965  0.385073  0.363532  …  0.441372  0.444604  0.409093

Now we can compare the Monte Carlo mean and standard deviation to the expression from PCE for every time instant.

[mean(xmc, dims = 2) - mean_pce std(xmc, dims = 2) - std_pce]
301×2 Matrix{Float64}:
+  0.0         0.0
+ -6.0602e-7   8.68937e-6
+ -1.19742e-6  1.73025e-5
+ -1.77434e-6  2.58399e-5
+ -2.33694e-6  3.43021e-5
+ -2.8854e-6   4.26897e-5
+ -3.41988e-6  5.10031e-5
+ -3.94055e-6  5.92428e-5
+ -4.44759e-6  6.74095e-5
+ -4.94115e-6  7.55036e-5
+  ⋮           
+  5.09286e-5  0.000744375
+  5.11913e-5  0.000743922
+  5.14521e-5  0.000743462
+  5.17109e-5  0.000742996
+  5.19677e-5  0.000742522
+  5.22226e-5  0.000742041
+  5.24756e-5  0.000741553
+  5.27267e-5  0.000741058
+  5.29759e-5  0.000740557

Clearly, the accuracy of PCE deteriorates over time. Possible remedies are to increase the dimension of PCE, and to tweak the tolerances of the integrator.

Finally, we compare whether the samples follow a log-normal distribution, and compare the result to the analytic mean and standard deviation.

logx_pce = [log.(evaluatePCE(x_, ξ, opq)) for x_ in x]
 [mean.(logx_pce) - (log(x0) .+ μ * t) std.(logx_pce) - σ * t]
301×2 Matrix{Float64}:
- 1.66533e-15  1.6655e-15
- 5.53255e-6   8.38596e-7
- 1.10651e-5   1.6772e-6
- 1.65976e-5   2.5158e-6
- 2.21302e-5   3.3544e-6
- 2.76627e-5   4.193e-6
- 3.31953e-5   5.03159e-6
- 3.87278e-5   5.87018e-6
- 4.42604e-5   6.70877e-6
- 4.97929e-5   7.54736e-6
- ⋮            
- 0.00161578   0.000244692
- 0.00162132   0.000245528
- 0.00162685   0.000246364
- 0.00163239   0.000247201
- 0.00163792   0.000248039
- 0.00164345   0.000248876
- 0.00164899   0.000249715
- 0.00165452   0.000250553
- 0.00166005   0.000251392
+ -6.66134e-16 6.662e-16 + -3.06674e-7 4.36383e-6 + -6.13358e-7 8.72766e-6 + -9.20049e-7 1.30915e-5 + -1.22673e-6 1.74553e-5 + -1.5334e-6 2.18192e-5 + -1.84006e-6 2.6183e-5 + -2.14672e-6 3.05468e-5 + -2.45339e-6 3.49106e-5 + -2.76006e-6 3.92744e-5 + ⋮ + -8.92703e-5 0.00127406 + -8.95726e-5 0.00127842 + -8.9876e-5 0.00128278 + -9.01804e-5 0.00128714 + -9.04857e-5 0.00129151 + -9.07918e-5 0.00129587 + -9.10984e-5 0.00130023 + -9.14053e-5 0.0013046 + -9.17121e-5 0.00130896 diff --git a/dev/scalar_products/index.html b/dev/scalar_products/index.html index afb1717..b03a74f 100644 --- a/dev/scalar_products/index.html +++ b/dev/scalar_products/index.html @@ -86,7 +86,7 @@ supp = (0, 1) w(t) = (t^(s_α - 1) * (1 - t)^(s_β - 1) / SpecialFunctions.beta(s_α, s_β)) my_meas = Measure("my_meas", w, supp, false) -my_opq = OrthoPoly("my_op", deg, my_meas; Nrec = n, addQuadrature = true)
OrthoPoly{Vector{Float64}, Measure, Quad{Float64, Vector{Float64}}}("my_op", 4, [0.39622641509448137, 0.4530886533992222, 0.4732655766690041, 0.482729089353549, 0.487923348196102, 0.4910806427875322, 0.4931429219148367, 0.4945640779987811, 0.49558490842701974, 0.4963428640690024, 0.4969210673874069, 0.49737219305649827, 0.4977309380461533, 0.49802091403248355, 0.4982586420983248, 0.4984559631332138, 0.4986215435256332, 0.4987618444763099, 0.4988817627307648, 0.498985064146572], [0.9999999999996537, 0.037973181440564815, 0.0495281934642969, 0.054496397032274255, 0.05707494398455888, 0.058582243182994216, 0.059538775227572845, 0.06018346809956606, 0.060638471958479156, 0.06097150420545557, 0.06122255805322869, 0.06141648535039122, 0.06156938828922262, 0.061692071395589285, 0.0617920032078656, 0.061874480021715215, 0.061943342162367826, 0.0620014291339966, 0.06205087702968264, 0.06209331771849251], Measure("my_meas", Main.w, (0.0, 1.0), false, Dict{Any, Any}()), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.008788905307716187, 0.028450106179070487, 0.05852125542991021, 0.09833814003385193, 0.1470235069698297, 0.2035050489777794, 0.2665388311160099, 0.334736643590094, 0.4065965631078265, 0.4805360282406446, 0.5549266957885689, 0.6281303108684108, 0.6985348047827787, 0.7645898366195809, 0.8248410256250177, 0.877962211974623, 0.922785373892678, 0.9583291958881767, 0.9838388820037522], [0.001151677857036633, 0.007007259641384906, 0.02031489271031409, 0.04140255944907848, 0.06777171118707019, 0.09471990539100687, 0.11673118519091033, 0.1291364544780517, 0.12947566139904643, 0.11812235960758934, 0.09800772590075599, 0.07359961540231272, 0.04953526814944056, 0.02938957362654598, 0.014963964671407239, 0.006252710929385376, 0.001979666990405483, 0.0004035147370623102, 3.429268084905962e-5]))

Now we can compute the squared norms $\| \phi_k \|^2$

my_normsq = computeSP2(my_opq)
5-element Vector{Float64}:
+my_opq = OrthoPoly("my_op", deg, my_meas; Nrec = n, addQuadrature = true)
OrthoPoly{Vector{Float64}, Measure, Quad{Float64, Vector{Float64}}}("my_op", 4, [0.39622641509448137, 0.4530886533992222, 0.4732655766690041, 0.482729089353549, 0.487923348196102, 0.4910806427875322, 0.4931429219148367, 0.4945640779987811, 0.49558490842701974, 0.49634286406900235, 0.49692106738740693, 0.49737219305649827, 0.4977309380461533, 0.49802091403248366, 0.49825864209832466, 0.49845596313321394, 0.4986215435256331, 0.4987618444763101, 0.49888176273076457, 0.4989850641465719], [0.9999999999996537, 0.037973181440564815, 0.0495281934642969, 0.054496397032274255, 0.05707494398455888, 0.058582243182994216, 0.059538775227572845, 0.06018346809956606, 0.060638471958479156, 0.06097150420545557, 0.06122255805322869, 0.06141648535039122, 0.06156938828922262, 0.06169207139558928, 0.06179200320786561, 0.061874480021715215, 0.06194334216236784, 0.06200142913399661, 0.06205087702968263, 0.062093317718492524], Measure("my_meas", Main.w, (0.0, 1.0), false, Dict{Any, Any}()), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.008788905307716066, 0.028450106179070327, 0.05852125542991021, 0.09833814003385191, 0.14702350696982952, 0.20350504897777935, 0.2665388311160099, 0.3347366435900941, 0.4065965631078265, 0.48053602824064456, 0.5549266957885689, 0.6281303108684108, 0.6985348047827786, 0.7645898366195809, 0.8248410256250178, 0.877962211974623, 0.9227853738926779, 0.9583291958881767, 0.9838388820037521], [0.0011516778570366463, 0.007007259641384834, 0.020314892710314107, 0.04140255944907838, 0.06777171118707022, 0.09471990539100715, 0.11673118519091014, 0.12913645447805186, 0.12947566139904632, 0.11812235960758903, 0.0980077259007553, 0.0735996154023131, 0.04953526814944057, 0.029389573626545828, 0.014963964671407391, 0.006252710929385352, 0.0019796669904054705, 0.0004035147370623091, 3.4292680849059616e-5]))

Now we can compute the squared norms $\| \phi_k \|^2$

my_normsq = computeSP2(my_opq)
5-element Vector{Float64}:
  0.9999999999996537
  0.037973181440551666
  0.0018807430768424914
@@ -132,7 +132,7 @@
  5.5892790395972725e-14
  7.395126178089129e-15
  8.643259719054441e-16
- 9.288055079822305e-17
norm(T - my_T)
3.6009523592324045e-13
Note

The possibility to create quadrature rules for arbitrary weights should be reserved to cases different from classical ones.

Multivariate Polynomials

For multivariate polynomials, the syntax for Tensor is very much alike, except that we are dealing with the type MultiOrthoPoly now.

mop = MultiOrthoPoly([opq, my_opq], deg)
MultiOrthoPoly{ProductMeasure, Quad{Float64, Vector{Float64}}, Vector{AbstractOrthoPoly{M, Quad{Float64, Vector{Float64}}} where M<:AbstractMeasure}}(["Beta01OrthoPoly{Vector{Float64}, Beta01Measure, Quad{Float64, Vector{Float64}}}", "my_op"], 4, 15, [0 0; 1 0; … ; 1 3; 0 4], ProductMeasure(PolyChaos.var"#w#39"{Vector{AbstractOrthoPoly{M, Quad{Float64, Vector{Float64}}} where M<:AbstractMeasure}}(AbstractOrthoPoly{M, Quad{Float64, Vector{Float64}}} where M<:AbstractMeasure[Beta01OrthoPoly{Vector{Float64}, Beta01Measure, Quad{Float64, Vector{Float64}}}(4, [0.39622641509433965, 0.45308865339881105, 0.4732655766681396, 0.482729089351984, 0.4879233481934926, 0.49108064278342917, 0.49314292190864784, 0.4945640779897571, 0.4955849084142159, 0.4963428640512603, 0.49692106736331404, 0.4973721930243669, 0.49773093800397555, 0.4980209139779084, 0.4982586420286101, 0.4984559630451982, 0.4986215434156863, 0.4987618443402984, 0.4988817625639983, 0.4989850639437675], [1.0, 0.03797318144060756, 0.049528193464418745, 0.054496397032519545, 0.05707494398498378, 0.05858224318366976, 0.05953877522858778, 0.06018346810103027, 0.0606384719605267, 0.06097150420824787, 0.061222558056958205, 0.06141648535528466, 0.061569388295544744, 0.061692071403646374, 0.06179200321800959, 0.061874480034347076, 0.06194334217794196, 0.06200142915302492, 0.06205087705273863, 0.062093317746215744], Beta01Measure(PolyChaos.var"#102#103"{Float64, Float64}(2.1, 3.2), (0.0, 1.0), false, 2.1, 3.2), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.00878890525374891, 0.028450106116514506, 0.05852125536671723, 0.09833813997192814, 0.14702350691009355, 0.20350504892083368, 0.266538831062297, 0.3347366435399401, 0.40659656306145764, 0.48053602819819125, 0.5549266957500689, 0.6281303108338084, 0.6985348047519305, 0.7645898365922597, 0.8248410256009169, 0.8779622119533655, 0.9227853738738273, 0.9583291958712525, 0.9838388819882817], [0.00115167784765143, 0.007007259624729887, 0.020314892689531894, 0.04140255942833847, 0.06777171117046146, 0.09471990538153915, 0.11673118518989155, 0.12913645448496422, 0.12947566141190417, 0.11812235962361355, 0.09800772591714006, 0.07359961541684255, 0.04953526816082873, 0.029389573634464723, 0.014963964676256315, 0.006252710931950127, 0.0019796669915308576, 0.00040351473743713024, 3.429268092282879e-5])), OrthoPoly{Vector{Float64}, Measure, Quad{Float64, Vector{Float64}}}("my_op", 4, [0.39622641509448137, 0.4530886533992222, 0.4732655766690041, 0.482729089353549, 0.487923348196102, 0.4910806427875322, 0.4931429219148367, 0.4945640779987811, 0.49558490842701974, 0.4963428640690024, 0.4969210673874069, 0.49737219305649827, 0.4977309380461533, 0.49802091403248355, 0.4982586420983248, 0.4984559631332138, 0.4986215435256332, 0.4987618444763099, 0.4988817627307648, 0.498985064146572], [0.9999999999996537, 0.037973181440564815, 0.0495281934642969, 0.054496397032274255, 0.05707494398455888, 0.058582243182994216, 0.059538775227572845, 0.06018346809956606, 0.060638471958479156, 0.06097150420545557, 0.06122255805322869, 0.06141648535039122, 0.06156938828922262, 0.061692071395589285, 0.0617920032078656, 0.061874480021715215, 0.061943342162367826, 0.0620014291339966, 0.06205087702968264, 0.06209331771849251], Measure("my_meas", Main.w, (0.0, 1.0), false, Dict{Any, Any}()), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.008788905307716187, 0.028450106179070487, 0.05852125542991021, 0.09833814003385193, 0.1470235069698297, 0.2035050489777794, 0.2665388311160099, 0.334736643590094, 0.4065965631078265, 0.4805360282406446, 0.5549266957885689, 0.6281303108684108, 0.6985348047827787, 0.7645898366195809, 0.8248410256250177, 0.877962211974623, 0.922785373892678, 0.9583291958881767, 0.9838388820037522], [0.001151677857036633, 0.007007259641384906, 0.02031489271031409, 0.04140255944907848, 0.06777171118707019, 0.09471990539100687, 0.11673118519091033, 0.1291364544780517, 0.12947566139904643, 0.11812235960758934, 0.09800772590075599, 0.07359961540231272, 0.04953526814944056, 0.02938957362654598, 0.014963964671407239, 0.006252710929385376, 0.001979666990405483, 0.0004035147370623102, 3.429268084905962e-5]))]), AbstractMeasure[Beta01Measure(PolyChaos.var"#102#103"{Float64, Float64}(2.1, 3.2), (0.0, 1.0), false, 2.1, 3.2), Measure("my_meas", Main.w, (0.0, 1.0), false, Dict{Any, Any}())]), AbstractOrthoPoly{M, Quad{Float64, Vector{Float64}}} where M<:AbstractMeasure[Beta01OrthoPoly{Vector{Float64}, Beta01Measure, Quad{Float64, Vector{Float64}}}(4, [0.39622641509433965, 0.45308865339881105, 0.4732655766681396, 0.482729089351984, 0.4879233481934926, 0.49108064278342917, 0.49314292190864784, 0.4945640779897571, 0.4955849084142159, 0.4963428640512603, 0.49692106736331404, 0.4973721930243669, 0.49773093800397555, 0.4980209139779084, 0.4982586420286101, 0.4984559630451982, 0.4986215434156863, 0.4987618443402984, 0.4988817625639983, 0.4989850639437675], [1.0, 0.03797318144060756, 0.049528193464418745, 0.054496397032519545, 0.05707494398498378, 0.05858224318366976, 0.05953877522858778, 0.06018346810103027, 0.0606384719605267, 0.06097150420824787, 0.061222558056958205, 0.06141648535528466, 0.061569388295544744, 0.061692071403646374, 0.06179200321800959, 0.061874480034347076, 0.06194334217794196, 0.06200142915302492, 0.06205087705273863, 0.062093317746215744], Beta01Measure(PolyChaos.var"#102#103"{Float64, Float64}(2.1, 3.2), (0.0, 1.0), false, 2.1, 3.2), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.00878890525374891, 0.028450106116514506, 0.05852125536671723, 0.09833813997192814, 0.14702350691009355, 0.20350504892083368, 0.266538831062297, 0.3347366435399401, 0.40659656306145764, 0.48053602819819125, 0.5549266957500689, 0.6281303108338084, 0.6985348047519305, 0.7645898365922597, 0.8248410256009169, 0.8779622119533655, 0.9227853738738273, 0.9583291958712525, 0.9838388819882817], [0.00115167784765143, 0.007007259624729887, 0.020314892689531894, 0.04140255942833847, 0.06777171117046146, 0.09471990538153915, 0.11673118518989155, 0.12913645448496422, 0.12947566141190417, 0.11812235962361355, 0.09800772591714006, 0.07359961541684255, 0.04953526816082873, 0.029389573634464723, 0.014963964676256315, 0.006252710931950127, 0.0019796669915308576, 0.00040351473743713024, 3.429268092282879e-5])), OrthoPoly{Vector{Float64}, Measure, Quad{Float64, Vector{Float64}}}("my_op", 4, [0.39622641509448137, 0.4530886533992222, 0.4732655766690041, 0.482729089353549, 0.487923348196102, 0.4910806427875322, 0.4931429219148367, 0.4945640779987811, 0.49558490842701974, 0.4963428640690024, 0.4969210673874069, 0.49737219305649827, 0.4977309380461533, 0.49802091403248355, 0.4982586420983248, 0.4984559631332138, 0.4986215435256332, 0.4987618444763099, 0.4988817627307648, 0.498985064146572], [0.9999999999996537, 0.037973181440564815, 0.0495281934642969, 0.054496397032274255, 0.05707494398455888, 0.058582243182994216, 0.059538775227572845, 0.06018346809956606, 0.060638471958479156, 0.06097150420545557, 0.06122255805322869, 0.06141648535039122, 0.06156938828922262, 0.061692071395589285, 0.0617920032078656, 0.061874480021715215, 0.061943342162367826, 0.0620014291339966, 0.06205087702968264, 0.06209331771849251], Measure("my_meas", Main.w, (0.0, 1.0), false, Dict{Any, Any}()), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.008788905307716187, 0.028450106179070487, 0.05852125542991021, 0.09833814003385193, 0.1470235069698297, 0.2035050489777794, 0.2665388311160099, 0.334736643590094, 0.4065965631078265, 0.4805360282406446, 0.5549266957885689, 0.6281303108684108, 0.6985348047827787, 0.7645898366195809, 0.8248410256250177, 0.877962211974623, 0.922785373892678, 0.9583291958881767, 0.9838388820037522], [0.001151677857036633, 0.007007259641384906, 0.02031489271031409, 0.04140255944907848, 0.06777171118707019, 0.09471990539100687, 0.11673118519091033, 0.1291364544780517, 0.12947566139904643, 0.11812235960758934, 0.09800772590075599, 0.07359961540231272, 0.04953526814944056, 0.02938957362654598, 0.014963964671407239, 0.006252710929385376, 0.001979666990405483, 0.0004035147370623102, 3.429268084905962e-5]))])
mt2 = Tensor(2, mop)
+ 9.288055079822305e-17
norm(T - my_T)
3.6009521352606945e-13
Note

The possibility to create quadrature rules for arbitrary weights should be reserved to cases different from classical ones.

Multivariate Polynomials

For multivariate polynomials, the syntax for Tensor is very much alike, except that we are dealing with the type MultiOrthoPoly now.

mop = MultiOrthoPoly([opq, my_opq], deg)
MultiOrthoPoly{ProductMeasure, Quad{Float64, Vector{Float64}}, Vector{AbstractOrthoPoly{M, Quad{Float64, Vector{Float64}}} where M<:AbstractMeasure}}(["Beta01OrthoPoly{Vector{Float64}, Beta01Measure, Quad{Float64, Vector{Float64}}}", "my_op"], 4, 15, [0 0; 1 0; … ; 1 3; 0 4], ProductMeasure(PolyChaos.var"#w#39"{Vector{AbstractOrthoPoly{M, Quad{Float64, Vector{Float64}}} where M<:AbstractMeasure}}(AbstractOrthoPoly{M, Quad{Float64, Vector{Float64}}} where M<:AbstractMeasure[Beta01OrthoPoly{Vector{Float64}, Beta01Measure, Quad{Float64, Vector{Float64}}}(4, [0.39622641509433965, 0.45308865339881105, 0.4732655766681396, 0.482729089351984, 0.4879233481934926, 0.49108064278342917, 0.49314292190864784, 0.4945640779897571, 0.4955849084142159, 0.4963428640512603, 0.49692106736331404, 0.4973721930243669, 0.49773093800397555, 0.4980209139779084, 0.4982586420286101, 0.4984559630451982, 0.4986215434156863, 0.4987618443402984, 0.4988817625639983, 0.4989850639437675], [1.0, 0.03797318144060756, 0.049528193464418745, 0.054496397032519545, 0.05707494398498378, 0.05858224318366976, 0.05953877522858778, 0.06018346810103027, 0.0606384719605267, 0.06097150420824787, 0.061222558056958205, 0.06141648535528466, 0.061569388295544744, 0.061692071403646374, 0.06179200321800959, 0.061874480034347076, 0.06194334217794196, 0.06200142915302492, 0.06205087705273863, 0.062093317746215744], Beta01Measure(PolyChaos.var"#102#103"{Float64, Float64}(2.1, 3.2), (0.0, 1.0), false, 2.1, 3.2), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.00878890525374891, 0.028450106116514506, 0.05852125536671723, 0.09833813997192814, 0.14702350691009355, 0.20350504892083368, 0.266538831062297, 0.3347366435399401, 0.40659656306145764, 0.48053602819819125, 0.5549266957500689, 0.6281303108338084, 0.6985348047519305, 0.7645898365922597, 0.8248410256009169, 0.8779622119533655, 0.9227853738738273, 0.9583291958712525, 0.9838388819882817], [0.00115167784765143, 0.007007259624729887, 0.020314892689531894, 0.04140255942833847, 0.06777171117046146, 0.09471990538153915, 0.11673118518989155, 0.12913645448496422, 0.12947566141190417, 0.11812235962361355, 0.09800772591714006, 0.07359961541684255, 0.04953526816082873, 0.029389573634464723, 0.014963964676256315, 0.006252710931950127, 0.0019796669915308576, 0.00040351473743713024, 3.429268092282879e-5])), OrthoPoly{Vector{Float64}, Measure, Quad{Float64, Vector{Float64}}}("my_op", 4, [0.39622641509448137, 0.4530886533992222, 0.4732655766690041, 0.482729089353549, 0.487923348196102, 0.4910806427875322, 0.4931429219148367, 0.4945640779987811, 0.49558490842701974, 0.49634286406900235, 0.49692106738740693, 0.49737219305649827, 0.4977309380461533, 0.49802091403248366, 0.49825864209832466, 0.49845596313321394, 0.4986215435256331, 0.4987618444763101, 0.49888176273076457, 0.4989850641465719], [0.9999999999996537, 0.037973181440564815, 0.0495281934642969, 0.054496397032274255, 0.05707494398455888, 0.058582243182994216, 0.059538775227572845, 0.06018346809956606, 0.060638471958479156, 0.06097150420545557, 0.06122255805322869, 0.06141648535039122, 0.06156938828922262, 0.06169207139558928, 0.06179200320786561, 0.061874480021715215, 0.06194334216236784, 0.06200142913399661, 0.06205087702968263, 0.062093317718492524], Measure("my_meas", Main.w, (0.0, 1.0), false, Dict{Any, Any}()), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.008788905307716066, 0.028450106179070327, 0.05852125542991021, 0.09833814003385191, 0.14702350696982952, 0.20350504897777935, 0.2665388311160099, 0.3347366435900941, 0.4065965631078265, 0.48053602824064456, 0.5549266957885689, 0.6281303108684108, 0.6985348047827786, 0.7645898366195809, 0.8248410256250178, 0.877962211974623, 0.9227853738926779, 0.9583291958881767, 0.9838388820037521], [0.0011516778570366463, 0.007007259641384834, 0.020314892710314107, 0.04140255944907838, 0.06777171118707022, 0.09471990539100715, 0.11673118519091014, 0.12913645447805186, 0.12947566139904632, 0.11812235960758903, 0.0980077259007553, 0.0735996154023131, 0.04953526814944057, 0.029389573626545828, 0.014963964671407391, 0.006252710929385352, 0.0019796669904054705, 0.0004035147370623091, 3.4292680849059616e-5]))]), AbstractMeasure[Beta01Measure(PolyChaos.var"#102#103"{Float64, Float64}(2.1, 3.2), (0.0, 1.0), false, 2.1, 3.2), Measure("my_meas", Main.w, (0.0, 1.0), false, Dict{Any, Any}())]), AbstractOrthoPoly{M, Quad{Float64, Vector{Float64}}} where M<:AbstractMeasure[Beta01OrthoPoly{Vector{Float64}, Beta01Measure, Quad{Float64, Vector{Float64}}}(4, [0.39622641509433965, 0.45308865339881105, 0.4732655766681396, 0.482729089351984, 0.4879233481934926, 0.49108064278342917, 0.49314292190864784, 0.4945640779897571, 0.4955849084142159, 0.4963428640512603, 0.49692106736331404, 0.4973721930243669, 0.49773093800397555, 0.4980209139779084, 0.4982586420286101, 0.4984559630451982, 0.4986215434156863, 0.4987618443402984, 0.4988817625639983, 0.4989850639437675], [1.0, 0.03797318144060756, 0.049528193464418745, 0.054496397032519545, 0.05707494398498378, 0.05858224318366976, 0.05953877522858778, 0.06018346810103027, 0.0606384719605267, 0.06097150420824787, 0.061222558056958205, 0.06141648535528466, 0.061569388295544744, 0.061692071403646374, 0.06179200321800959, 0.061874480034347076, 0.06194334217794196, 0.06200142915302492, 0.06205087705273863, 0.062093317746215744], Beta01Measure(PolyChaos.var"#102#103"{Float64, Float64}(2.1, 3.2), (0.0, 1.0), false, 2.1, 3.2), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.00878890525374891, 0.028450106116514506, 0.05852125536671723, 0.09833813997192814, 0.14702350691009355, 0.20350504892083368, 0.266538831062297, 0.3347366435399401, 0.40659656306145764, 0.48053602819819125, 0.5549266957500689, 0.6281303108338084, 0.6985348047519305, 0.7645898365922597, 0.8248410256009169, 0.8779622119533655, 0.9227853738738273, 0.9583291958712525, 0.9838388819882817], [0.00115167784765143, 0.007007259624729887, 0.020314892689531894, 0.04140255942833847, 0.06777171117046146, 0.09471990538153915, 0.11673118518989155, 0.12913645448496422, 0.12947566141190417, 0.11812235962361355, 0.09800772591714006, 0.07359961541684255, 0.04953526816082873, 0.029389573634464723, 0.014963964676256315, 0.006252710931950127, 0.0019796669915308576, 0.00040351473743713024, 3.429268092282879e-5])), OrthoPoly{Vector{Float64}, Measure, Quad{Float64, Vector{Float64}}}("my_op", 4, [0.39622641509448137, 0.4530886533992222, 0.4732655766690041, 0.482729089353549, 0.487923348196102, 0.4910806427875322, 0.4931429219148367, 0.4945640779987811, 0.49558490842701974, 0.49634286406900235, 0.49692106738740693, 0.49737219305649827, 0.4977309380461533, 0.49802091403248366, 0.49825864209832466, 0.49845596313321394, 0.4986215435256331, 0.4987618444763101, 0.49888176273076457, 0.4989850641465719], [0.9999999999996537, 0.037973181440564815, 0.0495281934642969, 0.054496397032274255, 0.05707494398455888, 0.058582243182994216, 0.059538775227572845, 0.06018346809956606, 0.060638471958479156, 0.06097150420545557, 0.06122255805322869, 0.06141648535039122, 0.06156938828922262, 0.06169207139558928, 0.06179200320786561, 0.061874480021715215, 0.06194334216236784, 0.06200142913399661, 0.06205087702968263, 0.062093317718492524], Measure("my_meas", Main.w, (0.0, 1.0), false, Dict{Any, Any}()), Quad{Float64, Vector{Float64}}("golubwelsch", 19, [0.008788905307716066, 0.028450106179070327, 0.05852125542991021, 0.09833814003385191, 0.14702350696982952, 0.20350504897777935, 0.2665388311160099, 0.3347366435900941, 0.4065965631078265, 0.48053602824064456, 0.5549266957885689, 0.6281303108684108, 0.6985348047827786, 0.7645898366195809, 0.8248410256250178, 0.877962211974623, 0.9227853738926779, 0.9583291958881767, 0.9838388820037521], [0.0011516778570366463, 0.007007259641384834, 0.020314892710314107, 0.04140255944907838, 0.06777171118707022, 0.09471990539100715, 0.11673118519091014, 0.12913645447805186, 0.12947566139904632, 0.11812235960758903, 0.0980077259007553, 0.0735996154023131, 0.04953526814944057, 0.029389573626545828, 0.014963964671407391, 0.006252710929385352, 0.0019796669904054705, 0.0004035147370623091, 3.4292680849059616e-5]))])
mt2 = Tensor(2, mop)
 mt3 = Tensor(3, mop)
 mT2 = [mt2.get([i, i]) for i in 0:(dim(mop) - 1)]
15-element Vector{Float64}:
  0.9999999999996537
@@ -180,4 +180,4 @@
  0.0
  0.0
  0.0
- 0.0
+ 0.0 diff --git a/dev/search/index.html b/dev/search/index.html index 6c77354..56a1180 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-90474609-3', {'page_path': location.pathname + location.search + location.hash}); - + diff --git a/dev/type_hierarchy/index.html b/dev/type_hierarchy/index.html index 5a92c37..51138e4 100644 --- a/dev/type_hierarchy/index.html +++ b/dev/type_hierarchy/index.html @@ -59,4 +59,4 @@ ├─ Uniform01OrthoPoly ├─ Uniform_11OrthoPoly ├─ genHermiteOrthoPoly -└─ genLaguerreOrthoPoly

Their fields follow

NameMeaning
deg::IntMaximum degree
α::Vector{<:Real}Vector of recurrence coefficients
β::Vector{<:Real}Vector of recurrence coefficients
measure::CanonicalMeasureUnderlying canonical measure
quad::AbstractQuadQuadrature rule

Quad

Quadrature rules are intricately related to orthogonal polynomials. An $n$-point quadrature rule is a pair of so-called nodes $t_k$ and weights $w_k$ for $k=1,\dots,n$ that allow to solve integrals relative to the measure

\[\int_\Omega f(t) w(t) \mathrm{d} t \approx \sum_{k=1}^n w_k f(t_k).\]

If the integrand $f$ is polynomial, then the specific Gauss quadrature rules possess the remarkable property that an $n$-point quadrature rule can integrate polynomial integrands $f$ of degree at most $2n-1$ exactly; no approximation error is made.

The fields of Quad are

NameMeaning
name::StringName
Nquad::IntNumber $n$ of quadrature points
nodes::Vector{<:Real}Nodes
weights::Vector{<:Real}Weights

with obvious meanings.

PolyChaos provides the type EmptyQuad that is added in case no quadrature rule is desired.

This tutorial shows the above in action.

Tensor

The last type we need to address is Tensor. It is used to store the results of scalar products. Its fields are

NameMeaning
dim:Dimension $m$ of tensor $\langle \phi_{i_1} \phi_{i_2} \cdots \phi_{i_{m-1}}, \phi_{i_m} \rangle$
T::SparseVector{Float64,Int}Entries of tensor
get::FunctionFunction to get entries from T
op::AbstractOrthoPolyUnderlying univariate orthogonal polynomials

The dimension $m$ of the tensor is the number of terms that appear in the scalar product. Let's assume we set $m = 3$, hence have $\langle \phi_{i} \phi_{j}, \phi_{k} \rangle$, then the concrete entry is obtained as Tensor.get([i,j,k]).

This tutorial shows the above in action.

+└─ genLaguerreOrthoPoly

Their fields follow

NameMeaning
deg::IntMaximum degree
α::Vector{<:Real}Vector of recurrence coefficients
β::Vector{<:Real}Vector of recurrence coefficients
measure::CanonicalMeasureUnderlying canonical measure
quad::AbstractQuadQuadrature rule

Quad

Quadrature rules are intricately related to orthogonal polynomials. An $n$-point quadrature rule is a pair of so-called nodes $t_k$ and weights $w_k$ for $k=1,\dots,n$ that allow to solve integrals relative to the measure

\[\int_\Omega f(t) w(t) \mathrm{d} t \approx \sum_{k=1}^n w_k f(t_k).\]

If the integrand $f$ is polynomial, then the specific Gauss quadrature rules possess the remarkable property that an $n$-point quadrature rule can integrate polynomial integrands $f$ of degree at most $2n-1$ exactly; no approximation error is made.

The fields of Quad are

NameMeaning
name::StringName
Nquad::IntNumber $n$ of quadrature points
nodes::Vector{<:Real}Nodes
weights::Vector{<:Real}Weights

with obvious meanings.

PolyChaos provides the type EmptyQuad that is added in case no quadrature rule is desired.

This tutorial shows the above in action.

Tensor

The last type we need to address is Tensor. It is used to store the results of scalar products. Its fields are

NameMeaning
dim:Dimension $m$ of tensor $\langle \phi_{i_1} \phi_{i_2} \cdots \phi_{i_{m-1}}, \phi_{i_m} \rangle$
T::SparseVector{Float64,Int}Entries of tensor
get::FunctionFunction to get entries from T
op::AbstractOrthoPolyUnderlying univariate orthogonal polynomials

The dimension $m$ of the tensor is the number of terms that appear in the scalar product. Let's assume we set $m = 3$, hence have $\langle \phi_{i} \phi_{j}, \phi_{k} \rangle$, then the concrete entry is obtained as Tensor.get([i,j,k]).

This tutorial shows the above in action.