From b12a2fb9facf44c726bea4587618417666531ca6 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 1 Oct 2025 12:24:58 +0400 Subject: [PATCH 01/28] Fix a bunch of doc builds --- docs/make.jl | 1 - docs/src/getting_started/first_simulation.md | 3 +-- docs/src/showcase/missing_physics.md | 6 +++--- .../showcase/optimal_data_gathering_for_missing_physics.md | 2 +- docs/src/showcase/optimization_under_uncertainty.md | 2 +- docs/src/showcase/pinngpu.md | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index c11103140b..f2c5c75ddb 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -79,7 +79,6 @@ makedocs(sitename = "Overview of Julia's SciML", "highlevels/developer_documentation.md"], "Extra Learning Resources" => ["highlevels/learning_resources.md"] ]], - warnonly = true, ) deploydocs(repo = "github.com/SciML/SciMLDocs") diff --git a/docs/src/getting_started/first_simulation.md b/docs/src/getting_started/first_simulation.md index 0f6be19edf..5378e227ed 100644 --- a/docs/src/getting_started/first_simulation.md +++ b/docs/src/getting_started/first_simulation.md @@ -269,8 +269,7 @@ import DifferentialEquations as DE import ModelingToolkit as MTK import ModelingToolkit: t_nounits as t, D_nounits as D, @variables, @parameters, @named @parameters α=1.5 β=1.0 γ=3.0 δ=1.0 -@variables t 🐰(t)=1.0 🐺(t)=1.0 -D = MTK.Differential(t) +@variables 🐰(t)=1.0 🐺(t)=1.0 eqs = [D(🐰) ~ α * 🐰 - β * 🐰 * 🐺, D(🐺) ~ -γ * 🐺 + δ * 🐰 * 🐺] diff --git a/docs/src/showcase/missing_physics.md b/docs/src/showcase/missing_physics.md index 69bce1dbc3..16403c60ef 100644 --- a/docs/src/showcase/missing_physics.md +++ b/docs/src/showcase/missing_physics.md @@ -414,7 +414,7 @@ options = DataDrivenDiffEq.DataDrivenCommonOptions(maxiters = 10_000, data_processing = DataDrivenDiffEq.DataProcessing(split = 0.9, batchsize = 30, shuffle = true, - rng = StableRNG(1111))) + rng = StableRNGs.StableRNG(1111))) full_res = DataDrivenDiffEq.solve(full_problem, basis, opt, options = options) full_eqs = DataDrivenDiffEq.get_basis(full_res) @@ -428,7 +428,7 @@ options = DataDrivenDiffEq.DataDrivenCommonOptions(maxiters = 10_000, data_processing = DataDrivenDiffEq.DataProcessing(split = 0.9, batchsize = 30, shuffle = true, - rng = StableRNG(1111))) + rng = StableRNGs.StableRNG(1111))) ideal_res = DataDrivenDiffEq.solve(ideal_problem, basis, opt, options = options) ideal_eqs = DataDrivenDiffEq.get_basis(ideal_res) @@ -442,7 +442,7 @@ options = DataDrivenDiffEq.DataDrivenCommonOptions(maxiters = 10_000, data_processing = DataDrivenDiffEq.DataProcessing(split = 0.9, batchsize = 30, shuffle = true, - rng = StableRNG(1111))) + rng = StableRNGs.StableRNG(1111))) nn_res = DataDrivenDiffEq.solve(nn_problem, basis, opt, options = options) nn_eqs = DataDrivenDiffEq.get_basis(nn_res) diff --git a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md index c363ad5b7e..71b066f82f 100644 --- a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md +++ b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md @@ -11,7 +11,7 @@ To this end, we will rely on the following packages: using Random; Random.seed!(984519674645) using StableRNGs; rng = StableRNG(845652695) import ModelingToolkit as MTK -import ModelingToolkit: t_nounits as t, D_nounits as D, @mtkcompile, mtkcompile +import ModelingToolkit: t_nounits as t, D_nounits as D, @mtkmodel, @mtkcompile, mtkcompile import ModelingToolkitNeuralNets import OrdinaryDiffEqRosenbrock as ODE import SymbolicIndexingInterface diff --git a/docs/src/showcase/optimization_under_uncertainty.md b/docs/src/showcase/optimization_under_uncertainty.md index 7919f7aa77..665b3a9649 100644 --- a/docs/src/showcase/optimization_under_uncertainty.md +++ b/docs/src/showcase/optimization_under_uncertainty.md @@ -19,7 +19,7 @@ end ground_condition(u, t, integrator) = u[3] ground_affect!(integrator) = integrator.u[4] = -integrator.p[2] * integrator.u[4] -ground_cb = DE.DE.ContinuousCallback(ground_condition, ground_affect!) +ground_cb = DE.ContinuousCallback(ground_condition, ground_affect!) u0 = [0.0, 2.0, 50.0, 0.0] tspan = (0.0, 50.0) diff --git a/docs/src/showcase/pinngpu.md b/docs/src/showcase/pinngpu.md index 08aa1c5a5e..57fc81943f 100644 --- a/docs/src/showcase/pinngpu.md +++ b/docs/src/showcase/pinngpu.md @@ -22,7 +22,7 @@ our packages look like: # High Level Interface import NeuralPDE import ModelingToolkit as MTK -using MTK: @parameters, @variables, Differential, Interval, PDESystem +using ModelingToolkit: @parameters, @variables, Differential, Interval, PDESystem # Optimization Libraries import Optimization as OPT From b6232aec2e2f1a422571bcb43fee323a92994c27 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 1 Oct 2025 21:40:00 -0400 Subject: [PATCH 02/28] Update missing_physics.md --- docs/src/showcase/missing_physics.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/showcase/missing_physics.md b/docs/src/showcase/missing_physics.md index 16403c60ef..1a60974256 100644 --- a/docs/src/showcase/missing_physics.md +++ b/docs/src/showcase/missing_physics.md @@ -410,7 +410,7 @@ regressions: ```@example ude options = DataDrivenDiffEq.DataDrivenCommonOptions(maxiters = 10_000, normalize = DataDrivenDiffEq.DataNormalization(DataDrivenDiffEq.ZScoreTransform), - selector = bic, digits = 1, + selector = DataDrivenDiffEq.bic, digits = 1, data_processing = DataDrivenDiffEq.DataProcessing(split = 0.9, batchsize = 30, shuffle = true, @@ -424,7 +424,7 @@ println(full_res) ```@example ude options = DataDrivenDiffEq.DataDrivenCommonOptions(maxiters = 10_000, normalize = DataDrivenDiffEq.DataNormalization(DataDrivenDiffEq.ZScoreTransform), - selector = bic, digits = 1, + selector = DataDrivenDiffEq.bic, digits = 1, data_processing = DataDrivenDiffEq.DataProcessing(split = 0.9, batchsize = 30, shuffle = true, @@ -438,7 +438,7 @@ println(ideal_res) ```@example ude options = DataDrivenDiffEq.DataDrivenCommonOptions(maxiters = 10_000, normalize = DataDrivenDiffEq.DataNormalization(DataDrivenDiffEq.ZScoreTransform), - selector = bic, digits = 1, + selector = DataDrivenDiffEq.bic, digits = 1, data_processing = DataDrivenDiffEq.DataProcessing(split = 0.9, batchsize = 30, shuffle = true, From 6686ddf899b74226510218791883125dbe9c2efd Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 2 Oct 2025 06:23:50 -0400 Subject: [PATCH 03/28] Update missing_physics.md --- docs/src/showcase/missing_physics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/missing_physics.md b/docs/src/showcase/missing_physics.md index 1a60974256..0eb961127b 100644 --- a/docs/src/showcase/missing_physics.md +++ b/docs/src/showcase/missing_physics.md @@ -525,7 +525,7 @@ p1 = Plots.plot(t, abs.(Array(solution) .- estimate)' .+ eps(Float32), legend = :topright) # Plot L₂ -p2 = plot3d(X̂[1, :], X̂[2, :], Ŷ[2, :], lw = 3, +p2 = Plots.plot3d(X̂[1, :], X̂[2, :], Ŷ[2, :], lw = 3, title = "Neural Network Fit of U2(t)", color = c1, label = "Neural Network", xaxis = "x", yaxis = "y", titlefont = "Helvetica", legendfont = "Helvetica", From 31087465affa11357e2cd23c90e30ce3c5e9cd13 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 2 Oct 2025 21:47:00 -0400 Subject: [PATCH 04/28] Update missing_physics.md --- docs/src/showcase/missing_physics.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/showcase/missing_physics.md b/docs/src/showcase/missing_physics.md index 0eb961127b..642538a1af 100644 --- a/docs/src/showcase/missing_physics.md +++ b/docs/src/showcase/missing_physics.md @@ -532,7 +532,7 @@ p2 = Plots.plot3d(X̂[1, :], X̂[2, :], Ŷ[2, :], lw = 3, legend = :bottomright) Plots.plot!(X̂[1, :], X̂[2, :], Ȳ[2, :], lw = 3, label = "True Missing Term", color = c2) -p3 = scatter(solution, color = [c1 c2], label = ["x data" "y data"], +p3 = Plots.scatter(solution, color = [c1 c2], label = ["x data" "y data"], title = "Extrapolated Fit From Short Training Data", titlefont = "Helvetica", legendfont = "Helvetica", markersize = 5) @@ -542,8 +542,8 @@ Plots.plot!(p3, true_solution_long, color = [c1 c2], linestyle = :dot, lw = 5, Plots.plot!(p3, estimate_long, color = [c3 c4], lw = 1, label = ["Estimated x(t)" "Estimated y(t)"]) Plots.plot!(p3, [2.99, 3.01], [0.0, 10.0], lw = 1, color = :black, label = nothing) -annotate!([(1.5, 13, text("Training \nData", 10, :center, :top, :black, "Helvetica"))]) -l = @layout [grid(1, 2) - grid(1, 1)] +Plots.annotate!([(1.5, 13, text("Training \nData", 10, :center, :top, :black, "Helvetica"))]) +l = Plots.@layout [Plots.grid(1, 2) + Plots.grid(1, 1)] Plots.plot(p1, p2, p3, layout = l) ``` From e2323411ccfe9f64bdbcb3130f92e81018fc046d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 4 Oct 2025 00:06:36 -0400 Subject: [PATCH 05/28] Update missing_physics.md --- docs/src/showcase/missing_physics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/missing_physics.md b/docs/src/showcase/missing_physics.md index 642538a1af..eb9e4f1b1c 100644 --- a/docs/src/showcase/missing_physics.md +++ b/docs/src/showcase/missing_physics.md @@ -542,7 +542,7 @@ Plots.plot!(p3, true_solution_long, color = [c1 c2], linestyle = :dot, lw = 5, Plots.plot!(p3, estimate_long, color = [c3 c4], lw = 1, label = ["Estimated x(t)" "Estimated y(t)"]) Plots.plot!(p3, [2.99, 3.01], [0.0, 10.0], lw = 1, color = :black, label = nothing) -Plots.annotate!([(1.5, 13, text("Training \nData", 10, :center, :top, :black, "Helvetica"))]) +Plots.annotate!([(1.5, 13, Plots.text("Training \nData", 10, :center, :top, :black, "Helvetica"))]) l = Plots.@layout [Plots.grid(1, 2) Plots.grid(1, 1)] Plots.plot(p1, p2, p3, layout = l) From 5cedfedbc64d074c8ded8af23009094da6d420a7 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 5 Oct 2025 02:41:47 -0400 Subject: [PATCH 06/28] Update optimization_under_uncertainty.md --- docs/src/showcase/optimization_under_uncertainty.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/showcase/optimization_under_uncertainty.md b/docs/src/showcase/optimization_under_uncertainty.md index 665b3a9649..a9cac7360b 100644 --- a/docs/src/showcase/optimization_under_uncertainty.md +++ b/docs/src/showcase/optimization_under_uncertainty.md @@ -34,8 +34,8 @@ For this particular problem, we wish to measure the impact distance from a point ```@example control stop_condition(u, t, integrator) = u[1] - 25.0 -stop_cb = DE.DE.ContinuousCallback(stop_condition, DE.terminate!) -cbs = DE.DE.CallbackSet(ground_cb, stop_cb) +stop_cb = DE.ContinuousCallback(stop_condition, DE.terminate!) +cbs = DE.CallbackSet(ground_cb, stop_cb) tspan = (0.0, 1500.0) prob = DE.ODEProblem(ball!, u0, tspan, p) @@ -68,9 +68,9 @@ import Distributions cor_dist = Distributions.truncated(Distributions.Normal(0.9, 0.02), 0.9 - 3 * 0.02, 1.0) trajectories = 100 -prob_func(prob, i, repeat) = DE.DE.remake(prob, p = [p[1], rand(cor_dist)]) -ensemble_prob = DE.DE.EnsembleProblem(prob, prob_func = prob_func) -ensemblesol = DE.solve(ensemble_prob, DE.Tsit5(), DE.DE.EnsembleThreads(), trajectories = trajectories, +prob_func(prob, i, repeat) = DE.remake(prob, p = [p[1], rand(cor_dist)]) +ensemble_prob = DE.EnsembleProblem(prob, prob_func = prob_func) +ensemblesol = DE.solve(ensemble_prob, DE.Tsit5(), DE.EnsembleThreads(), trajectories = trajectories, callback = cbs) begin # plot From 2becae6e0cd7fa1bb7009e44e85c4dd2c8f65e15 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 5 Oct 2025 02:44:15 -0400 Subject: [PATCH 07/28] Update pinngpu.md --- docs/src/showcase/pinngpu.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/src/showcase/pinngpu.md b/docs/src/showcase/pinngpu.md index 57fc81943f..74ff4ab108 100644 --- a/docs/src/showcase/pinngpu.md +++ b/docs/src/showcase/pinngpu.md @@ -32,7 +32,8 @@ import OptimizationOptimisers import Lux import LuxCUDA import ComponentArrays -const gpud = LuxCUDA.gpu_device() # allocate a GPU device +import MLDataDevices +const gpud = MLDataDevices.gpu_device() # allocate a GPU device # Standard Libraries import Printf From 127912837e7b63ddae8c5073a3626912a9d00673 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 5 Oct 2025 02:45:09 -0400 Subject: [PATCH 08/28] Update Project.toml --- docs/Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Project.toml b/docs/Project.toml index 1838bfb8e4..7573be4891 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -24,6 +24,7 @@ Lux = "b2108857-7c20-44ae-9111-449ecde12c47" LuxCUDA = "d0bbae9a-e099-4d5b-a835-1c6931763bda" LuxCore = "bb33d45b-7691-41d6-9220-0943567d0623" MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d" +MLDataDevices = "7e8f7934-dd98-4c1a-8fe8-92b47a384d40" Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" MethodOfLines = "94925ecb-adb7-4558-8ed8-f975c56a0bf4" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" From c44b6a44047affa2cc5fe7f36d1db345275990c2 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 5 Oct 2025 02:47:58 -0400 Subject: [PATCH 09/28] Update make.jl --- docs/make.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index f2c5c75ddb..bd7e6cb084 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -26,7 +26,11 @@ makedocs(sitename = "Overview of Julia's SciML", "https://bkamins.github.io/julialang/2020/12/24/minilanguage.html", "https://arxiv.org/abs/2109.06786", "https://arxiv.org/abs/2001.04385", - "https://code.visualstudio.com/"], + "https://code.visualstudio.com/", + "https://www.biorxiv.org/content/10.1101/2020.11.28.402297v2", + "https://github.com/JuliaDiff/ForwardDiff.jl/blob/master/docs/src/dev/how_it_works.md", + "https://github.com/SciML/Optimization.jl/blob/master/lib/OptimizationPolyalgorithms/src/OptimizationPolyalgorithms.jl", + ], format = Documenter.HTML(assets = ["assets/favicon.ico"], canonical = "https://docs.sciml.ai/stable/", mathengine = mathengine), From 4601d2de78bfd6e25546926b1c6cd205da722c72 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 5 Oct 2025 02:49:11 -0400 Subject: [PATCH 10/28] Update modeling_languages.md --- docs/src/highlevels/modeling_languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/highlevels/modeling_languages.md b/docs/src/highlevels/modeling_languages.md index e685b6c91a..4e63ad6719 100644 --- a/docs/src/highlevels/modeling_languages.md +++ b/docs/src/highlevels/modeling_languages.md @@ -80,7 +80,7 @@ making it a solid foundation for any agent-based model. ## Unitful.jl: A Julia package for physical units Supports not only SI units, but also any other unit system. -[Unitful.jl](https://painterqubits.github.io/Unitful.jl/stable/) has minimal run-time penalty of units. +[Unitful.jl](https://juliaphysics.github.io/Unitful.jl/stable/) has minimal run-time penalty of units. Includes facilities for dimensional analysis, and integrates easily with the usual mathematical operations and collections that are defined in Julia. ## ReactionMechanismSimulator.jl: Simulation and Analysis of Large Chemical Reaction Systems From 364d8911b47336cb9c17f745d02364c079a90be1 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 5 Oct 2025 02:49:20 -0400 Subject: [PATCH 11/28] Update ode_types.md --- docs/src/showcase/ode_types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/ode_types.md b/docs/src/showcase/ode_types.md index 2e30174d34..428f3d28c2 100644 --- a/docs/src/showcase/ode_types.md +++ b/docs/src/showcase/ode_types.md @@ -11,7 +11,7 @@ few useful/interesting types that can be used: | ArbFloat | [ArbNumerics.jl](https://github.com/JeffreySarnoff/ArbNumerics.jl) | More efficient higher precision solutions | | Measurement | [Measurements.jl](https://github.com/JuliaPhysics/Measurements.jl) | Uncertainty propagation | | Particles | [MonteCarloMeasurements.jl](https://github.com/baggepinnen/MonteCarloMeasurements.jl) | Uncertainty propagation | -| Unitful | [Unitful.jl](https://painterqubits.github.io/Unitful.jl/stable/) | Unit-checked arithmetic | +| Unitful | [Unitful.jl](https://juliaphysics.github.io/Unitful.jl/stable/) | Unit-checked arithmetic | | Quaternion | [Quaternions.jl](https://juliageometry.github.io/Quaternions.jl/stable/) | Quaternions, duh. | | Fun | [ApproxFun.jl](https://juliaapproximation.github.io/ApproxFun.jl/latest/) | Representing PDEs as ODEs in function spaces | | AbstractOrthoPoly | [PolyChaos.jl](https://docs.sciml.ai/PolyChaos/stable/) | Polynomial Chaos Expansion (PCE) for uncertainty quantification | From 7f0876ef9dbeddef297fb630ccde096679d04409 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 5 Oct 2025 02:55:46 -0400 Subject: [PATCH 12/28] Update optimal_data_gathering_for_missing_physics.md --- .../showcase/optimal_data_gathering_for_missing_physics.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md index 71b066f82f..c7b3e39197 100644 --- a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md +++ b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md @@ -58,11 +58,11 @@ This can be implemented in MTK as: y_x_s = 0.777 m = 0.0 end - MTK.@parameters begin + @parameters begin controls[1:length(optimization_state)-1] = optimization_state[2:end], [tunable = false] # optimization_state is defined further below Q_in = optimization_initial, [tunable = false] # similar for optimization state end - MTK.@variables begin + @variables begin C_s(t) = 1.0 C_x(t) = 1.0 V(t) = 7.0 @@ -556,4 +556,4 @@ like with a double division. This is because symbolic regression considers multiplication and division to have the same complexity. In this tutorial, we have shown that experimental design can be used to explore the state space of a dynamic system in a thoughtful way, -such that missing physics can be recovered in an efficient manner. \ No newline at end of file +such that missing physics can be recovered in an efficient manner. From 1f02d95e6891da7f1135587cb3bbb1eba3c9caec Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 5 Oct 2025 20:31:05 -0400 Subject: [PATCH 13/28] Update optimal_data_gathering_for_missing_physics.md --- docs/src/showcase/optimal_data_gathering_for_missing_physics.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md index c7b3e39197..a299e51e4c 100644 --- a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md +++ b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md @@ -12,6 +12,7 @@ using Random; Random.seed!(984519674645) using StableRNGs; rng = StableRNG(845652695) import ModelingToolkit as MTK import ModelingToolkit: t_nounits as t, D_nounits as D, @mtkmodel, @mtkcompile, mtkcompile +using ModelingToolkit import ModelingToolkitNeuralNets import OrdinaryDiffEqRosenbrock as ODE import SymbolicIndexingInterface From d0cc89e151099ace428264c2b66f9c6b8a2cc8cf Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 6 Oct 2025 04:33:19 -0400 Subject: [PATCH 14/28] Update optimal_data_gathering_for_missing_physics.md --- docs/src/showcase/optimal_data_gathering_for_missing_physics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md index a299e51e4c..2cb7d91349 100644 --- a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md +++ b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md @@ -107,7 +107,7 @@ We thus extend the bioreactor MTK model with this equation: ```@example DoE @mtkmodel TrueBioreactor begin @extend Bioreactor() - MTK.@parameters begin + @parameters begin μ_max = 0.421 K_s = 0.439*10 end From 7eaf8cdcce69c51a1c1c266a3614134679995419 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 6 Oct 2025 04:34:14 -0400 Subject: [PATCH 15/28] Update optimization_under_uncertainty.md --- docs/src/showcase/optimization_under_uncertainty.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/optimization_under_uncertainty.md b/docs/src/showcase/optimization_under_uncertainty.md index a9cac7360b..ab9b4f5f4e 100644 --- a/docs/src/showcase/optimization_under_uncertainty.md +++ b/docs/src/showcase/optimization_under_uncertainty.md @@ -46,7 +46,7 @@ Plots.plot(sol, vars = (1, 3), label = nothing, xlabel = "x", ylabel = "y") To help visualize this problem, we plot as follows, where the star indicates a desired impact location ```@example control -rectangle(xc, yc, w, h) = Shape(xc .+ [-w, w, w, -w] ./ 2.0, yc .+ [-h, -h, h, h] ./ 2.0) +rectangle(xc, yc, w, h) = Plots.Shape(xc .+ [-w, w, w, -w] ./ 2.0, yc .+ [-h, -h, h, h] ./ 2.0) begin Plots.plot(sol, vars = (1, 3), label = nothing, lw = 3, c = :black) From aa276ec60772381915a572e873404eb56c02da76 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 6 Oct 2025 04:36:50 -0400 Subject: [PATCH 16/28] Update optimization_under_uncertainty.md --- .../showcase/optimization_under_uncertainty.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/src/showcase/optimization_under_uncertainty.md b/docs/src/showcase/optimization_under_uncertainty.md index ab9b4f5f4e..494aa29332 100644 --- a/docs/src/showcase/optimization_under_uncertainty.md +++ b/docs/src/showcase/optimization_under_uncertainty.md @@ -9,6 +9,7 @@ First let's consider a 2D bouncing ball, where the states are the horizontal pos ```@example control import DifferentialEquations as DE import Plots +import Statistics function ball!(du, u, p, t) du[1] = u[2] @@ -97,7 +98,7 @@ obs(sol, p) = abs2(sol[3, end] - 25) With the observable defined, we can compute the expected squared miss distance from our Monte Carlo simulation results as ```@example control -mean_ensemble = mean([obs(sol, p) for sol in ensemblesol]) +mean_ensemble = Statistics.mean([obs(sol, p) for sol in ensemblesol]) ``` Alternatively, we can use the `Koopman()` algorithm in SciMLExpectations.jl to compute this expectation much more efficiently as @@ -230,8 +231,8 @@ end Using the previously computed optimal initial conditions, let's compute the probability of hitting this wall ```@example control -sm = SystemMap(DE.remake(prob, u0 = make_u0(minx)), DE.Tsit5(), callback = cbs) -exprob = ExpectationProblem(sm, constraint_obs, h, gd; nout = 1) +sm = SciMLExpectations.SystemMap(DE.remake(prob, u0 = make_u0(minx)), DE.Tsit5(), callback = cbs) +exprob = SciMLExpectations.ExpectationProblem(sm, constraint_obs, h, gd; nout = 1) sol = DE.solve(exprob, Koopman(), ireltol = 1e-5) sol.u ``` @@ -241,8 +242,8 @@ We then set up the constraint function for NLopt just as before. ```@example control function 𝔼_constraint(res, θ, pars) prob = DE.ODEProblem(ball!, make_u0(θ), tspan, p) - sm = SystemMap(prob, DE.Tsit5(), callback = cbs) - exprob = ExpectationProblem(sm, constraint_obs, h, gd; nout = 1) + sm = SciMLExpectations.SystemMap(prob, DE.Tsit5(), callback = cbs) + exprob = SciMLExpectations.ExpectationProblem(sm, constraint_obs, h, gd; nout = 1) sol = DE.solve(exprob, Koopman(), ireltol = 1e-5) res .= sol.u end @@ -250,8 +251,8 @@ opt_lcons = [-Inf] opt_ucons = [0.01] optimizer = OptimizationMOI.MOI.OptimizerWithAttributes(NLopt.Optimizer, "algorithm" => :LD_MMA) -opt_f = OptimizationFunction(𝔼_loss, Optimization.AutoForwardDiff(), cons = 𝔼_constraint) -opt_prob = OptimizationProblem(opt_f, opt_ini; lb = opt_lb, ub = opt_ub, lcons = opt_lcons, +opt_f = OPT.OptimizationFunction(𝔼_loss, Optimization.AutoForwardDiff(), cons = 𝔼_constraint) +opt_prob = OPT.OptimizationProblem(opt_f, opt_ini; lb = opt_lb, ub = opt_ub, lcons = opt_lcons, ucons = opt_ucons) opt_sol = DE.solve(opt_prob, optimizer) minx2 = opt_sol.u From 64f5625f64aa364afd8da3284e77ab622ea2cfc4 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 6 Oct 2025 04:37:36 -0400 Subject: [PATCH 17/28] Update pinngpu.md --- docs/src/showcase/pinngpu.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/showcase/pinngpu.md b/docs/src/showcase/pinngpu.md index 74ff4ab108..b9541a0aa6 100644 --- a/docs/src/showcase/pinngpu.md +++ b/docs/src/showcase/pinngpu.md @@ -101,9 +101,9 @@ bcs = [u(t_min, x, y) ~ analytic_sol_func(t_min, x, y), u(t, x, y_max) ~ analytic_sol_func(t, x, y_max)] # Space and time domains -domains = [t ∈ MTK.Interval(t_min, t_max), - x ∈ MTK.Interval(x_min, x_max), - y ∈ MTK.Interval(y_min, y_max)] +domains = [t ∈ Interval(t_min, t_max), + x ∈ Interval(x_min, x_max), + y ∈ Interval(y_min, y_max)] @named pde_system = PDESystem(eq, bcs, domains, [t, x, y], [u(t, x, y)]) ``` From d4a6e7e67c8a9fffb5abbf5780c0955ec3b529e0 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 6 Oct 2025 04:38:27 -0400 Subject: [PATCH 18/28] Update brusselator.md --- docs/src/showcase/brusselator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/brusselator.md b/docs/src/showcase/brusselator.md index a778456142..db81f41499 100644 --- a/docs/src/showcase/brusselator.md +++ b/docs/src/showcase/brusselator.md @@ -65,7 +65,7 @@ We wish to obtain the solution to this PDE on a timespan of ``t \in [0,11.5]``. ## Defining the symbolic PDEsystem with ModelingToolkit.jl -With `ModelingToolkit.jl`, we first symbolically define the system, see also the docs for [`PDESystem`](https://docs.sciml.ai/ModelingToolkit/stable/systems/PDESystem/): +With `ModelingToolkit.jl`, we first symbolically define the system, see also the docs for [`PDESystem`](https://docs.sciml.ai/ModelingToolkit/stable/API/PDESystem/): ```@example bruss import ModelingToolkit as MTK From 520194f0aae6ca656c9e978135a52e17a5ae89b3 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 6 Oct 2025 17:45:41 -0400 Subject: [PATCH 19/28] Update optimal_data_gathering_for_missing_physics.md --- docs/src/showcase/optimal_data_gathering_for_missing_physics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md index 2cb7d91349..b56c54aac9 100644 --- a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md +++ b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md @@ -128,7 +128,7 @@ Similarly, we can extend the bioreactor with a neural network to represent this Lux.Dense(5, 1, x->1*sigmoid(x))) end @components begin - nn = NeuralNetworkBlock(; n_input=1, n_output=1, chain, rng) + nn = ModelingToolkitNeuralNets.NeuralNetworkBlock(; n_input=1, n_output=1, chain, rng) end @equations begin nn.output.u[1] ~ μ From 3b50da72780275910a607ea5fceb479ed7750dd5 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 6 Oct 2025 17:47:13 -0400 Subject: [PATCH 20/28] Update optimization_under_uncertainty.md --- docs/src/showcase/optimization_under_uncertainty.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/showcase/optimization_under_uncertainty.md b/docs/src/showcase/optimization_under_uncertainty.md index 494aa29332..ef4a9f3b37 100644 --- a/docs/src/showcase/optimization_under_uncertainty.md +++ b/docs/src/showcase/optimization_under_uncertainty.md @@ -101,7 +101,7 @@ With the observable defined, we can compute the expected squared miss distance f mean_ensemble = Statistics.mean([obs(sol, p) for sol in ensemblesol]) ``` -Alternatively, we can use the `Koopman()` algorithm in SciMLExpectations.jl to compute this expectation much more efficiently as +Alternatively, we can use the `SciMLExpectations.Koopman()` algorithm in SciMLExpectations.jl to compute this expectation much more efficiently as ```@example control import SciMLExpectations @@ -233,7 +233,7 @@ Using the previously computed optimal initial conditions, let's compute the prob ```@example control sm = SciMLExpectations.SystemMap(DE.remake(prob, u0 = make_u0(minx)), DE.Tsit5(), callback = cbs) exprob = SciMLExpectations.ExpectationProblem(sm, constraint_obs, h, gd; nout = 1) -sol = DE.solve(exprob, Koopman(), ireltol = 1e-5) +sol = DE.solve(exprob, SciMLExpectations.Koopman(), ireltol = 1e-5) sol.u ``` @@ -244,7 +244,7 @@ function 𝔼_constraint(res, θ, pars) prob = DE.ODEProblem(ball!, make_u0(θ), tspan, p) sm = SciMLExpectations.SystemMap(prob, DE.Tsit5(), callback = cbs) exprob = SciMLExpectations.ExpectationProblem(sm, constraint_obs, h, gd; nout = 1) - sol = DE.solve(exprob, Koopman(), ireltol = 1e-5) + sol = DE.solve(exprob, SciMLExpectations.Koopman(), ireltol = 1e-5) res .= sol.u end opt_lcons = [-Inf] From a1ab748f4c1002376de1cac346679e5c25c74f59 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 6 Oct 2025 17:48:18 -0400 Subject: [PATCH 21/28] Update pinngpu.md --- docs/src/showcase/pinngpu.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/src/showcase/pinngpu.md b/docs/src/showcase/pinngpu.md index b9541a0aa6..d76278a254 100644 --- a/docs/src/showcase/pinngpu.md +++ b/docs/src/showcase/pinngpu.md @@ -22,7 +22,8 @@ our packages look like: # High Level Interface import NeuralPDE import ModelingToolkit as MTK -using ModelingToolkit: @parameters, @variables, Differential, Interval, PDESystem +using ModelingToolkit: @parameters, @variables, Differential, PDESystem +using DomainSets: Interval # Optimization Libraries import Optimization as OPT From e3c7a4d8197c7478e0e468686f998b26253f29c6 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 7 Oct 2025 01:17:12 -0400 Subject: [PATCH 22/28] Update optimization_under_uncertainty.md --- docs/src/showcase/optimization_under_uncertainty.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/optimization_under_uncertainty.md b/docs/src/showcase/optimization_under_uncertainty.md index ef4a9f3b37..dfe2127d21 100644 --- a/docs/src/showcase/optimization_under_uncertainty.md +++ b/docs/src/showcase/optimization_under_uncertainty.md @@ -249,7 +249,7 @@ function 𝔼_constraint(res, θ, pars) end opt_lcons = [-Inf] opt_ucons = [0.01] -optimizer = OptimizationMOI.MOI.OptimizerWithAttributes(NLopt.Optimizer, +optimizer = OptimizationMOI.MOI.OptimizerWithAttributes(OptimizationNLopt.NLopt.Optimizer, "algorithm" => :LD_MMA) opt_f = OPT.OptimizationFunction(𝔼_loss, Optimization.AutoForwardDiff(), cons = 𝔼_constraint) opt_prob = OPT.OptimizationProblem(opt_f, opt_ini; lb = opt_lb, ub = opt_ub, lcons = opt_lcons, From 9c3304f52014964c4498d8b3b19160f534008309 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 7 Oct 2025 01:17:51 -0400 Subject: [PATCH 23/28] Update pinngpu.md --- docs/src/showcase/pinngpu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/pinngpu.md b/docs/src/showcase/pinngpu.md index d76278a254..508eb5631f 100644 --- a/docs/src/showcase/pinngpu.md +++ b/docs/src/showcase/pinngpu.md @@ -106,7 +106,7 @@ domains = [t ∈ Interval(t_min, t_max), x ∈ Interval(x_min, x_max), y ∈ Interval(y_min, y_max)] -@named pde_system = PDESystem(eq, bcs, domains, [t, x, y], [u(t, x, y)]) +MTK.@named pde_system = PDESystem(eq, bcs, domains, [t, x, y], [u(t, x, y)]) ``` !!! note From 377695b8a81374df328f7de07f100b57093ad244 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 7 Oct 2025 11:15:46 -0400 Subject: [PATCH 24/28] Update optimization_under_uncertainty.md --- docs/src/showcase/optimization_under_uncertainty.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/showcase/optimization_under_uncertainty.md b/docs/src/showcase/optimization_under_uncertainty.md index dfe2127d21..bfad4e7568 100644 --- a/docs/src/showcase/optimization_under_uncertainty.md +++ b/docs/src/showcase/optimization_under_uncertainty.md @@ -251,7 +251,7 @@ opt_lcons = [-Inf] opt_ucons = [0.01] optimizer = OptimizationMOI.MOI.OptimizerWithAttributes(OptimizationNLopt.NLopt.Optimizer, "algorithm" => :LD_MMA) -opt_f = OPT.OptimizationFunction(𝔼_loss, Optimization.AutoForwardDiff(), cons = 𝔼_constraint) +opt_f = OPT.OptimizationFunction(𝔼_loss, OPT.AutoForwardDiff(), cons = 𝔼_constraint) opt_prob = OPT.OptimizationProblem(opt_f, opt_ini; lb = opt_lb, ub = opt_ub, lcons = opt_lcons, ucons = opt_ucons) opt_sol = DE.solve(opt_prob, optimizer) From 40c8fc7ea65b0ab4f338477e83372a5ef77ad99a Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 7 Oct 2025 11:16:30 -0400 Subject: [PATCH 25/28] Update make.jl --- docs/make.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/make.jl b/docs/make.jl index bd7e6cb084..fbb7305819 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -30,6 +30,7 @@ makedocs(sitename = "Overview of Julia's SciML", "https://www.biorxiv.org/content/10.1101/2020.11.28.402297v2", "https://github.com/JuliaDiff/ForwardDiff.jl/blob/master/docs/src/dev/how_it_works.md", "https://github.com/SciML/Optimization.jl/blob/master/lib/OptimizationPolyalgorithms/src/OptimizationPolyalgorithms.jl", + "http://www.scholarpedia.org/article/Differential-algebraic_equations", ], format = Documenter.HTML(assets = ["assets/favicon.ico"], canonical = "https://docs.sciml.ai/stable/", From 05b0a14006c7cd5743df4f68c5c37b458a35be10 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 7 Oct 2025 11:16:59 -0400 Subject: [PATCH 26/28] Update optimal_data_gathering_for_missing_physics.md --- .../showcase/optimal_data_gathering_for_missing_physics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md index b56c54aac9..d0c4fba32e 100644 --- a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md +++ b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md @@ -131,8 +131,8 @@ Similarly, we can extend the bioreactor with a neural network to represent this nn = ModelingToolkitNeuralNets.NeuralNetworkBlock(; n_input=1, n_output=1, chain, rng) end @equations begin - nn.output.u[1] ~ μ - nn.input.u[1] ~ C_s + nn.outputs[1] ~ μ + nn.inputs[1] ~ C_s end end nothing # hide From e692ccf6e64c7c98c32bc086c0b530c19e749f2f Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 8 Oct 2025 02:54:28 -0400 Subject: [PATCH 27/28] Update optimal_data_gathering_for_missing_physics.md --- .../showcase/optimal_data_gathering_for_missing_physics.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md index d0c4fba32e..e67cc2cf3f 100644 --- a/docs/src/showcase/optimal_data_gathering_for_missing_physics.md +++ b/docs/src/showcase/optimal_data_gathering_for_missing_physics.md @@ -196,7 +196,7 @@ function loss(x, (probs, get_varss, datas)) loss end of = OPT.OptimizationFunction{true}(loss, SMS.AutoZygote()) -x0 = reduce(vcat, getindex.((default_values(ude_bioreactor),), tunable_parameters(ude_bioreactor))) +x0 = reduce(vcat, getindex.((MTK.default_values(ude_bioreactor),), MTK.tunable_parameters(ude_bioreactor))) get_vars = getu(ude_bioreactor, [ude_bioreactor.C_s]) ps = ([ude_prob], [get_vars], [data]); op = OPT.OptimizationProblem(of, x0, ps) @@ -412,7 +412,7 @@ plot(ude_sol2[3,:]) ude_prob_remake = remake(ude_prob, p=ude_prob2.p) sol_remake = ODE.solve(ude_prob_remake, ODE.Rodas5P()) plot(sol_remake[3,:]) -x0 = reduce(vcat, getindex.((default_values(ude_bioreactor),), tunable_parameters(ude_bioreactor))) +x0 = reduce(vcat, getindex.((MTK.default_values(ude_bioreactor),), MTK.tunable_parameters(ude_bioreactor))) get_vars2 = getu(ude_bioreactor2, [ude_bioreactor2.C_s]) @@ -523,7 +523,7 @@ sol3 = ODE.solve(prob3, ODE.Rodas5P()) @mtkcompile ude_bioreactor3 = UDEBioreactor() ude_prob3 = ODE.ODEProblem(ude_bioreactor3, [], (0.0, 15.0), tstops=0:15, save_everystep=false) -x0 = reduce(vcat, getindex.((default_values(ude_bioreactor3),), tunable_parameters(ude_bioreactor3))) +x0 = reduce(vcat, getindex.((MTK.default_values(ude_bioreactor3),), MTK.tunable_parameters(ude_bioreactor3))) get_vars3 = getu(ude_bioreactor3, [ude_bioreactor3.C_s]) From 48b08f41441645a5d9c0c35432256116272d8471 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 8 Oct 2025 02:55:47 -0400 Subject: [PATCH 28/28] Update make.jl --- docs/make.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/make.jl b/docs/make.jl index fbb7305819..f4ddf5ef64 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -31,6 +31,7 @@ makedocs(sitename = "Overview of Julia's SciML", "https://github.com/JuliaDiff/ForwardDiff.jl/blob/master/docs/src/dev/how_it_works.md", "https://github.com/SciML/Optimization.jl/blob/master/lib/OptimizationPolyalgorithms/src/OptimizationPolyalgorithms.jl", "http://www.scholarpedia.org/article/Differential-algebraic_equations", + "https://computing.llnl.gov/projects/sundials" ], format = Documenter.HTML(assets = ["assets/favicon.ico"], canonical = "https://docs.sciml.ai/stable/",