From 6860bdd759cb41dbc4b3044dc7cedd6e106f16e8 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Wed, 22 Jul 2026 09:30:24 -0400 Subject: [PATCH] Migrate DiffEqProblemLibrary to SciMLTesting 2.4 Add rendered public API docs and restore definition-site problem docstrings. Co-Authored-By: Chris Rackauckas --- Project.toml | 11 +- lib/BVProblemLibrary/Project.toml | 2 - lib/BVProblemLibrary/docs/Project.toml | 8 + lib/BVProblemLibrary/docs/make.jl | 5 + lib/BVProblemLibrary/docs/src/index.md | 11 + lib/BVProblemLibrary/src/BVProblemLibrary.jl | 103 ++- lib/BVProblemLibrary/src/linear.jl | 374 ++++---- lib/BVProblemLibrary/src/nonlinear.jl | 236 ++--- lib/BVProblemLibrary/test/qa/Project.toml | 2 +- lib/BVProblemLibrary/test/qa/qa.jl | 2 +- lib/BVProblemLibrary/test/runtests.jl | 1 - lib/DAEProblemLibrary/Project.toml | 2 - lib/DAEProblemLibrary/docs/Project.toml | 8 + lib/DAEProblemLibrary/docs/make.jl | 5 + lib/DAEProblemLibrary/docs/src/index.md | 11 + .../src/DAEProblemLibrary.jl | 53 +- lib/DAEProblemLibrary/test/qa/Project.toml | 2 +- lib/DAEProblemLibrary/test/qa/qa.jl | 2 +- lib/DAEProblemLibrary/test/runtests.jl | 1 - lib/DDEProblemLibrary/docs/Project.toml | 8 + lib/DDEProblemLibrary/docs/make.jl | 5 + lib/DDEProblemLibrary/docs/src/index.md | 11 + lib/DDEProblemLibrary/src/constant_delays.jl | 202 ++--- lib/DDEProblemLibrary/src/ddetst.jl | 836 +++++++++--------- lib/DDEProblemLibrary/src/radar5.jl | 152 ++-- lib/DDEProblemLibrary/test/qa/Project.toml | 2 +- lib/DDEProblemLibrary/test/qa/qa.jl | 2 +- lib/DDEProblemLibrary/test/runtests.jl | 1 - lib/JumpProblemLibrary/docs/Project.toml | 8 + lib/JumpProblemLibrary/docs/make.jl | 5 + lib/JumpProblemLibrary/docs/src/index.md | 11 + lib/JumpProblemLibrary/test/qa/Project.toml | 2 +- lib/JumpProblemLibrary/test/qa/qa.jl | 5 +- lib/JumpProblemLibrary/test/runtests.jl | 1 - lib/NonlinearProblemLibrary/docs/Project.toml | 8 + lib/NonlinearProblemLibrary/docs/make.jl | 5 + lib/NonlinearProblemLibrary/docs/src/index.md | 11 + .../test/qa/Project.toml | 2 +- lib/NonlinearProblemLibrary/test/qa/qa.jl | 2 +- lib/ODEProblemLibrary/Project.toml | 2 - lib/ODEProblemLibrary/docs/Project.toml | 8 + lib/ODEProblemLibrary/docs/make.jl | 5 + lib/ODEProblemLibrary/docs/src/index.md | 11 + .../src/ODEProblemLibrary.jl | 1 - lib/ODEProblemLibrary/src/brusselator_prob.jl | 52 +- lib/ODEProblemLibrary/src/nonlinchem.jl | 14 +- lib/ODEProblemLibrary/src/ode_linear_prob.jl | 28 +- .../src/ode_simple_nonlinear_prob.jl | 170 ++-- lib/ODEProblemLibrary/src/pollution_prob.jl | 48 +- .../src/strange_attractors.jl | 108 +-- lib/ODEProblemLibrary/test/qa/Project.toml | 2 +- lib/ODEProblemLibrary/test/qa/qa.jl | 2 +- lib/ODEProblemLibrary/test/runtests.jl | 1 - lib/SDEProblemLibrary/Project.toml | 2 - lib/SDEProblemLibrary/docs/Project.toml | 8 + lib/SDEProblemLibrary/docs/make.jl | 5 + lib/SDEProblemLibrary/docs/src/index.md | 11 + .../src/SDEProblemLibrary.jl | 59 +- lib/SDEProblemLibrary/test/qa/Project.toml | 2 +- lib/SDEProblemLibrary/test/qa/qa.jl | 5 +- lib/SDEProblemLibrary/test/runtests.jl | 1 - test/qa/Project.toml | 4 +- test/qa/qa.jl | 10 +- test/runtests.jl | 39 +- 64 files changed, 1373 insertions(+), 1343 deletions(-) create mode 100644 lib/BVProblemLibrary/docs/Project.toml create mode 100644 lib/BVProblemLibrary/docs/make.jl create mode 100644 lib/BVProblemLibrary/docs/src/index.md create mode 100644 lib/DAEProblemLibrary/docs/Project.toml create mode 100644 lib/DAEProblemLibrary/docs/make.jl create mode 100644 lib/DAEProblemLibrary/docs/src/index.md create mode 100644 lib/DDEProblemLibrary/docs/Project.toml create mode 100644 lib/DDEProblemLibrary/docs/make.jl create mode 100644 lib/DDEProblemLibrary/docs/src/index.md create mode 100644 lib/JumpProblemLibrary/docs/Project.toml create mode 100644 lib/JumpProblemLibrary/docs/make.jl create mode 100644 lib/JumpProblemLibrary/docs/src/index.md create mode 100644 lib/NonlinearProblemLibrary/docs/Project.toml create mode 100644 lib/NonlinearProblemLibrary/docs/make.jl create mode 100644 lib/NonlinearProblemLibrary/docs/src/index.md create mode 100644 lib/ODEProblemLibrary/docs/Project.toml create mode 100644 lib/ODEProblemLibrary/docs/make.jl create mode 100644 lib/ODEProblemLibrary/docs/src/index.md create mode 100644 lib/SDEProblemLibrary/docs/Project.toml create mode 100644 lib/SDEProblemLibrary/docs/make.jl create mode 100644 lib/SDEProblemLibrary/docs/src/index.md diff --git a/Project.toml b/Project.toml index c67c817..9cdd7ef 100644 --- a/Project.toml +++ b/Project.toml @@ -12,15 +12,6 @@ NonlinearProblemLibrary = "b7050fa9-e91f-4b37-bcee-a89a063da141" ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" SDEProblemLibrary = "c72e72a9-a271-4b2b-8966-303ed956772e" -[sources] -BVProblemLibrary = {path = "lib/BVProblemLibrary"} -DAEProblemLibrary = {path = "lib/DAEProblemLibrary"} -DDEProblemLibrary = {path = "lib/DDEProblemLibrary"} -JumpProblemLibrary = {path = "lib/JumpProblemLibrary"} -NonlinearProblemLibrary = {path = "lib/NonlinearProblemLibrary"} -ODEProblemLibrary = {path = "lib/ODEProblemLibrary"} -SDEProblemLibrary = {path = "lib/SDEProblemLibrary"} - [compat] BVProblemLibrary = "0.1" DAEProblemLibrary = "0.1" @@ -30,7 +21,7 @@ NonlinearProblemLibrary = "0.1" ODEProblemLibrary = "1" Pkg = "1.10" SafeTestsets = "0.1" -SciMLTesting = "2.1" +SciMLTesting = "2.4" SDEProblemLibrary = "1" Test = "1.10" julia = "1.10" diff --git a/lib/BVProblemLibrary/Project.toml b/lib/BVProblemLibrary/Project.toml index 503f046..1ec8180 100644 --- a/lib/BVProblemLibrary/Project.toml +++ b/lib/BVProblemLibrary/Project.toml @@ -4,12 +4,10 @@ version = "0.1.11" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" [compat] DiffEqBase = "6.158, 7" -Markdown = "1.10" Pkg = "1.10" SafeTestsets = "0.1" SpecialFunctions = "2.3" diff --git a/lib/BVProblemLibrary/docs/Project.toml b/lib/BVProblemLibrary/docs/Project.toml new file mode 100644 index 0000000..07c88f1 --- /dev/null +++ b/lib/BVProblemLibrary/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +BVProblemLibrary = "ded0fc24-dfea-4565-b1d9-79c027d14d84" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" + +[compat] +BVProblemLibrary = "0.1" +Documenter = "1" +julia = "1.10" diff --git a/lib/BVProblemLibrary/docs/make.jl b/lib/BVProblemLibrary/docs/make.jl new file mode 100644 index 0000000..28937b1 --- /dev/null +++ b/lib/BVProblemLibrary/docs/make.jl @@ -0,0 +1,5 @@ +using BVProblemLibrary, Documenter + +makedocs( + ; sitename = "BVProblemLibrary.jl", modules = [BVProblemLibrary], checkdocs = :exports +) diff --git a/lib/BVProblemLibrary/docs/src/index.md b/lib/BVProblemLibrary/docs/src/index.md new file mode 100644 index 0000000..d2b92f9 --- /dev/null +++ b/lib/BVProblemLibrary/docs/src/index.md @@ -0,0 +1,11 @@ +# BVProblemLibrary.jl + +Premade boundary value problems for testing and benchmarking boundary value problem solvers. + +## Public API + +```@autodocs +Modules = [BVProblemLibrary] +Public = true +Private = false +``` diff --git a/lib/BVProblemLibrary/src/BVProblemLibrary.jl b/lib/BVProblemLibrary/src/BVProblemLibrary.jl index 2070818..159297d 100644 --- a/lib/BVProblemLibrary/src/BVProblemLibrary.jl +++ b/lib/BVProblemLibrary/src/BVProblemLibrary.jl @@ -1,7 +1,6 @@ module BVProblemLibrary using DiffEqBase: DiffEqBase, BVPFunction, BVProblem -using Markdown: Markdown using SpecialFunctions: SpecialFunctions, erf include("linear.jl") @@ -37,7 +36,7 @@ flat_moon_function = BVPFunction( flat_moon_f!, (flat_moon_bca!, flat_moon_bcb!), bcresid_prototype = (zeros(4), zeros(3)), twopoint = Val(true) ) -@doc raw""" +""" flat_moon This test problem is about the optimal-time launching of a satellite into orbit from flat moon without atmospheric drag. @@ -45,29 +44,29 @@ This test problem is about the optimal-time launching of a satellite into orbit Given by ```math -\begin{align*} -\frac{dz_1}{dt} &= z_3 t_f, & -\frac{dz_2}{dt} &= z_4 t_f, \\ -\frac{dz_3}{dt} &= A\cos(z_5) t_f, & -\frac{dz_4}{dt} &= (A\sin(z_5)-g) t_f, \\ -\frac{dz_5}{dt} &= -z_6\cos(z_5) t_F, & -\frac{dz_6}{dt} &= z_6^2\sin(z_5) t_f, \\ -\frac{dz_7}{dt} &= 0, -\end{align*} +\\begin{align*} +\\frac{dz_1}{dt} &= z_3 t_f, & +\\frac{dz_2}{dt} &= z_4 t_f, \\\\ +\\frac{dz_3}{dt} &= A\\cos(z_5) t_f, & +\\frac{dz_4}{dt} &= (A\\sin(z_5)-g) t_f, \\\\ +\\frac{dz_5}{dt} &= -z_6\\cos(z_5) t_F, & +\\frac{dz_6}{dt} &= z_6^2\\sin(z_5) t_f, \\\\ +\\frac{dz_7}{dt} &= 0, +\\end{align*} ``` with boundary condition ```math -\begin{align*} +\\begin{align*} z_1(0) &= 0, & -z_2(0) &= 0, \\ +z_2(0) &= 0, \\\\ z_3(0) &= 0, & -z_4(0) &= 0, \\ +z_4(0) &= 0, \\\\ z_5(1) &= h, & -z_6(1) &= V_c, \\ +z_6(1) &= V_c, \\\\ z_7(1) &= 0. -\end{align*} +\\end{align*} ``` # Solution @@ -112,7 +111,7 @@ flat_earth_function = BVPFunction( bcresid_prototype = (zeros(4), zeros(3)), twopoint = Val(true) ) flat_earth_tspan = (0, 700) -@doc raw""" +""" flat_earth Launch of a satellite into circular orbit from a flat Earth where we assume a uniform gravitational field ``g``. @@ -120,29 +119,29 @@ Launch of a satellite into circular orbit from a flat Earth where we assume a un Given by ```math -\begin{align*} -\frac{dz_1}{dt} &= z_3 \frac{V_c}{h}, \\[2pt] -\frac{dz_2}{dt} &= z_4 \frac{V_c}{h}, \\[2pt] -\frac{dz_3}{dt} &= acc \frac{1}{|V_c|\sqrt{1+z_6^2}}, \\[2pt] -\frac{dz_4}{dt} &= acc \frac{1}{|V_c|\sqrt{1+z_6^2}}-\frac{g}{V_c}, \\[2pt] -\frac{dz_5}{dt} &= 0, \\[2pt] -\frac{dz_6}{dt} &= -z_5 \frac{V_c}{h}, \\[2pt] -\frac{dz_7}{dt} &= 0, -\end{align*} +\\begin{align*} +\\frac{dz_1}{dt} &= z_3 \\frac{V_c}{h}, \\\\[2pt] +\\frac{dz_2}{dt} &= z_4 \\frac{V_c}{h}, \\\\[2pt] +\\frac{dz_3}{dt} &= acc \\frac{1}{|V_c|\\sqrt{1+z_6^2}}, \\\\[2pt] +\\frac{dz_4}{dt} &= acc \\frac{1}{|V_c|\\sqrt{1+z_6^2}}-\\frac{g}{V_c}, \\\\[2pt] +\\frac{dz_5}{dt} &= 0, \\\\[2pt] +\\frac{dz_6}{dt} &= -z_5 \\frac{V_c}{h}, \\\\[2pt] +\\frac{dz_7}{dt} &= 0, +\\end{align*} ``` with boundary conditions ```math -\begin{align*} +\\begin{align*} z_1(0) &= 0, & -z_2(0) &= 0, \\ +z_2(0) &= 0, \\\\ z_3(0) &= 0, & -z_4(0) &= 0, \\ +z_4(0) &= 0, \\\\ z_5(1) &= h, & -z_6(1) &= V_c, \\ +z_6(1) &= V_c, \\\\ z_7(1) &= 0. -\end{align*} +\\end{align*} ``` # Solution @@ -226,7 +225,7 @@ flat_earth_drag_function = BVPFunction( bcresid_prototype = (zeros(4), zeros(4)), twopoint = Val(true) ) flat_earth_drag_tspan = (0, 100) -@doc raw""" +""" flat_earth_drag Launch into circular orbit from a flat Earth including atmospheric drag. @@ -234,29 +233,29 @@ Launch into circular orbit from a flat Earth including atmospheric drag. Given by ```math -\begin{align*} -\frac{dz_1}{dt} &= z_3 \frac{V_c}{h} \\ -\frac{dz_2}{dt} &= z_4 \frac{V_c}{h} \\ -\frac{dz_3}{dt} &= \frac{f}{V_c} \left(-\frac{z_6}{z_6^2+z_7^2} - V_c η\exp(-z_2 β) z_3\sqrt{z_3^3+z_4^2}\right)/m \\ -\frac{dz_4}{dt} &= \frac{f}{V_c} \left(-\frac{z_7}{z_6^2+z_7^2} - V_c η\exp(-z_2 β) z_4\sqrt{z_3^3+z_4^2}\right)/m - g_{accel}/V_c \\ -\frac{dz_5}{dt} &= -ηβ \exp(-z_2 β) (z_6z_3+z_7z_4)\sqrt{z_3^3+z_4^2}\frac{V_c}{m} \\ -\frac{dz_6}{dt} &= η \exp(-z_2 β) \left(z_6(2z_3^2+z_4^2)+z_7z_3z_4\right) V_c/\sqrt{z_3^2+z_4^2}/m \\ -\frac{dz_7}{dt} &= η \exp(-z_2 β) \left(z_7(z_3^2+2z_4^2)+z_6z_3z_4\right) V_c/\sqrt{z_3^2+z_4^2}/m \\ -\end{align*} +\\begin{align*} +\\frac{dz_1}{dt} &= z_3 \\frac{V_c}{h} \\\\ +\\frac{dz_2}{dt} &= z_4 \\frac{V_c}{h} \\\\ +\\frac{dz_3}{dt} &= \\frac{f}{V_c} \\left(-\\frac{z_6}{z_6^2+z_7^2} - V_c η\\exp(-z_2 β) z_3\\sqrt{z_3^3+z_4^2}\\right)/m \\\\ +\\frac{dz_4}{dt} &= \\frac{f}{V_c} \\left(-\\frac{z_7}{z_6^2+z_7^2} - V_c η\\exp(-z_2 β) z_4\\sqrt{z_3^3+z_4^2}\\right)/m - g_{accel}/V_c \\\\ +\\frac{dz_5}{dt} &= -ηβ \\exp(-z_2 β) (z_6z_3+z_7z_4)\\sqrt{z_3^3+z_4^2}\\frac{V_c}{m} \\\\ +\\frac{dz_6}{dt} &= η \\exp(-z_2 β) \\left(z_6(2z_3^2+z_4^2)+z_7z_3z_4\\right) V_c/\\sqrt{z_3^2+z_4^2}/m \\\\ +\\frac{dz_7}{dt} &= η \\exp(-z_2 β) \\left(z_7(z_3^2+2z_4^2)+z_6z_3z_4\\right) V_c/\\sqrt{z_3^2+z_4^2}/m \\\\ +\\end{align*} ``` with boundary conditions ```math -\begin{align*} +\\begin{align*} z_1(0) &= 0, & -z_2(0) &= 0, \\ +z_2(0) &= 0, \\\\ z_3(0) &= 0, & -z_4(0) &= 0, \\ +z_4(0) &= 0, \\\\ z_5(1) &= h, & -z_6(1) &= V_c, \\ +z_6(1) &= V_c, \\\\ z_7(1) &= 0. -\end{align*} +\\end{align*} ``` # Solution @@ -293,7 +292,7 @@ function measles_bc!(res, u, p, t) end measles_function = BVPFunction(measles_f!, measles_bc!) measles_tspan = (0, 1) -@doc raw""" +""" measles This is an epidemiology model, about the spread of diseases. @@ -301,11 +300,11 @@ This is an epidemiology model, about the spread of diseases. Given by ```math -\begin{align*} -\frac{dy_1}{dt} &= μ - β(t) y_1 y_3 \\ -\frac{dy_2}{dt} &= β(t) y_1 y_3 - \frac{y_2}{λ} \\ -\frac{dy_3}{dt} &= \frac{y_2}{λ} - \frac{y_3}{η} -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= μ - β(t) y_1 y_3 \\\\ +\\frac{dy_2}{dt} &= β(t) y_1 y_3 - \\frac{y_2}{λ} \\\\ +\\frac{dy_3}{dt} &= \\frac{y_2}{λ} - \\frac{y_3}{η} +\\end{align*} ``` with boundary condition diff --git a/lib/BVProblemLibrary/src/linear.jl b/lib/BVProblemLibrary/src/linear.jl index d85962f..9ebe53f 100644 --- a/lib/BVProblemLibrary/src/linear.jl +++ b/lib/BVProblemLibrary/src/linear.jl @@ -24,33 +24,33 @@ prob_bvp_linear_1_function = BVPFunction( analytic = prob_bvp_linear_1_analytic, bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_linear_1_tspan = (0.0, 1.0) -@doc raw""" +""" prob_bvp_linear_1 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\[2pt] -\frac{dy_2}{dt} &= \frac{1}{λ} y_1 -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\[2pt] +\\frac{dy_2}{dt} &= \\frac{1}{λ} y_1 +\\end{align*} ``` with boundary condition ```math -y_1(0)=1, \;\; y_1(1)=0 +y_1(0)=1, \\;\\; y_1(1)=0 ``` # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -\begin{align*} -y_1(t) &= \frac{\exp(-t/\sqrt{λ}) - \exp((t-2)/\sqrt{λ})}{1-\exp(-2/\sqrt{λ})} \\ +\\begin{align*} +y_1(t) &= \\frac{\\exp(-t/\\sqrt{λ}) - \\exp((t-2)/\\sqrt{λ})}{1-\\exp(-2/\\sqrt{λ})} \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -87,33 +87,33 @@ prob_bvp_linear_2_function = BVPFunction( analytic = prob_bvp_linear_2_analytic, bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_linear_2_tspan = (0.0, 1.0) -@doc raw""" +""" prob_bvp_linear_2 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} y_2 -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} y_2 +\\end{align*} ``` with boundary condition ```math -y_1(0)=1, \;\; y_1(1)=0 +y_1(0)=1, \\;\\; y_1(1)=0 ``` # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -\begin{align*} -y_1(t) &= \frac{1-\exp((t-1)/λ)}{1-\exp(-1/λ)} \\ +\\begin{align*} +y_1(t) &= \\frac{1-\\exp((t-1)/λ)}{1-\\exp(-1/λ)} \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -153,39 +153,39 @@ prob_bvp_linear_3_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_3_analytic, twopoint = Val(true) ) prob_bvp_linear_3_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_3 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(t, y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(t, y_1, y_2) +\\end{align*} ``` where ```math -f(t, y_1, y_2) = -[2+\cos(πt)]y_2 + y_1 -(1+λπ^2)\cos(πt) - [2+\cos(πt)]π\sin(πt) +f(t, y_1, y_2) = -[2+\\cos(πt)]y_2 + y_1 -(1+λπ^2)\\cos(πt) - [2+\\cos(πt)]π\\sin(πt) ``` with boundary condition ```math -y_1(-1)=-1,\;\; y_1(1)=-1 +y_1(-1)=-1,\\;\\; y_1(1)=-1 ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \cos(πt) \\ +\\begin{align*} +y_1(t) &= \\cos(πt) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -222,16 +222,16 @@ prob_bvp_linear_4_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_4_analytic, twopoint = Val(true) ) prob_bvp_linear_4_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_4 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(y_1, y_2) +\\end{align*} ``` where @@ -243,21 +243,21 @@ f(y_1, y_2) = -y_2 + (1+λ) y_1 with boundary condition ```math -\begin{align*} -y_1(-1) &= 1 + \exp(-2), \\ -y_1(1) &= 1 + \exp(-2(1+λ)) -\end{align*} +\\begin{align*} +y_1(-1) &= 1 + \\exp(-2), \\\\ +y_1(1) &= 1 + \\exp(-2(1+λ)) +\\end{align*} ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \exp(t-1) + \exp(-(1+λ)(1+t)/λ) \\ +\\begin{align*} +y_1(t) &= \\exp(t-1) + \\exp(-(1+λ)(1+t)/λ) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -296,39 +296,39 @@ prob_bvp_linear_5_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_5_analytic, twopoint = Val(true) ) prob_bvp_linear_5_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_5 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(t, y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(t, y_1, y_2) +\\end{align*} ``` where ```math -f(t, y_1, y_2) = ty_2 + y_1 - (1+λπ^2)\cos(πt) + πt\sin(πt) +f(t, y_1, y_2) = ty_2 + y_1 - (1+λπ^2)\\cos(πt) + πt\\sin(πt) ``` with boundary condition ```math -y_1(-1)=-1, \;\; y_1(1)=-1 +y_1(-1)=-1, \\;\\; y_1(1)=-1 ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \cos(πt) \\ +\\begin{align*} +y_1(t) &= \\cos(πt) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -366,39 +366,39 @@ prob_bvp_linear_6_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_6_analytic, twopoint = Val(true) ) prob_bvp_linear_6_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_6 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(t, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(t, y_2) +\\end{align*} ``` where ```math -f(t, y_2) = ty_2 - λπ^2\cos(πt)-πt\sin(πt) +f(t, y_2) = ty_2 - λπ^2\\cos(πt)-πt\\sin(πt) ``` with boundary condition ```math -y_1(-1)=-2, \;\; y_1(1)=0 +y_1(-1)=-2, \\;\\; y_1(1)=0 ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \cos(πt) + \operatorname{erf}(t/\sqrt{2λ})/\operatorname{erf}(1/\sqrt{2λ}) \\ +\\begin{align*} +y_1(t) &= \\cos(πt) + \\operatorname{erf}(t/\\sqrt{2λ})/\\operatorname{erf}(1/\\sqrt{2λ}) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -444,39 +444,39 @@ prob_bvp_linear_7_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_7_analytic, twopoint = Val(true) ) prob_bvp_linear_7_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_7 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(t, y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(t, y_1, y_2) +\\end{align*} ``` where ```math -f(t, y_1, y_2) = t y_2 + y_1 - (1+λπ^2)\cos(πt) + π t\sin(πt) +f(t, y_1, y_2) = t y_2 + y_1 - (1+λπ^2)\\cos(πt) + π t\\sin(πt) ``` with boundary condition ```math -y_1(-1)=-1, \;\; y_1(1)=1 +y_1(-1)=-1, \\;\\; y_1(1)=1 ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \cos(πt) + t + \frac{t\operatorname{erf}(t/\sqrt{2λ}) + \sqrt{2λ/π}\exp(-t^2/2λ)}{\operatorname{erf}(t/\sqrt{2λ}) + \sqrt{2λ/π}\exp(-1/2λ)} \\ +\\begin{align*} +y_1(t) &= \\cos(πt) + t + \\frac{t\\operatorname{erf}(t/\\sqrt{2λ}) + \\sqrt{2λ/π}\\exp(-t^2/2λ)}{\\operatorname{erf}(t/\\sqrt{2λ}) + \\sqrt{2λ/π}\\exp(-1/2λ)} \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -513,33 +513,33 @@ prob_bvp_linear_8_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_8_analytic, twopoint = Val(true) ) prob_bvp_linear_8_tspan = (0.0, 1.0) -@doc raw""" +""" prob_bvp_linear_8 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= -\frac{1}{λ} y_2 -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= -\\frac{1}{λ} y_2 +\\end{align*} ``` with boundary condition ```math -y_1(0)=1, \;\; y_1(1)=2 +y_1(0)=1, \\;\\; y_1(1)=2 ``` # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -\begin{align*} -y_1(t) &= \frac{2 - \exp(-1/λ) - \exp(-t/λ)}{1 - \exp(-1/λ)} \\ +\\begin{align*} +y_1(t) &= \\frac{2 - \\exp(-1/λ) - \\exp(-t/λ)}{1 - \\exp(-1/λ)} \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -576,16 +576,16 @@ prob_bvp_linear_9_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_9_analytic, twopoint = Val(true) ) prob_bvp_linear_9_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_9 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ+t^2} f(t, y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ+t^2} f(t, y_1, y_2) +\\end{align*} ``` where @@ -602,13 +602,13 @@ y_1(-1)=1/(1+λ), y_1(1)=1/(1+λ) # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \frac{1}{λ + t^2} \\ +\\begin{align*} +y_1(t) &= \\frac{1}{λ + t^2} \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -646,33 +646,33 @@ prob_bvp_linear_10_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_10_analytic, twopoint = Val(true) ) prob_bvp_linear_10_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_10 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= - \frac{1}{λ} t y_2 -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= - \\frac{1}{λ} t y_2 +\\end{align*} ``` with boundary condition ```math -y_1(-1)=0, \;\; y_1(1)=2 +y_1(-1)=0, \\;\\; y_1(1)=2 ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= 1 + \operatorname{erf}(t/\sqrt{2λ})/\operatorname{erf}(1/\sqrt{2λ}) \\ +\\begin{align*} +y_1(t) &= 1 + \\operatorname{erf}(t/\\sqrt{2λ})/\\operatorname{erf}(1/\\sqrt{2λ}) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -709,39 +709,39 @@ prob_bvp_linear_11_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_11_analytic, twopoint = Val(true) ) prob_bvp_linear_11_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_11 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ}f(t, y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ}f(t, y_1) +\\end{align*} ``` where ```math -f(t, y_1) = y_1 - (1+λπ^2)\cos(πt) +f(t, y_1) = y_1 - (1+λπ^2)\\cos(πt) ``` with boundary condition ```math -y_1(-1)=0, \;\; y_1(1)=2 +y_1(-1)=0, \\;\\; y_1(1)=2 ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \cos(πt) \\ +\\begin{align*} +y_1(t) &= \\cos(πt) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -780,22 +780,22 @@ prob_bvp_linear_12_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_12_analytic, twopoint = Val(true) ) prob_bvp_linear_12_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_12 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(t, y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(t, y_1) +\\end{align*} ``` where ```math -f(t, y_1) = y_1 - (1+λπ^2)\cos(πt) +f(t, y_1) = y_1 - (1+λπ^2)\\cos(πt) ``` with boundary condition @@ -806,13 +806,13 @@ y_1(-1)=-1, y_1(1)=0 # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \cos(πt) + \frac{\exp((t+1)/\sqrt{λ}) - \exp(-(t+1))/\sqrt{λ}}{\exp(2/\sqrt{λ}) - \exp(-2/\sqrt{λ})} \\ +\\begin{align*} +y_1(t) &= \\cos(πt) + \\frac{\\exp((t+1)/\\sqrt{λ}) - \\exp(-(t+1))/\\sqrt{λ}}{\\exp(2/\\sqrt{λ}) - \\exp(-2/\\sqrt{λ})} \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -850,39 +850,39 @@ prob_bvp_linear_13_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_13_analytic, twopoint = Val(true) ) prob_bvp_linear_13_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_13 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(t, y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(t, y_1) +\\end{align*} ``` where ```math -f(t, y_1) = y_1 - (1+λπ^2)\cos(πt) +f(t, y_1) = y_1 - (1+λπ^2)\\cos(πt) ``` with boundary condition ```math -y_1(-1)=0, \;\; y_1(1)=-1 +y_1(-1)=0, \\;\\; y_1(1)=-1 ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \cos(πt) + \exp(-(t+1)/\sqrt{λ}) \\ +\\begin{align*} +y_1(t) &= \\cos(πt) + \\exp(-(t+1)/\\sqrt{λ}) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -920,40 +920,40 @@ prob_bvp_linear_14_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_14_analytic, twopoint = Val(true) ) prob_bvp_linear_14_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_14 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 -\frac{dy_2}{dt} &= \frac{1}{λ} f(t, y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(t, y_1) +\\end{align*} ``` where ```math -f(t, y_1)=y_1-(1+λπ^2)\cos(πt) +f(t, y_1)=y_1-(1+λπ^2)\\cos(πt) ``` with boundary condition ```math -y_1(-1) = \exp(-2/\sqrt{λ}), \;\; -y_1(1) = \exp(-2/\sqrt{λ}) +y_1(-1) = \\exp(-2/\\sqrt{λ}), \\;\\; +y_1(1) = \\exp(-2/\\sqrt{λ}) ``` # Solution -The analytical solution for ``t \in [-1, 1]`` is +The analytical solution for ``t \\in [-1, 1]`` is ```math -\begin{align*} -y_1(t) &= \cos(πt) + \exp((t-1)/\sqrt{λ}) + \exp(-(t+1)/\sqrt{λ}) \\ +\\begin{align*} +y_1(t) &= \\cos(πt) + \\exp((t-1)/\\sqrt{λ}) + \\exp(-(t+1)/\\sqrt{λ}) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -985,22 +985,22 @@ prob_bvp_linear_15_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_linear_15_tspan = (-1.0, 1.0) -@doc raw""" +""" prob_bvp_linear_15 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} t y_1 -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} t y_1 +\\end{align*} ``` with boundary condition ```math -y_1(-1)=1, \;\; y_1(1)=1 +y_1(-1)=1, \\;\\; y_1(1)=1 ``` # Solution @@ -1041,16 +1041,16 @@ prob_bvp_linear_16_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_16_analytic, twopoint = Val(true) ) prob_bvp_linear_16_tspan = (0.0, 1.0) -@doc raw""" +""" prob_bvp_linear_16 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ^2} f(y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ^2} f(y_1) +\\end{align*} ``` where @@ -1062,18 +1062,18 @@ f(t, y_1) = -π^2 y_1/4 with boundary condition ```math -y_1(0)=0, \;\; y_1(1)=\sin(π/(2λ)) +y_1(0)=0, \\;\\; y_1(1)=\\sin(π/(2λ)) ``` # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -\begin{align*} -y_1(t) &= \sin(πt/2λ) \text{ when } 1/λ \text{ is odd } \\ +\\begin{align*} +y_1(t) &= \\sin(πt/2λ) \\text{ when } 1/λ \\text{ is odd } \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -1109,16 +1109,16 @@ prob_bvp_linear_17_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_17_analytic, twopoint = Val(true) ) prob_bvp_linear_17_tspan = (-0.1, 0.1) -@doc raw""" +""" prob_bvp_linear_17 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= f(y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= f(y_1) +\\end{align*} ``` where @@ -1130,19 +1130,19 @@ f(t, y_1) = -3λ y_1 / (λ+t^2)^2 with boundary condition ```math -y_1(-0.1) = \frac{-0.1}{\sqrt{λ+0.01}}, -y_1(0.1) = \frac{ 0.1}{\sqrt{λ+0.01}} +y_1(-0.1) = \\frac{-0.1}{\\sqrt{λ+0.01}}, +y_1(0.1) = \\frac{ 0.1}{\\sqrt{λ+0.01}} ``` # Solution -The analytical solution for ``t \in [-0.1, 0.1]`` is +The analytical solution for ``t \\in [-0.1, 0.1]`` is ```math -\begin{align*} -y_1(t) &= t/\sqrt{λ+t^2} \\ +\\begin{align*} +y_1(t) &= t/\\sqrt{λ+t^2} \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -1179,33 +1179,33 @@ prob_bvp_linear_18_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_linear_18_analytic, twopoint = Val(true) ) prob_bvp_linear_18_tspan = (0, 1) -@doc raw""" +""" prob_bvp_linear_18 Linear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= -\frac{1}{λ} y_2 -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= -\\frac{1}{λ} y_2 +\\end{align*} ``` with boundary condition ```math -y_1(0)=1, \;\; y_1(1)=\frac{0.1}{\sqrt{λ+0.01}} +y_1(0)=1, \\;\\; y_1(1)=\\frac{0.1}{\\sqrt{λ+0.01}} ``` # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -\begin{align*} -y_1(t) &= \exp(-t/λ) \\ +\\begin{align*} +y_1(t) &= \\exp(-t/λ) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References diff --git a/lib/BVProblemLibrary/src/nonlinear.jl b/lib/BVProblemLibrary/src/nonlinear.jl index a6601be..1491112 100644 --- a/lib/BVProblemLibrary/src/nonlinear.jl +++ b/lib/BVProblemLibrary/src/nonlinear.jl @@ -18,16 +18,16 @@ prob_bvp_nonlinear_1_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_1_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_1 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= -\frac{1}{λ} y_2 -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= -\\frac{1}{λ} y_2 +\\end{align*} ``` where @@ -39,18 +39,18 @@ f(y_2)=-y_1 with boundary condition ```math -y_1(0)=1, y_1(1)=0.1/\sqrt{λ+0.01} +y_1(0)=1, y_1(1)=0.1/\\sqrt{λ+0.01} ``` # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -\begin{align*} -y_1(t) &= \exp(-t/λ) \\ +\\begin{align*} +y_1(t) &= \\exp(-t/λ) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -87,16 +87,16 @@ prob_bvp_nonlinear_2_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_nonlinear_2_analytic, twopoint = Val(true) ) prob_bvp_nonlinear_2_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_2 Nonlinear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= -\frac{1}{λ} f(y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= -\\frac{1}{λ} f(y_2) +\\end{align*} ``` where @@ -108,21 +108,21 @@ f(y_2)=--y_2^2+1 with boundary condition ```math -\begin{align*} -y_1(0) &= 1 + λ \ln\cosh(-0.745/λ), \\ -y_1(1) &= 1 + λ \ln\cosh(0.255/λ) -\end{align*} +\\begin{align*} +y_1(0) &= 1 + λ \\ln\\cosh(-0.745/λ), \\\\ +y_1(1) &= 1 + λ \\ln\\cosh(0.255/λ) +\\end{align*} ``` # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -\begin{align*} -y_1(t) &= 1 + λ \ln\cosh((t-0.745)/λ) \\ +\\begin{align*} +y_1(t) &= 1 + λ \\ln\\cosh((t-0.745)/λ) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -160,39 +160,39 @@ prob_bvp_nonlinear_3_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), analytic = prob_bvp_nonlinear_3_analytic, twopoint = Val(true) ) prob_bvp_nonlinear_3_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_3 Nonlinear boundary value problem with analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= -\frac{1}{λ} f(y, y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= -\\frac{1}{λ} f(y, y_1) +\\end{align*} ``` where ```math -f(y_1) = y_1 + y_1^2 - \exp(-2t/\sqrt{λ}) +f(y_1) = y_1 + y_1^2 - \\exp(-2t/\\sqrt{λ}) ``` with boundary condition ```math -y_1(0)=1, y_1(1)=\exp(-1/\sqrt{λ}) +y_1(0)=1, y_1(1)=\\exp(-1/\\sqrt{λ}) ``` # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -\begin{align*} -y_1(t) &= \exp(-t/\sqrt{λ}) \\ +\\begin{align*} +y_1(t) &= \\exp(-t/\\sqrt{λ}) \\\\ y_2(t) &= y_1'(t) -\end{align*} +\\end{align*} ``` # References @@ -224,16 +224,16 @@ prob_bvp_nonlinear_4_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_4_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_4 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= -\frac{1}{λ} f(y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= -\\frac{1}{λ} f(y_1, y_2) +\\end{align*} ``` where @@ -281,22 +281,22 @@ prob_bvp_nonlinear_5_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_5_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_5 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= -\frac{1}{λ} f(y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= -\\frac{1}{λ} f(y_1) +\\end{align*} ``` where ```math -f(y_1) = λ\sinh(λz) +f(y_1) = λ\\sinh(λz) ``` with boundary condition @@ -342,7 +342,7 @@ prob_bvp_nonlinear_6_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_6_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_6 This problem describes a shock wave in a one dimension nozzle flow. @@ -350,22 +350,22 @@ This problem describes a shock wave in a one dimension nozzle flow. The steady state Navier-Stokes equations generate a second order differential equations which can be reduced to a first order system described by nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= -\frac{1}{λ} f(y_1) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= -\\frac{1}{λ} f(y_1) +\\end{align*} ``` where ```math -f(t, y_1, y_2) = \left(\frac{1+γ}{2} - λ A'(t)\right) y_1 y_2 - \frac{y_2}{y_1} - \frac{A'(t)}{A(t)} \left(1 - \frac{γ-1}{2} y_1^2\right) +f(t, y_1, y_2) = \\left(\\frac{1+γ}{2} - λ A'(t)\\right) y_1 y_2 - \\frac{y_2}{y_1} - \\frac{A'(t)}{A(t)} \\left(1 - \\frac{γ-1}{2} y_1^2\\right) ``` with boundary condition ```math -y_1(0)=0.9129, \;\; y_1(1)=0.375 +y_1(0)=0.9129, \\;\\; y_1(1)=0.375 ``` # Solution @@ -401,16 +401,16 @@ prob_bvp_nonlinear_7_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_7_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_7 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(y_1, y_2) +\\end{align*} ``` where @@ -422,7 +422,7 @@ f(y_1, y_2) = -y_1 y_2 + y_1 with boundary condition ```math -y_1(0)=-1/3, \;\; y_1(1)=1/3 +y_1(0)=-1/3, \\;\\; y_1(1)=1/3 ``` # Solution @@ -458,16 +458,16 @@ prob_bvp_nonlinear_8_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_8_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_8 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(y_1, y_2) +\\end{align*} ``` where @@ -479,7 +479,7 @@ f(y_1, y_2)=-y_1y_2+y_1 with boundary condition ```math -y_1(0)=1, \;\; y_1(1)=-1/3 +y_1(0)=1, \\;\\; y_1(1)=-1/3 ``` # Solution @@ -515,16 +515,16 @@ prob_bvp_nonlinear_9_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_9_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_9 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) \\ -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(y_1, y_2) \\\\ +\\end{align*} ``` where @@ -572,16 +572,16 @@ prob_bvp_nonlinear_10_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_10_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_10 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(y_1, y_2) +\\end{align*} ``` where @@ -593,7 +593,7 @@ f(y_1, y_2)=-y_1y_2+y_1 with boundary condition ```math -y_1(0)=1, \;\; y_1(1)=3/2 +y_1(0)=1, \\;\\; y_1(1)=3/2 ``` # Solution @@ -629,16 +629,16 @@ prob_bvp_nonlinear_11_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_11_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_11 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(y_1, y_2) +\\end{align*} ``` where @@ -650,7 +650,7 @@ f(y_1, y_2)=-y_1y_2+y_1 with boundary condition ```math -y_1(0)=0, \;\; y_1(1)=3/2 +y_1(0)=0, \\;\\; y_1(1)=3/2 ``` # Solution @@ -686,16 +686,16 @@ prob_bvp_nonlinear_12_function = BVPFunction( bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true) ) prob_bvp_nonlinear_12_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_12 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= \\frac{1}{λ} f(y_1, y_2) +\\end{align*} ``` where @@ -707,7 +707,7 @@ f(y_1, y_2) = -y_1 y_2 + y_1 with boundary condition ```math -y_1(0)=-7/6, \;\; y_1(1)=3/2 +y_1(0)=-7/6, \\;\\; y_1(1)=3/2 ``` # Solution @@ -749,31 +749,31 @@ prob_bvp_nonlinear_13_function = BVPFunction( bcresid_prototype = (zeros(2), zeros(2)), twopoint = Val(true) ) prob_bvp_nonlinear_13_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_13 Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= \sin(y_2) \\ -\frac{dy_2}{dt} &= y_3 \\ -\frac{dy_3}{dt} &= -y_4/λ \\ -\frac{dy_4}{dt} &= f(y_1, y_2, y_3, y_4) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= \\sin(y_2) \\\\ +\\frac{dy_2}{dt} &= y_3 \\\\ +\\frac{dy_3}{dt} &= -y_4/λ \\\\ +\\frac{dy_4}{dt} &= f(y_1, y_2, y_3, y_4) +\\end{align*} ``` where ```math -f(z, θ, M, Q) = \frac{1}{λ} [(z-1) \cos θ - M \sec θ] + λ Q \tan θ +f(z, θ, M, Q) = \\frac{1}{λ} [(z-1) \\cos θ - M \\sec θ] + λ Q \\tan θ ``` with boundary condition ```math -y_1(0)=0, \;\; y_3(0)=0, \;\; -y_1(1)=0, \;\; y_3(1)=0 +y_1(0)=0, \\;\\; y_3(0)=0, \\;\\; +y_1(1)=0, \\;\\; y_3(1)=0 ``` # Solution @@ -813,7 +813,7 @@ prob_bvp_nonlinear_14_function = BVPFunction( bcresid_prototype = (zeros(2), zeros(2)), twopoint = Val(true) ) prob_bvp_nonlinear_14_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_14 This problem arises from fluid injection through one side of a long vertical channel @@ -821,19 +821,19 @@ This problem arises from fluid injection through one side of a long vertical cha Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2 \\ -\frac{dy_2}{dt} &= y_3 \\ -\frac{dy_3}{dt} &= y_4 \\ -\frac{dy_4}{dt} &= λ(y_2 y_3 - y_1 y_4) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2 \\\\ +\\frac{dy_2}{dt} &= y_3 \\\\ +\\frac{dy_3}{dt} &= y_4 \\\\ +\\frac{dy_4}{dt} &= λ(y_2 y_3 - y_1 y_4) +\\end{align*} ``` with boundary condition ```math -y_1(0)=0, \;\; y_2(0)=0, \;\; -y_1(1)=1, \;\; y_2(1)=0 +y_1(0)=0, \\;\\; y_2(0)=0, \\;\\; +y_1(1)=1, \\;\\; y_2(1)=0 ``` # Solution @@ -876,7 +876,7 @@ prob_bvp_nonlinear_15_function = BVPFunction( bcresid_prototype = (zeros(3), zeros(3)), twopoint = Val(true) ) prob_bvp_nonlinear_15_tspan = (0, 1) -@doc raw""" +""" prob_bvp_nonlinear_15 This problem arises from fluid injection through one side of a long vertical channel @@ -884,23 +884,23 @@ This problem arises from fluid injection through one side of a long vertical cha Nonlinear boundary value problem with no analytical solution, given by ```math -\begin{align*} -\frac{dy_1}{dt} &= y_2, & -\frac{dy_2}{dt} &= \frac{1}{λ}y_1y_4 - y_3y_2, \\ -\frac{dy_3}{dt} &= y_4, & -\frac{dy_4}{dt} &= y_5, \\ -\frac{dy_5}{dt} &= y_6, & -\frac{dy_6}{dt} &= \frac{1}{λ}(-y_3y_6-y_1y_2) -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= y_2, & +\\frac{dy_2}{dt} &= \\frac{1}{λ}y_1y_4 - y_3y_2, \\\\ +\\frac{dy_3}{dt} &= y_4, & +\\frac{dy_4}{dt} &= y_5, \\\\ +\\frac{dy_5}{dt} &= y_6, & +\\frac{dy_6}{dt} &= \\frac{1}{λ}(-y_3y_6-y_1y_2) +\\end{align*} ``` with boundary condition ```math -\begin{align*} -y_1(0)&=-1, & y_3(0)&=0, & y_4(0)&=0, \\ +\\begin{align*} +y_1(0)&=-1, & y_3(0)&=0, & y_4(0)&=0, \\\\ y_1(1)&= 1, & y_3(1)&=0, & y_4(1)&=0. -\end{align*} +\\end{align*} ``` # Solution diff --git a/lib/BVProblemLibrary/test/qa/Project.toml b/lib/BVProblemLibrary/test/qa/Project.toml index 57850c3..8b0339a 100644 --- a/lib/BVProblemLibrary/test/qa/Project.toml +++ b/lib/BVProblemLibrary/test/qa/Project.toml @@ -7,6 +7,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Aqua = "0.8" BVProblemLibrary = "0.1" -SciMLTesting = "2.1" +SciMLTesting = "2.4" Test = "1.10" julia = "1.10" diff --git a/lib/BVProblemLibrary/test/qa/qa.jl b/lib/BVProblemLibrary/test/qa/qa.jl index d0cdafb..c22853c 100644 --- a/lib/BVProblemLibrary/test/qa/qa.jl +++ b/lib/BVProblemLibrary/test/qa/qa.jl @@ -1,3 +1,3 @@ using SciMLTesting, BVProblemLibrary, Test -run_qa(BVProblemLibrary; explicit_imports = true, aqua_kwargs = (; ambiguities = false)) +run_qa(BVProblemLibrary) diff --git a/lib/BVProblemLibrary/test/runtests.jl b/lib/BVProblemLibrary/test/runtests.jl index 5e1bfdf..033aa34 100644 --- a/lib/BVProblemLibrary/test/runtests.jl +++ b/lib/BVProblemLibrary/test/runtests.jl @@ -18,7 +18,6 @@ if TEST_GROUP == "Core" || TEST_GROUP == "All" end # Quality assurance: no undefined exports, stale dependencies, etc. -# Ambiguity checks are disabled since tests fail due to ambiguities in dependencies. if TEST_GROUP == "QA" || TEST_GROUP == "All" activate_qa_env() @time @safetestset "Aqua" include("qa/qa.jl") diff --git a/lib/DAEProblemLibrary/Project.toml b/lib/DAEProblemLibrary/Project.toml index 7a23aee..6c9d3cc 100644 --- a/lib/DAEProblemLibrary/Project.toml +++ b/lib/DAEProblemLibrary/Project.toml @@ -4,11 +4,9 @@ version = "0.1.5" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" [compat] DiffEqBase = "6, 7" -Markdown = "1.10" Pkg = "1.10" SafeTestsets = "0.1" Test = "1.10" diff --git a/lib/DAEProblemLibrary/docs/Project.toml b/lib/DAEProblemLibrary/docs/Project.toml new file mode 100644 index 0000000..f026424 --- /dev/null +++ b/lib/DAEProblemLibrary/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +DAEProblemLibrary = "dfb8ca35-80a1-48ba-a605-84916a45b4f8" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" + +[compat] +DAEProblemLibrary = "0.1" +Documenter = "1" +julia = "1.10" diff --git a/lib/DAEProblemLibrary/docs/make.jl b/lib/DAEProblemLibrary/docs/make.jl new file mode 100644 index 0000000..4979bc8 --- /dev/null +++ b/lib/DAEProblemLibrary/docs/make.jl @@ -0,0 +1,5 @@ +using DAEProblemLibrary, Documenter + +makedocs( + ; sitename = "DAEProblemLibrary.jl", modules = [DAEProblemLibrary], checkdocs = :exports +) diff --git a/lib/DAEProblemLibrary/docs/src/index.md b/lib/DAEProblemLibrary/docs/src/index.md new file mode 100644 index 0000000..39cccfa --- /dev/null +++ b/lib/DAEProblemLibrary/docs/src/index.md @@ -0,0 +1,11 @@ +# DAEProblemLibrary.jl + +Premade differential-algebraic equation problems for testing and benchmarking DAE solvers. + +## Public API + +```@autodocs +Modules = [DAEProblemLibrary] +Public = true +Private = false +``` diff --git a/lib/DAEProblemLibrary/src/DAEProblemLibrary.jl b/lib/DAEProblemLibrary/src/DAEProblemLibrary.jl index 5d6644b..e51faf3 100644 --- a/lib/DAEProblemLibrary/src/DAEProblemLibrary.jl +++ b/lib/DAEProblemLibrary/src/DAEProblemLibrary.jl @@ -1,7 +1,6 @@ module DAEProblemLibrary using DiffEqBase: DiffEqBase, DAEProblem -using Markdown: Markdown, @doc_str #DAE Example Problems export prob_dae_resrob, prob_dae_transamp @@ -17,15 +16,15 @@ end u0 = [1.0, 0, 0] du0 = [-0.04, 0.04, 0.0] -@doc doc""" +""" The Robertson biochemical reactions in DAE form ```math -\begin{align*} -\frac{dy₁}{dt} &= -k₁y₁+k₃y₂y₃ \\ -\frac{dy₂}{dt} &= k₁y₁-k₂y₂^2-k₃y₂y₃ \\ +\\begin{align*} +\\frac{dy₁}{dt} &= -k₁y₁+k₃y₂y₃ \\\\ +\\frac{dy₂}{dt} &= k₁y₁-k₂y₂^2-k₃y₂y₃ \\\\ 1 &= y₁ + y₂ + y₃ -\end{align*} +\\end{align*} ``` where ``k₁=0.04``, ``k₂=3×10^7``, ``k₃=10^4``. For details, see: Hairer Norsett Wanner Solving Ordinary Differential Equations I - Nonstiff Problems Page 129 @@ -67,37 +66,37 @@ du0 = [ -10.00564453, ] -@doc doc""" +""" The Transistor Amplifier model ```math -M\frac{dy}{dt} = f(t,y), \quad y(0)=y_0,\quad y'(0)=y_0' +M\\frac{dy}{dt} = f(t,y), \\quad y(0)=y_0,\\quad y'(0)=y_0' ``` ```math -M = \begin{pmatrix} --C_1 & C_1 & 0 & 0 & 0 & 0 & 0 & 0 \\ - C_1 & -C_1 & 0 & 0 & 0 & 0 & 0 & 0 \\ - 0 & 0 & -C_2 & 0 & 0 & 0 & 0 & 0 \\ - 0 & 0 & 0 & -C_3 & C_3 & 0 & 0 & 0 \\ - 0 & 0 & 0 & C_3 & -C_3 & 0 & 0 & 0 \\ - 0 & 0 & 0 & 0 & 0 & -C_4 & 0 & 0 \\ - 0 & 0 & 0 & 0 & 0 & 0 & -C_5 & C_5 \\ +M = \\begin{pmatrix} +-C_1 & C_1 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ + C_1 & -C_1 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ + 0 & 0 & -C_2 & 0 & 0 & 0 & 0 & 0 \\\\ + 0 & 0 & 0 & -C_3 & C_3 & 0 & 0 & 0 \\\\ + 0 & 0 & 0 & C_3 & -C_3 & 0 & 0 & 0 \\\\ + 0 & 0 & 0 & 0 & 0 & -C_4 & 0 & 0 \\\\ + 0 & 0 & 0 & 0 & 0 & 0 & -C_5 & C_5 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & C_5 & -C_5 -\end{pmatrix} +\\end{pmatrix} ``` ```math -f(t, y)=\begin{pmatrix} --\frac{U_e(t)}{R_0} + \frac{y_1}{R_0} \\ --\frac{U_b}{R_2} + y_2\left(\frac{1}{R_1}+\frac{1}{R_2}\right) - (α-1) g\left(y_2-y_3\right) \\ --g\left(y_2-y_3\right) + \frac{y_3}{R_3} \\ --\frac{U_b}{R_4} + \frac{y_4}{R_4} + α g\left(y_2-y_3\right) \\ --\frac{U_b}{R_6} + y_5\left(\frac{1}{R_5}+\frac{1}{R_6}\right) - (α-1) g\left(y_5-y_6\right) \\ --g\left(y_5-y_6\right) + \frac{y_6}{R_7} \\ --\frac{U_b}{R_8} + \frac{y_7}{R_8} + α g\left(y_5-y_6\right) \\ -\frac{y_8}{R_9} -\end{pmatrix} +f(t, y)=\\begin{pmatrix} +-\\frac{U_e(t)}{R_0} + \\frac{y_1}{R_0} \\\\ +-\\frac{U_b}{R_2} + y_2\\left(\\frac{1}{R_1}+\\frac{1}{R_2}\\right) - (α-1) g\\left(y_2-y_3\\right) \\\\ +-g\\left(y_2-y_3\\right) + \\frac{y_3}{R_3} \\\\ +-\\frac{U_b}{R_4} + \\frac{y_4}{R_4} + α g\\left(y_2-y_3\\right) \\\\ +-\\frac{U_b}{R_6} + y_5\\left(\\frac{1}{R_5}+\\frac{1}{R_6}\\right) - (α-1) g\\left(y_5-y_6\\right) \\\\ +-g\\left(y_5-y_6\\right) + \\frac{y_6}{R_7} \\\\ +-\\frac{U_b}{R_8} + \\frac{y_7}{R_8} + α g\\left(y_5-y_6\\right) \\\\ +\\frac{y_8}{R_9} +\\end{pmatrix} ``` ## Reference diff --git a/lib/DAEProblemLibrary/test/qa/Project.toml b/lib/DAEProblemLibrary/test/qa/Project.toml index 6b14c3e..0d4d2e1 100644 --- a/lib/DAEProblemLibrary/test/qa/Project.toml +++ b/lib/DAEProblemLibrary/test/qa/Project.toml @@ -7,6 +7,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Aqua = "0.8" DAEProblemLibrary = "0.1" -SciMLTesting = "2.1" +SciMLTesting = "2.4" Test = "1.10" julia = "1.10" diff --git a/lib/DAEProblemLibrary/test/qa/qa.jl b/lib/DAEProblemLibrary/test/qa/qa.jl index 19f7b6c..64f0437 100644 --- a/lib/DAEProblemLibrary/test/qa/qa.jl +++ b/lib/DAEProblemLibrary/test/qa/qa.jl @@ -1,3 +1,3 @@ using SciMLTesting, DAEProblemLibrary, Test -run_qa(DAEProblemLibrary; explicit_imports = true, aqua_kwargs = (; ambiguities = false)) +run_qa(DAEProblemLibrary) diff --git a/lib/DAEProblemLibrary/test/runtests.jl b/lib/DAEProblemLibrary/test/runtests.jl index 7b1de8c..644f4ce 100644 --- a/lib/DAEProblemLibrary/test/runtests.jl +++ b/lib/DAEProblemLibrary/test/runtests.jl @@ -18,7 +18,6 @@ if TEST_GROUP == "Core" || TEST_GROUP == "All" end # Quality assurance: no undefined exports, stale dependencies, etc. -# Ambiguity checks are disabled since tests fail due to ambiguities in dependencies. if TEST_GROUP == "QA" || TEST_GROUP == "All" activate_qa_env() @time @safetestset "Aqua" include("qa/qa.jl") diff --git a/lib/DDEProblemLibrary/docs/Project.toml b/lib/DDEProblemLibrary/docs/Project.toml new file mode 100644 index 0000000..9443546 --- /dev/null +++ b/lib/DDEProblemLibrary/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +DDEProblemLibrary = "f42792ee-6ffc-4e2a-ae83-8ee2f22de800" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" + +[compat] +DDEProblemLibrary = "0.1" +Documenter = "1" +julia = "1.10" diff --git a/lib/DDEProblemLibrary/docs/make.jl b/lib/DDEProblemLibrary/docs/make.jl new file mode 100644 index 0000000..6424155 --- /dev/null +++ b/lib/DDEProblemLibrary/docs/make.jl @@ -0,0 +1,5 @@ +using DDEProblemLibrary, Documenter + +makedocs( + ; sitename = "DDEProblemLibrary.jl", modules = [DDEProblemLibrary], checkdocs = :exports +) diff --git a/lib/DDEProblemLibrary/docs/src/index.md b/lib/DDEProblemLibrary/docs/src/index.md new file mode 100644 index 0000000..2da6df0 --- /dev/null +++ b/lib/DDEProblemLibrary/docs/src/index.md @@ -0,0 +1,11 @@ +# DDEProblemLibrary.jl + +Premade delay differential equation problems for testing and benchmarking DDE solvers. + +## Public API + +```@autodocs +Modules = [DDEProblemLibrary] +Public = true +Private = false +``` diff --git a/lib/DDEProblemLibrary/src/constant_delays.jl b/lib/DDEProblemLibrary/src/constant_delays.jl index 65a720e..ed54ca9 100644 --- a/lib/DDEProblemLibrary/src/constant_delays.jl +++ b/lib/DDEProblemLibrary/src/constant_delays.jl @@ -48,24 +48,6 @@ end ### In-place function -@doc raw""" - prob_dde_constant_1delay_ip - -Delay differential equation - -```math -u'(t) = -u(t - 1) -``` - -for ``t \in [0, 1]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and ``ϕ(0) = 1``. - -# Solution - -The analytical solution for ``t \in [0, 10]`` can be obtained by the method of steps and -is provided in this implementation. -""" -prob_dde_constant_1delay_ip - function f_dde_constant_1delay_ip!(du, u, h, p, t) e = oneunit(t) du[1] = -h(p, t - e; idxs = 1) / e @@ -122,6 +104,22 @@ function fanalytic_dde_constant_1delay( end end +""" + prob_dde_constant_1delay_ip + +Delay differential equation + +```math +u'(t) = -u(t - 1) +``` + +for ``t \\in [0, 1]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and ``ϕ(0) = 1``. + +# Solution + +The analytical solution for ``t \\in [0, 10]`` can be obtained by the method of steps and +is provided in this implementation. +""" const prob_dde_constant_1delay_ip = DDEProblem( DDEFunction( f_dde_constant_1delay_ip!; @@ -134,19 +132,17 @@ const prob_dde_constant_1delay_ip = DDEProblem( ### Out-of-place function +function f_dde_constant_1delay_oop(u, h, p, t) + e = oneunit(t) + return h(p, t - e) ./ (-e) +end + """ prob_dde_constant_1delay_oop Same delay differential equation as [`prob_dde_constant_1delay_ip`](@ref), but purposefully implemented with an out-of-place function. """ -prob_dde_constant_1delay_oop - -function f_dde_constant_1delay_oop(u, h, p, t) - e = oneunit(t) - return h(p, t - e) ./ (-e) -end - const prob_dde_constant_1delay_oop = DDEProblem( DDEFunction( f_dde_constant_1delay_oop; @@ -159,19 +155,17 @@ const prob_dde_constant_1delay_oop = DDEProblem( ### Scalar function +function f_dde_constant_1delay_scalar(u, h, p, t) + e = oneunit(t) + return -h(p, t - e) / e +end + """ prob_dde_constant_1delay_scalar Same delay differential equation as [`prob_dde_constant_1delay_ip`](@ref), but purposefully implemented with a scalar function. """ -prob_dde_constant_1delay_scalar - -function f_dde_constant_1delay_scalar(u, h, p, t) - e = oneunit(t) - return -h(p, t - e) / e -end - const prob_dde_constant_1delay_scalar = DDEProblem( DDEFunction( f_dde_constant_1delay_scalar; @@ -186,7 +180,14 @@ const prob_dde_constant_1delay_scalar = DDEProblem( ### In-place function -@doc raw""" +function f_dde_constant_1delay_long_ip!(du, u, h, p, t) + T = typeof(t) + du[1] = (u[1] - h(p, t - T(1 / 5); idxs = 1)) / oneunit(t) + + return nothing +end + +""" prob_dde_constant_1delay_long_ip Delay differential equation @@ -195,18 +196,9 @@ Delay differential equation u'(t) = u(t) - u(t - 1/5) ``` -for ``t \in [0, 100]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and +for ``t \\in [0, 100]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and ``ϕ(0) = 1``. """ -prob_dde_constant_1delay_long_ip - -function f_dde_constant_1delay_long_ip!(du, u, h, p, t) - T = typeof(t) - du[1] = (u[1] - h(p, t - T(1 / 5); idxs = 1)) / oneunit(t) - - return nothing -end - const prob_dde_constant_1delay_long_ip = DDEProblem( f_dde_constant_1delay_long_ip!, [1.0], h_dde_constant_ip, (0.0, 100.0), @@ -216,19 +208,17 @@ const prob_dde_constant_1delay_long_ip = DDEProblem( ### Out-of-place function +function f_dde_constant_1delay_long_oop(u, h, p, t) + T = typeof(t) + return (u .- h(p, t - T(1 / 5))) ./ oneunit(t) +end + """ prob_dde_constant_1delay_long_oop Same delay differential equation as [`prob_dde_constant_1delay_long_ip`](@ref), but purposefully implemented with an out-of-place function. """ -prob_dde_constant_1delay_long_oop - -function f_dde_constant_1delay_long_oop(u, h, p, t) - T = typeof(t) - return (u .- h(p, t - T(1 / 5))) ./ oneunit(t) -end - const prob_dde_constant_1delay_long_oop = DDEProblem( f_dde_constant_1delay_long_oop, [1.0], h_dde_constant_oop, (0.0, 100.0), @@ -238,19 +228,17 @@ const prob_dde_constant_1delay_long_oop = DDEProblem( ### Scalar function +function f_dde_constant_1delay_long_scalar(u, h, p, t) + T = typeof(t) + return (u - h(p, t - T(1 / 5))) / oneunit(t) +end + """ prob_dde_constant_1delay_long_scalar Same delay differential equation as [`prob_dde_constant_1delay_long_ip`](@ref), but purposefully implemented with a scalar function. """ -prob_dde_constant_1delay_long_scalar - -function f_dde_constant_1delay_long_scalar(u, h, p, t) - T = typeof(t) - return (u - h(p, t - T(1 / 5))) / oneunit(t) -end - const prob_dde_constant_1delay_long_scalar = DDEProblem( f_dde_constant_1delay_long_scalar, 1.0, h_dde_constant_scalar, @@ -265,24 +253,6 @@ const prob_dde_constant_1delay_long_scalar = DDEProblem( ### In-place function -@doc raw""" - prob_dde_constant_2delays_ip - -Delay differential equation - -```math -u'(t) = -u(t - 1/3) - u(t - 1/5) -``` - -for ``t \in [0, 1]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and ``ϕ(0) = 1``. - -# Solution - -The analytical solution for ``t \in [0, 10]`` can be obtained by the method of steps and -is provided in this implementation. -""" -prob_dde_constant_2delays_ip - function f_dde_constant_2delays_ip!(du, u, h, p, t) T = typeof(t) du[1] = -(h(p, t - T(1 / 3); idxs = 1) + h(p, t - T(1 / 5); idxs = 1)) / oneunit(t) @@ -331,6 +301,22 @@ function fanalytic_dde_constant_2delays( end end +""" + prob_dde_constant_2delays_ip + +Delay differential equation + +```math +u'(t) = -u(t - 1/3) - u(t - 1/5) +``` + +for ``t \\in [0, 1]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and ``ϕ(0) = 1``. + +# Solution + +The analytical solution for ``t \\in [0, 10]`` can be obtained by the method of steps and +is provided in this implementation. +""" const prob_dde_constant_2delays_ip = DDEProblem( DDEFunction( f_dde_constant_2delays_ip!; @@ -343,19 +329,17 @@ const prob_dde_constant_2delays_ip = DDEProblem( ### Out-of-place function +function f_dde_constant_2delays_oop(u, h, p, t) + T = typeof(t) + return (h(p, t - T(1 / 3)) .+ h(p, t - T(1 / 5))) ./ (-oneunit(t)) +end + """ prob_dde_constant_2delays_oop Same delay differential equation as [`prob_dde_constant_2delays_ip`](@ref), but purposefully implemented with an out-of-place function. """ -prob_dde_constant_2delays_oop - -function f_dde_constant_2delays_oop(u, h, p, t) - T = typeof(t) - return (h(p, t - T(1 / 3)) .+ h(p, t - T(1 / 5))) ./ (-oneunit(t)) -end - const prob_dde_constant_2delays_oop = DDEProblem( DDEFunction( f_dde_constant_2delays_oop; @@ -368,19 +352,17 @@ const prob_dde_constant_2delays_oop = DDEProblem( ### Scalar function +function f_dde_constant_2delays_scalar(u, h, p, t) + T = typeof(t) + return -(h(p, t - T(1 / 3)) + h(p, t - T(1 / 5))) / oneunit(t) +end + """ prob_dde_constant_2delays_scalar Same delay differential equation as [`prob_dde_constant_2delays_ip`](@ref), but purposefully implemented with a scalar function. """ -prob_dde_constant_2delays_scalar - -function f_dde_constant_2delays_scalar(u, h, p, t) - T = typeof(t) - return -(h(p, t - T(1 / 3)) + h(p, t - T(1 / 5))) / oneunit(t) -end - const prob_dde_constant_2delays_scalar = DDEProblem( DDEFunction( f_dde_constant_2delays_scalar; @@ -395,7 +377,13 @@ const prob_dde_constant_2delays_scalar = DDEProblem( ### In-place function -@doc raw""" +function f_dde_constant_2delays_long_ip!(du, u, h, p, t) + T = typeof(t) + du[1] = -(h(p, t - T(1 / 3); idxs = 1) + h(p, t - T(1 / 5); idxs = 1)) / oneunit(t) + return nothing +end + +""" prob_dde_constant_2delays_long_ip Delay differential equation @@ -404,17 +392,9 @@ Delay differential equation u'(t) = - u(t - 1/3) - u(t - 1/5) ``` -for ``t \in [0, 100]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and +for ``t \\in [0, 100]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and ``ϕ(0) = 1``. """ -prob_dde_constant_2delays_long_ip - -function f_dde_constant_2delays_long_ip!(du, u, h, p, t) - T = typeof(t) - du[1] = -(h(p, t - T(1 / 3); idxs = 1) + h(p, t - T(1 / 5); idxs = 1)) / oneunit(t) - return nothing -end - const prob_dde_constant_2delays_long_ip = DDEProblem( f_dde_constant_2delays_long_ip!, [1.0], h_dde_constant_ip, (0.0, 100.0), @@ -424,19 +404,17 @@ const prob_dde_constant_2delays_long_ip = DDEProblem( ### Out-of-place function +function f_dde_constant_2delays_long_oop(u, h, p, t) + T = typeof(t) + return (h(p, t - T(1 / 3)) .+ h(p, t - T(1 / 5))) ./ (-oneunit(t)) +end + """ prob_dde_constant_2delays_long_oop Same delay differential equation as [`prob_dde_constant_2delays_long_ip`](@ref), but purposefully implemented with an out-of-place function. """ -prob_dde_constant_2delays_long_oop - -function f_dde_constant_2delays_long_oop(u, h, p, t) - T = typeof(t) - return (h(p, t - T(1 / 3)) .+ h(p, t - T(1 / 5))) ./ (-oneunit(t)) -end - const prob_dde_constant_2delays_long_oop = DDEProblem( f_dde_constant_2delays_long_oop, [1.0], h_dde_constant_oop, @@ -447,19 +425,17 @@ const prob_dde_constant_2delays_long_oop = DDEProblem( #### Scalar function +function f_dde_constant_2delays_long_scalar(u, h, p, t) + T = typeof(t) + return -(h(p, t - T(1 / 3)) + h(p, t - T(1 / 5))) / oneunit(t) +end + """ prob_dde_constant_2delays_long_scalar Same delay differential equation as [`prob_dde_constant_2delays_long_ip`](@ref), but purposefully implemented with a scalar function. """ -prob_dde_constant_2delays_long_scalar - -function f_dde_constant_2delays_long_scalar(u, h, p, t) - T = typeof(t) - return -(h(p, t - T(1 / 3)) + h(p, t - T(1 / 5))) / oneunit(t) -end - const prob_dde_constant_2delays_long_scalar = DDEProblem( f_dde_constant_2delays_long_scalar, 1.0, h_dde_constant_scalar, diff --git a/lib/DDEProblemLibrary/src/ddetst.jl b/lib/DDEProblemLibrary/src/ddetst.jl index 8f9fac0..b9fd416 100644 --- a/lib/DDEProblemLibrary/src/ddetst.jl +++ b/lib/DDEProblemLibrary/src/ddetst.jl @@ -5,24 +5,6 @@ differential equations. =# # Problem A1 -@doc raw""" - prob_dde_DDETST_A1 - -Delay differential equation model of blood production, given by - -```math -u'(t) = \frac{0.2 u(t - 14)}{1 + u(t - 14)^{10}} - 0.1 u(t) -``` - -for ``t \in [0, 500]`` and history function ``ϕ(t) = 0.5`` for ``t ≤ 0``. - -# References - -Mackey, M. C. and Glass, L. (1977). Oscillation and chaos in physiological control systems, -Science (197), pp. 287-289. -""" -prob_dde_DDETST_A1 - function f_dde_DDETST_A1(u, h, p, t) z = h(p, t - 14) @@ -35,42 +17,28 @@ function h_dde_DDETST_A1(p, t) return 0.5 end -const prob_dde_DDETST_A1 = DDEProblem( - f_dde_DDETST_A1, h_dde_DDETST_A1, (0.0, 500.0); - constant_lags = [14] -) - -# Problem A2 -@doc raw""" - prob_dde_DDETST_A2 - -Delay differential equation model of chronic granulocytic leukemia, given by - -```math -\begin{align*} -u_1'(t) &= \frac{1.1}{1 + \sqrt{10} u_1(t - 20)^{5/4}} - \frac{10 u_1(t)}{1 + 40 u_2(t)}, \\ -u_2'(t) &= \frac{100 u_1(t)}{1 + 40 u_2(t)} - 2.43 u_2(t), -\end{align*} -``` +""" + prob_dde_DDETST_A1 -for ``t \in [0, 100]`` and history function +Delay differential equation model of blood production, given by ```math -\begin{align*} -ϕ_1(t) &= 1.05767027/3, \\ -ϕ_2(t) &= 1.030713491/3, -\end{align*} +u'(t) = \\frac{0.2 u(t - 14)}{1 + u(t - 14)^{10}} - 0.1 u(t) ``` -for ``t ≤ 0``. +for ``t \\in [0, 500]`` and history function ``ϕ(t) = 0.5`` for ``t ≤ 0``. # References -Wheldon, T., Kirk, J. and Finlay, H. (1974). Cyclical granulopoiesis in chronic granulocytic -leukemia: A simulation study., Blood (43), pp. 379-387. +Mackey, M. C. and Glass, L. (1977). Oscillation and chaos in physiological control systems, +Science (197), pp. 287-289. """ -prob_dde_DDETST_A2 +const prob_dde_DDETST_A1 = DDEProblem( + f_dde_DDETST_A1, h_dde_DDETST_A1, (0.0, 500.0); + constant_lags = [14] +) +# Problem A2 function f_dde_DDETST_A2!(du, u, h, p, t) z = 10 * u[1] / (1 + 40 * u[2]) @@ -94,38 +62,40 @@ function h_dde_DDETST_A2(p, t; idxs::Union{Nothing, Int} = nothing) end end -const prob_dde_DDETST_A2 = DDEProblem( - f_dde_DDETST_A2!, h_dde_DDETST_A2, (0.0, 100.0); - constant_lags = [20] -) - -# Problem B2 -@doc raw""" - prob_dde_DDETST_B1 +""" + prob_dde_DDETST_A2 -Delay differential equation +Delay differential equation model of chronic granulocytic leukemia, given by ```math -u'(t) = 1 - u(\exp(1 - 1/t)) +\\begin{align*} +u_1'(t) &= \\frac{1.1}{1 + \\sqrt{10} u_1(t - 20)^{5/4}} - \\frac{10 u_1(t)}{1 + 40 u_2(t)}, \\\\ +u_2'(t) &= \\frac{100 u_1(t)}{1 + 40 u_2(t)} - 2.43 u_2(t), +\\end{align*} ``` -for ``t \in [0.1, 10]`` with history function ``ϕ(t) = \log t`` for ``t \in (0, 0.1]``. - -# Solution - -The analytical solution for ``t \in [0.1, 10]`` is +for ``t \\in [0, 100]`` and history function ```math -u(t) = \log t. +\\begin{align*} +ϕ_1(t) &= 1.05767027/3, \\\\ +ϕ_2(t) &= 1.030713491/3, +\\end{align*} ``` +for ``t ≤ 0``. + # References -Neves, K. W. (1975). Automatic integration of functional differential equations: An -approach, ACM Trans. Math. Soft. (1), pp. 357-368. +Wheldon, T., Kirk, J. and Finlay, H. (1974). Cyclical granulopoiesis in chronic granulocytic +leukemia: A simulation study., Blood (43), pp. 379-387. """ -prob_dde_DDETST_B1 +const prob_dde_DDETST_A2 = DDEProblem( + f_dde_DDETST_A2!, h_dde_DDETST_A2, (0.0, 100.0); + constant_lags = [20] +) +# Problem B2 function f_dde_DDETST_B1(u, h, p, t) return 1 - h(p, exp(1 - 1 / t)) end @@ -143,47 +113,40 @@ function fanalytic_dde_DDETST_B1(u₀, ::typeof(h_dde_DDETST_B1), p, t) return log(t) end -const prob_dde_DDETST_B1 = DDEProblem( - DDEFunction( - f_dde_DDETST_B1; - analytic = fanalytic_dde_DDETST_B1 - ), - h_dde_DDETST_B1, (0.1, 10.0); - dependent_lags = ((u, p, t) -> t - exp(1 - 1 / t),) -) - -# Problem B2 -@doc raw""" - prob_dde_DDETST_B2 +""" + prob_dde_DDETST_B1 Delay differential equation ```math -u'(t) = - 1 - u(t) + 2 [u(t / 2) < 0] +u'(t) = 1 - u(\\exp(1 - 1/t)) ``` -for ``t \in [0, 2 \log 66]`` with history function ``ϕ(0) = 1``. +for ``t \\in [0.1, 10]`` with history function ``ϕ(t) = \\log t`` for ``t \\in (0, 0.1]``. # Solution -The analytical solution for ``t \in [0, 2 \log 66]`` is +The analytical solution for ``t \\in [0.1, 10]`` is ```math -u(t) = \begin{cases} - 2 \exp(-t) - 1 & \text{if } t \in [0, 2 \log 2], \\ - 1 - 6 \exp(-t) & \text{if } t \in (2 \log 2, 2 \log 6], \\ - 66 \exp(-t) - 1 & \text{if } t \in (2 \log 6, 2 \log 66]. -\end{cases} +u(t) = \\log t. ``` # References -Neves, K. W. and Thompson, S. (1992). Solution of systems of functional differential -equations with state dependent delays, Technical Report TR-92-009, Computer Science, -Radford University. +Neves, K. W. (1975). Automatic integration of functional differential equations: An +approach, ACM Trans. Math. Soft. (1), pp. 357-368. """ -prob_dde_DDETST_B2 +const prob_dde_DDETST_B1 = DDEProblem( + DDEFunction( + f_dde_DDETST_B1; + analytic = fanalytic_dde_DDETST_B1 + ), + h_dde_DDETST_B1, (0.1, 10.0); + dependent_lags = ((u, p, t) -> t - exp(1 - 1 / t),) +) +# Problem B2 function f_dde_DDETST_B2(u, h, p, t) return if h(p, t / 2) < 0 1 - u @@ -211,6 +174,35 @@ function fanalytic_dde_DDETST_B2(u₀, ::typeof(h_dde_DDETST_B2), p, t) end end +""" + prob_dde_DDETST_B2 + +Delay differential equation + +```math +u'(t) = - 1 - u(t) + 2 [u(t / 2) < 0] +``` + +for ``t \\in [0, 2 \\log 66]`` with history function ``ϕ(0) = 1``. + +# Solution + +The analytical solution for ``t \\in [0, 2 \\log 66]`` is + +```math +u(t) = \\begin{cases} + 2 \\exp(-t) - 1 & \\text{if } t \\in [0, 2 \\log 2], \\\\ + 1 - 6 \\exp(-t) & \\text{if } t \\in (2 \\log 2, 2 \\log 6], \\\\ + 66 \\exp(-t) - 1 & \\text{if } t \\in (2 \\log 6, 2 \\log 66]. +\\end{cases} +``` + +# References + +Neves, K. W. and Thompson, S. (1992). Solution of systems of functional differential +equations with state dependent delays, Technical Report TR-92-009, Computer Science, +Radford University. +""" const prob_dde_DDETST_B2 = DDEProblem( DDEFunction( f_dde_DDETST_B2; @@ -221,7 +213,15 @@ const prob_dde_DDETST_B2 = DDEProblem( ) # Problem C1 -@doc raw""" +f_dde_DDETST_C1(u, h, p, t) = -2 * h(p, t - 1 - abs(u)) * (1 - u^2) + +function h_dde_DDETST_C1(p, t) + t ≤ 0 || error("history function is only implemented for t ≤ 0") + + return 0.5 +end + +""" prob_dde_DDETST_C1 Delay differential equation @@ -230,48 +230,62 @@ Delay differential equation u'(t) = - 2 u(t - 1 - |u(t)|) (1 - u(t)^2) ``` -for ``t \in [0, 30]`` with history function ``ϕ(t) = 0.5`` for ``t ≤ 0``. +for ``t \\in [0, 30]`` with history function ``ϕ(t) = 0.5`` for ``t ≤ 0``. # References Paul, C. A. H. (1994). A test set of functional differential equations, Technical Report 249, The Department of Mathematics, The University of Manchester, Manchester, England. """ -prob_dde_DDETST_C1 - -f_dde_DDETST_C1(u, h, p, t) = -2 * h(p, t - 1 - abs(u)) * (1 - u^2) - -function h_dde_DDETST_C1(p, t) - t ≤ 0 || error("history function is only implemented for t ≤ 0") - - return 0.5 -end - const prob_dde_DDETST_C1 = DDEProblem( f_dde_DDETST_C1, h_dde_DDETST_C1, (0.0, 30.0); dependent_lags = ((u, p, t) -> 1 + abs(u),) ) # Problem C2 -@doc raw""" +function f_dde_DDETST_C2!(du, u, h, p, t) + z = h(p, t - u[2]; idxs = 1) + absz = abs(z) + + du[1] = -2 * z + du[2] = (absz - abs(u[1])) / (1 + absz) + + return nothing +end + +function h_dde_DDETST_C2(p, t; idxs::Union{Nothing, Int} = nothing) + t ≤ 0 || error("history function is only implemented for t ≤ 0") + + return if idxs === nothing + [1.0, 0.5] + elseif idxs == 1 + 1.0 + elseif idxs == 2 + 0.5 + else + error("delay differential equation consists of two components") + end +end + +""" prob_dde_DDETST_C2 Delay differential equation ```math -\begin{align*} -u_1'(t) &= - 2 u_1(t - u_2(t)), \\ -u_₂'(t) &= \frac{|u_1(t - u_2(t))| - |u_1(t)|}{1 + |u_1(t - u_2(t))|}, -\end{align*} +\\begin{align*} +u_1'(t) &= - 2 u_1(t - u_2(t)), \\\\ +u_₂'(t) &= \\frac{|u_1(t - u_2(t))| - |u_1(t)|}{1 + |u_1(t - u_2(t))|}, +\\end{align*} ``` -for ``t \in [0, 40]`` with history function +for ``t \\in [0, 40]`` with history function ```math -\begin{align*} -ϕ_1(t) &= 1, \\ +\\begin{align*} +ϕ_1(t) &= 1, \\\\ ϕ_2(t) &= 0.5, -\end{align*} +\\end{align*} ``` for ``t ≤ 0``. @@ -281,61 +295,65 @@ for ``t ≤ 0``. Paul, C. A. H. (1994). A test set of functional differential equations, Technical Report 249, The Department of Mathematics, The University of Manchester, Manchester, England. """ -prob_dde_DDETST_C2 +const prob_dde_DDETST_C2 = DDEProblem( + f_dde_DDETST_C2!, h_dde_DDETST_C2, (0.0, 30.0); + dependent_lags = ((u, p, t) -> u[2],) +) -function f_dde_DDETST_C2!(du, u, h, p, t) - z = h(p, t - u[2]; idxs = 1) - absz = abs(z) +# Problem C3 +function f_dde_DDETST_D1!(du, u, h, p, t) + s = exp(1 - u[2]) - du[1] = -2 * z - du[2] = (absz - abs(u[1])) / (1 + absz) + du[1] = u[2] + du[2] = -h(p, s; idxs = 2) * u[2]^2 * s return nothing end -function h_dde_DDETST_C2(p, t; idxs::Union{Nothing, Int} = nothing) - t ≤ 0 || error("history function is only implemented for t ≤ 0") +function h_dde_DDETST_D1(p, t; idxs::Union{Nothing, Int} = nothing) + 0 < t ≤ 0.1 || error("history function is only implemented for 0 < t ≤ 0.1") return if idxs === nothing - [1.0, 0.5] + [log(t), 1 / t] elseif idxs == 1 - 1.0 + log(t) elseif idxs == 2 - 0.5 + 1 / t else error("delay differential equation consists of two components") end end -const prob_dde_DDETST_C2 = DDEProblem( - f_dde_DDETST_C2!, h_dde_DDETST_C2, (0.0, 30.0); - dependent_lags = ((u, p, t) -> u[2],) -) +function fanalytic_dde_DDETST_D1(u₀, ::typeof(h_dde_DDETST_D1), p, t) + 0.1 ≤ t ≤ 5 && u₀ == [log(0.1), 10] || + error("analytical solution is only implemented for t ∈ [0.1, 5] and u(0.1) = [log 0.1, 10]") -# Problem C3 -@doc raw""" + return [log(t), 1 / t] +end + +""" prob_dde_DDETST_C3 Delay differential equation model of hematopoiesis, given by ```math -\begin{align*} -u_1'(t) &= \hat{s}_0 u_2(t - T_1) - γ u_1(t) - Q, \\ -u_2'(t) &= f(u_1(t)) - k u_2(t), \\ -u_3'(t) &= 1 - \frac{Q \exp(γ u_3(t))}{\hat{s}_0 u_2(t - T_1 - u_3(t))}, -\end{align*} +\\begin{align*} +u_1'(t) &= \\hat{s}_0 u_2(t - T_1) - γ u_1(t) - Q, \\\\ +u_2'(t) &= f(u_1(t)) - k u_2(t), \\\\ +u_3'(t) &= 1 - \\frac{Q \\exp(γ u_3(t))}{\\hat{s}_0 u_2(t - T_1 - u_3(t))}, +\\end{align*} ``` -for ``t \in [0, 300]`` with history function ``ϕ_1(0) = 3.325``, ``ϕ_3(0) = 120``, and +for ``t \\in [0, 300]`` with history function ``ϕ_1(0) = 3.325``, ``ϕ_3(0) = 120``, and ```math -ϕ_2(t) = \begin{cases} - 10 & \text{if } t \in [- T_1, 0],\\ - 9.5 & \text{if } t < - T_1, -\end{cases} +ϕ_2(t) = \\begin{cases} + 10 & \\text{if } t \\in [- T_1, 0],\\\\ + 9.5 & \\text{if } t < - T_1, +\\end{cases} ``` -where ``f(y) = a / (1 + K y^r)``, ``\hat{s}_0 = 0.0031``, ``T_1 = 6``, ``γ = 0.001``, +where ``f(y) = a / (1 + K y^r)``, ``\\hat{s}_0 = 0.0031``, ``T_1 = 6``, ``γ = 0.001``, ``Q = 0.0275``, ``k = 2.8``, ``a = 6570``, ``K = 0.0382``, and ``r = 6.96``. # References @@ -377,23 +395,23 @@ const prob_dde_DDETST_C3 = let s₀ = 0.0031, T₁ = 6, γ = 0.001, Q = 0.0275, end # Problem C4 -@doc raw""" +""" prob_dde_DDETST_C4 Delay differential equation model of hematopoiesis, given by the same delay differential equation as [`prob_dde_DDETST_C3`](@ref) ```math -\begin{align*} -u_1'(t) &= \hat{s}_0 u_2(t - T_1) - γ u_1(t) - Q, \\ -u_2'(t) &= f(u_1(t)) - k u_2(t), \\ -u_3'(t) &= 1 - \frac{Q \exp(γ u_3(t))}{\hat{s}_0 u_2(t - T_1 - u_3(t))}, -\end{align*} +\\begin{align*} +u_1'(t) &= \\hat{s}_0 u_2(t - T_1) - γ u_1(t) - Q, \\\\ +u_2'(t) &= f(u_1(t)) - k u_2(t), \\\\ +u_3'(t) &= 1 - \\frac{Q \\exp(γ u_3(t))}{\\hat{s}_0 u_2(t - T_1 - u_3(t))}, +\\end{align*} ``` -for ``t \in [0, 100]`` with history function +for ``t \\in [0, 100]`` with history function ``ϕ_1(0) = 3.5``, ``ϕ_3(0) = 50``, and ``ϕ_2(t) = 10`` for ``t ≤ 0``, where -``f(y) = a / (1 + K y^r)``, ``\hat{s}_0 = 0.00372``, ``T_1 = 3``, ``γ = 0.1``, +``f(y) = a / (1 + K y^r)``, ``\\hat{s}_0 = 0.00372``, ``T_1 = 3``, ``γ = 0.1``, ``Q = 0.00178``, ``k = 6.65``, ``a = 15600``, ``K = 0.0382``, and ``r = 6.96``. # References @@ -435,38 +453,38 @@ const prob_dde_DDETST_C4 = let s₀ = 0.00372, T₁ = 3, γ = 0.01, Q = 0.00178, end # Problem D1 -@doc raw""" +""" prob_dde_DDETST_D1 Delay differential equation ```math -\begin{align*} -u_1'(t) &= u_2(t), \\ -u_2'(t) &= - u_2(\exp(1 - u_2(t))) u_2(t)^2 \exp(1 - u_2(t)), -\end{align*} +\\begin{align*} +u_1'(t) &= u_2(t), \\\\ +u_2'(t) &= - u_2(\\exp(1 - u_2(t))) u_2(t)^2 \\exp(1 - u_2(t)), +\\end{align*} ``` -for ``t \in [0.1, 5]`` with history function +for ``t \\in [0.1, 5]`` with history function ```math -\begin{align*} -ϕ_1(t) &= \log t, \\ +\\begin{align*} +ϕ_1(t) &= \\log t, \\\\ ϕ_2(t) &= 1 / t, -\end{align*} +\\end{align*} ``` -for ``t \in (0, 0.1]``. +for ``t \\in (0, 0.1]``. # Solution -The analytical solution for ``t \in [0.1, 5]`` is +The analytical solution for ``t \\in [0.1, 5]`` is ```math -\begin{align*} -u_1(t) = \log t, \\ +\\begin{align*} +u_1(t) = \\log t, \\\\ u_2(t) = 1 / t. -\end{align*} +\\end{align*} ``` # References @@ -474,71 +492,69 @@ u_2(t) = 1 / t. Neves, K. W. (1975). Automatic integration of functional differential equations: An approach, ACM Trans. Math. Soft. (1), pp. 357-368. """ -prob_dde_DDETST_D1 +const prob_dde_DDETST_D1 = DDEProblem( + DDEFunction( + f_dde_DDETST_D1!; + analytic = fanalytic_dde_DDETST_D1 + ), + h_dde_DDETST_D1, (0.1, 5.0); + dependent_lags = ((u, p, t) -> t - exp(1 - u[2]),) +) -function f_dde_DDETST_D1!(du, u, h, p, t) - s = exp(1 - u[2]) +# Problem D2 +function f_dde_DDETST_F1(u, h, p, t) + s, c = sincos(t) + c2 = 2 * c - du[1] = u[2] - du[2] = -h(p, s; idxs = 2) * u[2]^2 * s + to2 = t / 2 + h0 = h(p, to2) + h1 = h(p, to2, Val{1}) - return nothing + return 2 * cos(2 * t) * h0^c2 + log(h1) - log(c2) - s end -function h_dde_DDETST_D1(p, t; idxs::Union{Nothing, Int} = nothing) - 0 < t ≤ 0.1 || error("history function is only implemented for 0 < t ≤ 0.1") +function h_dde_DDETST_F1(p, t) + iszero(t) || error("history function is only implemented for t = 0") - return if idxs === nothing - [log(t), 1 / t] - elseif idxs == 1 - log(t) - elseif idxs == 2 - 1 / t - else - error("delay differential equation consists of two components") - end + return 1.0 end -function fanalytic_dde_DDETST_D1(u₀, ::typeof(h_dde_DDETST_D1), p, t) - 0.1 ≤ t ≤ 5 && u₀ == [log(0.1), 10] || - error("analytical solution is only implemented for t ∈ [0.1, 5] and u(0.1) = [log 0.1, 10]") +function h_dde_DDETST_F1(p, t, ::Type{Val{1}}) + iszero(t) || error("history function is only implemented for t = 0") - return [log(t), 1 / t] + return 2.0 end -const prob_dde_DDETST_D1 = DDEProblem( - DDEFunction( - f_dde_DDETST_D1!; - analytic = fanalytic_dde_DDETST_D1 - ), - h_dde_DDETST_D1, (0.1, 5.0); - dependent_lags = ((u, p, t) -> t - exp(1 - u[2]),) -) +function fanalytic_dde_DDETST_F1(u₀, ::typeof(h_dde_DDETST_F1), p, t) + 0 ≤ t ≤ 1 && u₀ == 1 || + error("analytical solution is only implemented for t ∈ [0, 1] and u(0) = 1") -# Problem D2 -@doc raw""" + return exp(sin(2 * t)) +end + +""" prob_dde_DDETST_D2 Delay differential equation model of antigen antibody dynamics with fading memory, given by ```math -\begin{align*} -u_1'(t) &= - r_1 u_1(t) u_2(t) + r_2 u_3(t), \\ -u_2'(t) &= - r_1 u_1(t) u_2(t) + α r_1 u_1(t - u_4(t)) u_2(t - u_4(t)), \\ -u_3'(t) &= r_1 u_1(t) u_2(t) - r_2 u_3(t), \\ -u_4'(t) &= 1 + \frac{3δ - u_1(t) u_2(t) - u_3(t)}{u_1(t - u_4(t)) u_2(t - u_4(t)) + u_3(t - u_4(t))} \exp(δ u_4(t)), -\end{align*} +\\begin{align*} +u_1'(t) &= - r_1 u_1(t) u_2(t) + r_2 u_3(t), \\\\ +u_2'(t) &= - r_1 u_1(t) u_2(t) + α r_1 u_1(t - u_4(t)) u_2(t - u_4(t)), \\\\ +u_3'(t) &= r_1 u_1(t) u_2(t) - r_2 u_3(t), \\\\ +u_4'(t) &= 1 + \\frac{3δ - u_1(t) u_2(t) - u_3(t)}{u_1(t - u_4(t)) u_2(t - u_4(t)) + u_3(t - u_4(t))} \\exp(δ u_4(t)), +\\end{align*} ``` -for ``t \in [0, 40]`` with history function +for ``t \\in [0, 40]`` with history function ```math -\begin{align*} +\\begin{align*} ϕ_1(t) &= 5, & -ϕ_2(t) &= 0.1, \\ +ϕ_2(t) &= 0.1, \\\\ ϕ_3(t) &= 0, & ϕ_4(t) &= 0, -\end{align*} +\\end{align*} ``` for ``t ≤ 0``, where ``r_1 = 0.02``, ``r_2 = 0.005``, ``α = 3``, and ``δ = 0.01``. @@ -579,7 +595,7 @@ const prob_dde_DDETST_D2 = let r₁ = 0.02, r₂ = 0.005, α = 3, δ = 0.01 end # Problem E1 -@doc raw""" +""" prob_dde_DDETST_E1 Delay differential equation model of a food-limited population, given by @@ -588,8 +604,8 @@ Delay differential equation model of a food-limited population, given by u(t) = r u(t) (1 - u(t - 1) - c u'(t - 1)) ``` -for ``t \in [0, 40]`` with history function ``ϕ(t) = 2 + t`` for ``t ≤ 0``, where -``r = π / \sqrt{3} + 1/20`` and ``c = \sqrt{3} / (2π) - 1 / 25``. +for ``t \\in [0, 40]`` with history function ``ϕ(t) = 2 + t`` for ``t ≤ 0``, where +``r = π / \\sqrt{3} + 1/20`` and ``c = \\sqrt{3} / (2π) - 1 / 25``. # References @@ -618,25 +634,25 @@ const prob_dde_DDETST_E1 = let r = π / sqrt(3) + 1 / 20, c = sqrt(3) / (2 * π) end # Problem E2 -@doc raw""" +""" prob_dde_DDETST_E2 Delay differential equation model of a logistic Gauss-type predator-prey system, given by ```math -\begin{align*} -u_1'(t) &= u_1(t) (1 - u_1(t - τ) - ρ u_1'(t - τ)) - \frac{u_2(t) u_1(t)^2}{u_1(t)^2 + 1}, \\ -u_2'(t) &= u_2(t) \left(\frac{u_1(t)^2}{u_1(t)^2 + 1} - α\right), -\end{align*} +\\begin{align*} +u_1'(t) &= u_1(t) (1 - u_1(t - τ) - ρ u_1'(t - τ)) - \\frac{u_2(t) u_1(t)^2}{u_1(t)^2 + 1}, \\\\ +u_2'(t) &= u_2(t) \\left(\\frac{u_1(t)^2}{u_1(t)^2 + 1} - α\\right), +\\end{align*} ``` -for ``t \in [0, 2]`` with history function +for ``t \\in [0, 2]`` with history function ```math -\begin{align*} -ϕ_1(t) &= 0.33 - t / 10, \\ +\\begin{align*} +ϕ_1(t) &= 0.33 - t / 10, \\\\ ϕ_2(t) &= 2.22 + t / 10, -\end{align*} +\\end{align*} ``` for ``t ≤ 0``, where ``α = 0.1``, ``ρ = 2.9``, and ``τ = 0.42``. @@ -693,23 +709,23 @@ const prob_dde_DDETST_E2 = let α = 0.1, ρ = 2.9, τ = 0.42 end # Problem F1 -@doc raw""" +""" prob_dde_DDETST_F1 Delay differential equation ```math -u'(t) = 2 \cos(2t) u(t / 2)^{2 \cos t} + \log(u'(t / 2)) - \log(2 \cos t) - \sin t +u'(t) = 2 \\cos(2t) u(t / 2)^{2 \\cos t} + \\log(u'(t / 2)) - \\log(2 \\cos t) - \\sin t ``` -for ``t \in [0, 1]`` with history function ``ϕ(0) = 1`` and ``ϕ'(0) = 2``. +for ``t \\in [0, 1]`` with history function ``ϕ(0) = 1`` and ``ϕ'(0) = 2``. # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -u(t) = \exp(\sin(2t)). +u(t) = \\exp(\\sin(2t)). ``` # References @@ -717,38 +733,6 @@ u(t) = \exp(\sin(2t)). Jackiewicz, Z. (1981). One step methods for the numerical solution of Volterra functional differential equations of neutral type, Applicable Anal. (12), pp. 1-11. """ -prob_dde_DDETST_F1 - -function f_dde_DDETST_F1(u, h, p, t) - s, c = sincos(t) - c2 = 2 * c - - to2 = t / 2 - h0 = h(p, to2) - h1 = h(p, to2, Val{1}) - - return 2 * cos(2 * t) * h0^c2 + log(h1) - log(c2) - s -end - -function h_dde_DDETST_F1(p, t) - iszero(t) || error("history function is only implemented for t = 0") - - return 1.0 -end - -function h_dde_DDETST_F1(p, t, ::Type{Val{1}}) - iszero(t) || error("history function is only implemented for t = 0") - - return 2.0 -end - -function fanalytic_dde_DDETST_F1(u₀, ::typeof(h_dde_DDETST_F1), p, t) - 0 ≤ t ≤ 1 && u₀ == 1 || - error("analytical solution is only implemented for t ∈ [0, 1] and u(0) = 1") - - return exp(sin(2 * t)) -end - const prob_dde_DDETST_F1 = DDEProblem( DDEFunction( f_dde_DDETST_F1; @@ -760,47 +744,6 @@ const prob_dde_DDETST_F1 = DDEProblem( ) # Problem F2 -@doc raw""" - prob_dde_DDETST_F2 - -Delay differential equation - -```math -u'(t) = u'(2t - 0.5) -``` - -for ``t \in [0.25, 0.499]`` with history function ``ϕ(t) = \exp(-t^2)`` and -``ϕ'(t) = -2t \exp(-t^2)`` for ``t ≤ 0.25``. - -# Solution - -The analytical solution for ``t \in [0.25, 0.499]`` is - -```math -u(t) = u_i(t) = \exp(-4^i t^2 + B_i t + C_i) / 2^i + K_i -``` - -if ``t \in [x_i, x_{i + 1}]``, where - -```math -\begin{align*} -x_i &= (1 - 2^{-i}) / 2, \\ -B_i &= 2 (4^{i-1} + B_{i-1}), \\ -C_i &= - 4^{i-2} - B_{i-1} / 2 + C_{i-1}, \\ -K_i &= - \exp(-4^i x_i^2 + B_i x_i + C_i) / 2^i + u_{i-1}(x_i), -\end{align*} -``` - -and ``B_0 = C_0 = K_0 = 0``. - -# References - -Neves, K. W. and Thompson, S. (1992). Solution of systems of functional differential -equations with state dependent delays, Technical Report TR-92-009, Computer Science, -Radford University. -""" -prob_dde_DDETST_F2 - f_dde_DDETST_F2(u, h, p, t) = h(p, 2 * t - 0.5, Val{1}) function h_dde_DDETST_F2(p, t) @@ -840,39 +783,56 @@ function fanalytic_dde_DDETST_F2(u₀, ::typeof(h_dde_DDETST_F2), p, t) return end -const prob_dde_DDETST_F2 = DDEProblem( - DDEFunction( - f_dde_DDETST_F2; - analytic = fanalytic_dde_DDETST_F2 - ), - h_dde_DDETST_F2, (0.25, 0.499); - dependent_lags = ((u, p, t) -> 1 / 2 - t,), - neutral = true -) - -# Problem F3 -@doc raw""" - prob_dde_DDETST_F3 +""" + prob_dde_DDETST_F2 Delay differential equation ```math -u'(t) = \exp(-u(t)) + L_3 \left[\sin(u'(α(t))) - \sin\left(\frac{1}{3 + α(t)}\right)\right] +u'(t) = u'(2t - 0.5) ``` -for ``t \in [0, 10]`` with history function ``ϕ(0) = \log 3`` and ``ϕ'(0) = 1 / 3``, -where ``α(t) = 0.5 t (1 - \cos(2πt))`` and ``L_3 = 0.2``. +for ``t \\in [0.25, 0.499]`` with history function ``ϕ(t) = \\exp(-t^2)`` and +``ϕ'(t) = -2t \\exp(-t^2)`` for ``t ≤ 0.25``. # Solution -The analytical solution for ``t \in [0, 10]`` is +The analytical solution for ``t \\in [0.25, 0.499]`` is + +```math +u(t) = u_i(t) = \\exp(-4^i t^2 + B_i t + C_i) / 2^i + K_i +``` + +if ``t \\in [x_i, x_{i + 1}]``, where ```math -u(t) = \log(t + 3). +\\begin{align*} +x_i &= (1 - 2^{-i}) / 2, \\\\ +B_i &= 2 (4^{i-1} + B_{i-1}), \\\\ +C_i &= - 4^{i-2} - B_{i-1} / 2 + C_{i-1}, \\\\ +K_i &= - \\exp(-4^i x_i^2 + B_i x_i + C_i) / 2^i + u_{i-1}(x_i), +\\end{align*} ``` + +and ``B_0 = C_0 = K_0 = 0``. + +# References + +Neves, K. W. and Thompson, S. (1992). Solution of systems of functional differential +equations with state dependent delays, Technical Report TR-92-009, Computer Science, +Radford University. """ -prob_dde_DDETST_F3 +const prob_dde_DDETST_F2 = DDEProblem( + DDEFunction( + f_dde_DDETST_F2; + analytic = fanalytic_dde_DDETST_F2 + ), + h_dde_DDETST_F2, (0.25, 0.499); + dependent_lags = ((u, p, t) -> 1 / 2 - t,), + neutral = true +) +# Problem F3 let L₃ = 0.2 global function f_dde_DDETST_F3(u, h, p, t) α = 0.5 * t * (1 - cos(2 * π * t)) @@ -900,6 +860,26 @@ function fanalytic_dde_DDETST_F345(u₀, ::typeof(h_dde_DDETST_F345), p, t) return log(t + 3) end +""" + prob_dde_DDETST_F3 + +Delay differential equation + +```math +u'(t) = \\exp(-u(t)) + L_3 \\left[\\sin(u'(α(t))) - \\sin\\left(\\frac{1}{3 + α(t)}\\right)\\right] +``` + +for ``t \\in [0, 10]`` with history function ``ϕ(0) = \\log 3`` and ``ϕ'(0) = 1 / 3``, +where ``α(t) = 0.5 t (1 - \\cos(2πt))`` and ``L_3 = 0.2``. + +# Solution + +The analytical solution for ``t \\in [0, 10]`` is + +```math +u(t) = \\log(t + 3). +``` +""" const prob_dde_DDETST_F3 = DDEProblem( DDEFunction( f_dde_DDETST_F3; @@ -914,13 +894,6 @@ const prob_dde_DDETST_F3 = DDEProblem( ) # Problem F4 -""" - prob_dde_DDETST_F4 - -Same delay differential equation as [`prob_dde_DDETST_F3`](@ref) with ``L_3 = 0.4``. -""" -prob_dde_DDETST_F4 - let L₃ = 0.4 global function f_dde_DDETST_F4(u, h, p, t) α = 0.5 * t * (1 - cos(2 * π * t)) @@ -929,6 +902,11 @@ let L₃ = 0.4 end end +""" + prob_dde_DDETST_F4 + +Same delay differential equation as [`prob_dde_DDETST_F3`](@ref) with ``L_3 = 0.4``. +""" const prob_dde_DDETST_F4 = remake( prob_dde_DDETST_F3; f = DDEFunction( @@ -938,13 +916,6 @@ const prob_dde_DDETST_F4 = remake( ) # Problem F5 -""" - prob_dde_DDETST_F5 - -Same delay differential equation as [`prob_dde_DDETST_F3`](@ref) with ``L_3 = 0.6``. -""" -prob_dde_DDETST_F5 - let L₃ = 0.6 global function f_dde_DDETST_F5(u, h, p, t) α = 0.5 * t * (1 - cos(2 * π * t)) @@ -953,6 +924,11 @@ let L₃ = 0.6 end end +""" + prob_dde_DDETST_F5 + +Same delay differential equation as [`prob_dde_DDETST_F3`](@ref) with ``L_3 = 0.6``. +""" const prob_dde_DDETST_F5 = remake( prob_dde_DDETST_F3; f = DDEFunction( @@ -962,33 +938,6 @@ const prob_dde_DDETST_F5 = remake( ) # Problem G1 -@doc raw""" - prob_dde_DDETST_G1 - -Delay differential equation - -```math -u'(t) = - u'(t - u(t)^2 / 4) -``` - -for ``t \in [0, 1]`` with history function ``ϕ(t) = 1 - t`` for ``t ≤ 0`` and -``ϕ'(t) = -1`` for ``t < 0``. - -# Solution - -The analytical solution for ``t \in [0, 1]`` is - -```math -u(t) = t + 1. -``` - -# References - -El'sgol'ts, L. E. and Norkin, S. B. (1973). Introduction to the Theory and Application of -Differential Equations with Deviating Arguments, Academic Press, New York, p. 44. -""" -prob_dde_DDETST_G1 - f_dde_DDETST_G1(u, h, p, t) = -h(p, t - u^2 / 4, Val{1}) function h_dde_DDETST_G1(p, t) @@ -1010,42 +959,42 @@ function fanalytic_dde_DDETST_G1(u₀, ::typeof(h_dde_DDETST_G1), p, t) return t + 1 end -const prob_dde_DDETST_G1 = DDEProblem( - DDEFunction( - f_dde_DDETST_G1; - analytic = fanalytic_dde_DDETST_G1 - ), - h_dde_DDETST_G1, (0.0, 1.0); - dependent_lags = ((u, p, t) -> u^2 / 4,), - neutral = true -) - -# Problem G2 -@doc raw""" - prob_dde_DDETST_G2 +""" + prob_dde_DDETST_G1 Delay differential equation ```math -u'(t) = - u'(u(t) - 2) +u'(t) = - u'(t - u(t)^2 / 4) ``` -for ``t \in [0, 1]`` with history function ``ϕ(t) = 1 - t`` for ``t ≤ 0`` and +for ``t \\in [0, 1]`` with history function ``ϕ(t) = 1 - t`` for ``t ≤ 0`` and ``ϕ'(t) = -1`` for ``t < 0``. # Solution -The analytical solution for ``t \in [0, 1]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math u(t) = t + 1. ``` +# References + El'sgol'ts, L. E. and Norkin, S. B. (1973). Introduction to the Theory and Application of -Differential Equations with Deviating Arguments, Academic Press, New York, pp. 44-45. +Differential Equations with Deviating Arguments, Academic Press, New York, p. 44. """ -prob_dde_DDETST_G2 +const prob_dde_DDETST_G1 = DDEProblem( + DDEFunction( + f_dde_DDETST_G1; + analytic = fanalytic_dde_DDETST_G1 + ), + h_dde_DDETST_G1, (0.0, 1.0); + dependent_lags = ((u, p, t) -> u^2 / 4,), + neutral = true +) +# Problem G2 f_dde_DDETST_G2(u, h, p, t) = -h(p, u - 2, Val{1}) function h_dde_DDETST_G2(p, t) @@ -1067,43 +1016,40 @@ function fanalytic_dde_DDETST_G2(u₀, ::typeof(h_dde_DDETST_G2), p, t) return t + 1 end -const prob_dde_DDETST_G2 = DDEProblem( - DDEFunction( - f_dde_DDETST_G2; - analytic = fanalytic_dde_DDETST_G2 - ), - h_dde_DDETST_G2, (0.0, 1.0); - dependent_lags = ((u, p, t) -> t + 2 - u,), - neutral = true -) - -# Problem H1 -@doc raw""" - prob_dde_DDETST_H1 +""" + prob_dde_DDETST_G2 Delay differential equation ```math -u'(t) = - \frac{4 t u(t)^2}{4 + \log(\cos(2t))^2} + \tan(2t) + 0.5 \arctan\left(u'\left(\frac{t u(t)^2}{1 + u(t)^2}\right)\right) +u'(t) = - u'(u(t) - 2) ``` -for ``t \in [0, 0.225 π]`` with history function ``ϕ(0) = 0`` and ``ϕ'(0) = 0``. +for ``t \\in [0, 1]`` with history function ``ϕ(t) = 1 - t`` for ``t ≤ 0`` and +``ϕ'(t) = -1`` for ``t < 0``. # Solution -The analytical solution for ``t \in [0, 0.225 π]`` is +The analytical solution for ``t \\in [0, 1]`` is ```math -u(t) = - \log(\cos(2t)) / 2. +u(t) = t + 1. ``` -# References - -Castleton, R. N. and Grimm, L. J. (1973). A first order method for differential equations of -neutral type, Math. Comput. (27), pp. 571-577. +El'sgol'ts, L. E. and Norkin, S. B. (1973). Introduction to the Theory and Application of +Differential Equations with Deviating Arguments, Academic Press, New York, pp. 44-45. """ -prob_dde_DDETST_H1 +const prob_dde_DDETST_G2 = DDEProblem( + DDEFunction( + f_dde_DDETST_G2; + analytic = fanalytic_dde_DDETST_G2 + ), + h_dde_DDETST_G2, (0.0, 1.0); + dependent_lags = ((u, p, t) -> t + 2 - u,), + neutral = true +) +# Problem H1 function f_dde_DDETST_H1(u, h, p, t) v = u^2 z = t * v @@ -1130,45 +1076,41 @@ function fanalytic_dde_DDETST_H1(u₀, ::typeof(h_dde_DDETST_H1), p, t) return -log(cos(2 * t)) / 2 end -const prob_dde_DDETST_H1 = DDEProblem( - DDEFunction( - f_dde_DDETST_H1; - analytic = fanalytic_dde_DDETST_H1 - ), - h_dde_DDETST_H1, (0.0, 0.225 * π); - dependent_lags = ((u, p, t) -> t / (1 + u^2),), - neutral = true -) - -# Problem H2 -@doc raw""" - prob_dde_DDETST_H2 +""" + prob_dde_DDETST_H1 Delay differential equation ```math -u'(t) = \cos(t) (1 + u(t u(t)^2)) + L_3 u(t) u'(t u(t)^2) + (1 - L_3) \sin(t) \cos(t \sin(t)^2) - \sin(t + t \sin(t)^2) +u'(t) = - \\frac{4 t u(t)^2}{4 + \\log(\\cos(2t))^2} + \\tan(2t) + 0.5 \\arctan\\left(u'\\left(\\frac{t u(t)^2}{1 + u(t)^2}\\right)\\right) ``` -for ``t \in [0, π]`` with history function ``ϕ(0) = 0`` and ``ϕ'(0) = 1``, where -``L_3 = 0.1``. +for ``t \\in [0, 0.225 π]`` with history function ``ϕ(0) = 0`` and ``ϕ'(0) = 0``. # Solution -The analytical solution for ``t \in [0, π]`` is +The analytical solution for ``t \\in [0, 0.225 π]`` is ```math -u(t) = \sin(t). +u(t) = - \\log(\\cos(2t)) / 2. ``` # References -Hayashi, H. (1996). Numerical solution of retarded and neutral delay differential equations -using continuous Runge-Kutta methods, PhD thesis, Department of Computer Science, University -of Toronto, Toronto, Canada. +Castleton, R. N. and Grimm, L. J. (1973). A first order method for differential equations of +neutral type, Math. Comput. (27), pp. 571-577. """ -prob_dde_DDETST_H2 +const prob_dde_DDETST_H1 = DDEProblem( + DDEFunction( + f_dde_DDETST_H1; + analytic = fanalytic_dde_DDETST_H1 + ), + h_dde_DDETST_H1, (0.0, 0.225 * π); + dependent_lags = ((u, p, t) -> t / (1 + u^2),), + neutral = true +) +# Problem H2 let L₃ = 0.1 global function f_dde_DDETST_H2(u, h, p, t) s, c = sincos(t) @@ -1199,6 +1141,32 @@ function fanalytic_dde_DDETST_H234(u₀, ::typeof(h_dde_DDETST_H234), p, t) return sin(t) end +""" + prob_dde_DDETST_H2 + +Delay differential equation + +```math +u'(t) = \\cos(t) (1 + u(t u(t)^2)) + L_3 u(t) u'(t u(t)^2) + (1 - L_3) \\sin(t) \\cos(t \\sin(t)^2) - \\sin(t + t \\sin(t)^2) +``` + +for ``t \\in [0, π]`` with history function ``ϕ(0) = 0`` and ``ϕ'(0) = 1``, where +``L_3 = 0.1``. + +# Solution + +The analytical solution for ``t \\in [0, π]`` is + +```math +u(t) = \\sin(t). +``` + +# References + +Hayashi, H. (1996). Numerical solution of retarded and neutral delay differential equations +using continuous Runge-Kutta methods, PhD thesis, Department of Computer Science, University +of Toronto, Toronto, Canada. +""" const prob_dde_DDETST_H2 = DDEProblem( DDEFunction( f_dde_DDETST_H2; @@ -1210,19 +1178,6 @@ const prob_dde_DDETST_H2 = DDEProblem( ) # Problem H3 -""" - prob_dde_DDETST_H3 - -Same delay differential equation as [`prob_dde_DDETST_H2`](@ref) with ``L_3 = 0.3``. - -# References - -Hayashi, H. (1996). Numerical solution of retarded and neutral delay differential equations -using continuous Runge-Kutta methods, PhD thesis, Department of Computer Science, University -of Toronto, Toronto, Canada. -""" -prob_dde_DDETST_H3 - let L₃ = 0.3 global function f_dde_DDETST_H3(u, h, p, t) s, c = sincos(t) @@ -1234,19 +1189,10 @@ let L₃ = 0.3 end end -const prob_dde_DDETST_H3 = remake( - prob_dde_DDETST_H2; - f = DDEFunction( - f_dde_DDETST_H3; - analytic = fanalytic_dde_DDETST_H234 - ) -) - -# Problem H4 """ - prob_dde_DDETST_H4 + prob_dde_DDETST_H3 -Same delay differential equation as [`prob_dde_DDETST_H2`](@ref) with ``L_3 = 0.5``. +Same delay differential equation as [`prob_dde_DDETST_H2`](@ref) with ``L_3 = 0.3``. # References @@ -1254,8 +1200,15 @@ Hayashi, H. (1996). Numerical solution of retarded and neutral delay differentia using continuous Runge-Kutta methods, PhD thesis, Department of Computer Science, University of Toronto, Toronto, Canada. """ -prob_dde_DDETST_H4 +const prob_dde_DDETST_H3 = remake( + prob_dde_DDETST_H2; + f = DDEFunction( + f_dde_DDETST_H3; + analytic = fanalytic_dde_DDETST_H234 + ) +) +# Problem H4 let L₃ = 0.5 global function f_dde_DDETST_H4(u, h, p, t) s, c = sincos(t) @@ -1267,6 +1220,17 @@ let L₃ = 0.5 end end +""" + prob_dde_DDETST_H4 + +Same delay differential equation as [`prob_dde_DDETST_H2`](@ref) with ``L_3 = 0.5``. + +# References + +Hayashi, H. (1996). Numerical solution of retarded and neutral delay differential equations +using continuous Runge-Kutta methods, PhD thesis, Department of Computer Science, University +of Toronto, Toronto, Canada. +""" const prob_dde_DDETST_H4 = remake( prob_dde_DDETST_H2; f = DDEFunction( diff --git a/lib/DDEProblemLibrary/src/radar5.jl b/lib/DDEProblemLibrary/src/radar5.jl index 1d1a633..985fff6 100644 --- a/lib/DDEProblemLibrary/src/radar5.jl +++ b/lib/DDEProblemLibrary/src/radar5.jl @@ -5,25 +5,67 @@ http://www.unige.ch/~hairer/radar5-v2.1.tar =# # OREGONATOR example -@doc raw""" +let α = 1.8, β = 20, γ = 0.002, r = 50_000, s = 100_000 + global function f_dde_RADAR5_waltman!(du, u, h, p, t) + # time of switches + t₀, t₁ = p.t₀, p.t₁ + + # precalculations + u₁u₂ = u[1] * u[2] + a = r * u₁u₂ + b = s * u[1] * u[4] + + du[1] = -a - b + du[3] = a + + if t < t₀ + du[2] = -a + du[5] = 0 + else + v = h(p, u[5]) + v₁v₂ = v[1] * v[2] + du[2] = -a + α * r * v₁v₂ + du[5] = (u₁u₂ + u[3]) / (v₁v₂ + v[3]) + end + + if t < t₁ + du[4] = -b - γ * u[4] + du[6] = 0 + else + w = h(p, u[6]) + du[4] = -b - γ * u[4] + β * r * w[1] * w[2] + du[6] = (1.0e-12 + u[2] + u[3]) / (1.0e-12 + w[2] + w[3]) + end + + return nothing + end +end + +function h_dde_RADAR5_waltman(p, t) + t ≤ 0 || error("history function is only implemented for t ≤ 0") + + return [p.ϕ₀, 1.0e-15, 0.0, 0.0, 0.0, 0.0] +end + +""" prob_dde_RADAR5_oregonator Delay differential equation model from chemical kinetics, given by ```math -\begin{align*} - u_1'(t) &= - k_1 A u_2(t) - k_2 u_1(t) u_2(t - τ) + k_3 B u_1(t) - 2 k_4 u_1(t)^2, \\ +\\begin{align*} + u_1'(t) &= - k_1 A u_2(t) - k_2 u_1(t) u_2(t - τ) + k_3 B u_1(t) - 2 k_4 u_1(t)^2, \\\\ u_2'(t) &= - k_1 A u_2(t) - k_2 u_1(t) u_2(t - τ) + f k_3 B u_1(t), -\end{align*} +\\end{align*} ``` -for ``t \in [0, 100.5]`` with history function +for ``t \\in [0, 100.5]`` with history function ```math -\begin{align*} - ϕ_1(t) &= 10^{-10}, \\ +\\begin{align*} + ϕ_1(t) &= 10^{-10}, \\\\ ϕ_2(t) &= 10^{-5}, -\end{align*} +\\end{align*} ``` for ``t ≤ 0``, where ``k_1 = 1.34``, ``k_2 = 1.6×10^9``, ``k_3 = 8000``, ``k_4 = 4×10^7``, @@ -70,22 +112,22 @@ const prob_dde_RADAR5_oregonator = let k₁ = 1.34, k₂ = 1.6e9, k₃ = 8_000, end # ROBERTSON example -@doc raw""" +""" prob_dde_RADAR5_robertson Delay differential equation model of a chemical reaction with steady state solution, given by ```math -\begin{align*} - u_1'(t) &= - a u_1(t) + b u_2(t - τ) u_3(t), \\ - u_2'(t) &= a u_1(t) - b u_2(t - τ) u_3(t) - c u_2(t)^2, \\ +\\begin{align*} + u_1'(t) &= - a u_1(t) + b u_2(t - τ) u_3(t), \\\\ + u_2'(t) &= a u_1(t) - b u_2(t - τ) u_3(t) - c u_2(t)^2, \\\\ u_3'(t) &= c u_2(t)^2, -\end{align*} +\\end{align*} ``` -for ``t \in [0, 10^{10}]`` with history function ``ϕ_1(0) = 1``, ``ϕ_2(t) = 0`` for -``t \in [-τ, 0]``, and ``ϕ_3(0) = 0``, where ``a = 0.04``, ``b = 10_000``, +for ``t \\in [0, 10^{10}]`` with history function ``ϕ_1(0) = 1``, ``ϕ_2(t) = 0`` for +``t \\in [-τ, 0]``, and ``ϕ_3(0) = 0``, where ``a = 0.04``, ``b = 10_000``, ``c = 3×10^7``, and ``τ = 0.01``. # References @@ -128,33 +170,33 @@ const prob_dde_RADAR5_robertson = let a = 0.04, b = 10_000, c = 3.0e7, τ = 0.01 end # WALTMAN example -@doc raw""" +""" prob_dde_RADAR5_waltman Delay differential equation model of antibody production, given by ```math -\begin{align*} - u_1'(t) &= - r u_1(t) u_2(t) - s u_1(t) u_4(t), \\ - u_2'(t) &= - r u_1(t) u_2(t) + α r u_1(u_5(t)) u_2(u_5(t)) & [t ≥ t_0], \\ - u_3'(t) &= r u_1(t) u_2(t), \\ - u_4'(t) &= - s u_1(t) u_4(t) - γ u_4(t) + β r u_1(u_6(t)) u_2(u_6(t)) & [t > t_1], \\ - u_5'(t) &= [t ≥ t_0] \frac{u_1(t) u_2(t) + u_3(t)}{u_1(u_5(t)) u_2(u_5(t)) + u_3(u_5(t))}, \\ - u_6'(t) &= [t ≥ t_1] \frac{10^{-12} + u_2(t) + u_3(t)}{10^{-12} + u_2(u_6(t)) + u_3(u_6(t))}, -\end{align*} +\\begin{align*} + u_1'(t) &= - r u_1(t) u_2(t) - s u_1(t) u_4(t), \\\\ + u_2'(t) &= - r u_1(t) u_2(t) + α r u_1(u_5(t)) u_2(u_5(t)) & [t ≥ t_0], \\\\ + u_3'(t) &= r u_1(t) u_2(t), \\\\ + u_4'(t) &= - s u_1(t) u_4(t) - γ u_4(t) + β r u_1(u_6(t)) u_2(u_6(t)) & [t > t_1], \\\\ + u_5'(t) &= [t ≥ t_0] \\frac{u_1(t) u_2(t) + u_3(t)}{u_1(u_5(t)) u_2(u_5(t)) + u_3(u_5(t))}, \\\\ + u_6'(t) &= [t ≥ t_1] \\frac{10^{-12} + u_2(t) + u_3(t)}{10^{-12} + u_2(u_6(t)) + u_3(u_6(t))}, +\\end{align*} ``` -for ``t \in [0, 300]`` with history function +for ``t \\in [0, 300]`` with history function ```math -\begin{align*} +\\begin{align*} ϕ_1(t) &= ϕ_0, & - ϕ_2(t) &= 10^{-15}, \\ + ϕ_2(t) &= 10^{-15}, \\\\ ϕ_3(t) &= 0, & - ϕ_4(t) &= 0, \\ + ϕ_4(t) &= 0, \\\\ ϕ_5(t) &= 0, & ϕ_6(t) &= 0, -\end{align*} +\\end{align*} ``` for ``t ≤ 0``, where ``α = 1.8``, ``β = 20``, ``γ = 0.002``, ``r = 5×10^4``, @@ -165,50 +207,6 @@ for ``t ≤ 0``, where ``α = 1.8``, ``β = 20``, ``γ = 0.002``, ``r = 5×10^4` Waltman, P. (1978). A threshold model of antigen-stimulated antibody production, Theoretical Immunology (8), pp. 437-453. """ -prob_dde_RADAR5_waltman - -let α = 1.8, β = 20, γ = 0.002, r = 50_000, s = 100_000 - global function f_dde_RADAR5_waltman!(du, u, h, p, t) - # time of switches - t₀, t₁ = p.t₀, p.t₁ - - # precalculations - u₁u₂ = u[1] * u[2] - a = r * u₁u₂ - b = s * u[1] * u[4] - - du[1] = -a - b - du[3] = a - - if t < t₀ - du[2] = -a - du[5] = 0 - else - v = h(p, u[5]) - v₁v₂ = v[1] * v[2] - du[2] = -a + α * r * v₁v₂ - du[5] = (u₁u₂ + u[3]) / (v₁v₂ + v[3]) - end - - if t < t₁ - du[4] = -b - γ * u[4] - du[6] = 0 - else - w = h(p, u[6]) - du[4] = -b - γ * u[4] + β * r * w[1] * w[2] - du[6] = (1.0e-12 + u[2] + u[3]) / (1.0e-12 + w[2] + w[3]) - end - - return nothing - end -end - -function h_dde_RADAR5_waltman(p, t) - t ≤ 0 || error("history function is only implemented for t ≤ 0") - - return [p.ϕ₀, 1.0e-15, 0.0, 0.0, 0.0, 0.0] -end - const prob_dde_RADAR5_waltman = DDEProblem( f_dde_RADAR5_waltman!, (p, t) -> h_dde_RADAR5_waltman(p, 0.0), @@ -222,7 +220,7 @@ const prob_dde_RADAR5_waltman = DDEProblem( ) const prob_dde_RADAR5_waltman_1 = prob_dde_RADAR5_waltman -@doc raw""" +""" prob_dde_RADAR5_waltman_2 Same delay differential equation as [`prob_dde_RADAR5_waltman`](@ref) with ``t_0 = 32``, @@ -238,7 +236,7 @@ const prob_dde_RADAR5_waltman_2 = remake( p = (ϕ₀ = 0.5e-4, t₀ = 32, t₁ = 111) ) -@doc raw""" +""" prob_dde_RADAR5_waltman_3 Same delay differential equation as [`prob_dde_RADAR5_waltman`](@ref) with ``t_0 = 33``, @@ -254,7 +252,7 @@ const prob_dde_RADAR5_waltman_3 = remake( p = (ϕ₀ = 1.0e-5, t₀ = 33, t₁ = 145) ) -@doc raw""" +""" prob_dde_RADAR5_waltman_4 Same delay differential equation as [`prob_dde_RADAR5_waltman`](@ref) with ``t_0 = 34``, @@ -270,7 +268,7 @@ const prob_dde_RADAR5_waltman_4 = remake( p = (ϕ₀ = 0.75e-5, t₀ = 34, t₁ = 163) ) -@doc raw""" +""" prob_dde_RADAR5_waltman_5 Same delay differential equation as [`prob_dde_RADAR5_waltman`](@ref) with ``t_0 = 35``, diff --git a/lib/DDEProblemLibrary/test/qa/Project.toml b/lib/DDEProblemLibrary/test/qa/Project.toml index a621ad7..22cc517 100644 --- a/lib/DDEProblemLibrary/test/qa/Project.toml +++ b/lib/DDEProblemLibrary/test/qa/Project.toml @@ -7,6 +7,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Aqua = "0.8" DDEProblemLibrary = "0.1" -SciMLTesting = "2.1" +SciMLTesting = "2.4" Test = "1.10" julia = "1.10" diff --git a/lib/DDEProblemLibrary/test/qa/qa.jl b/lib/DDEProblemLibrary/test/qa/qa.jl index 10c3fbb..c23fc50 100644 --- a/lib/DDEProblemLibrary/test/qa/qa.jl +++ b/lib/DDEProblemLibrary/test/qa/qa.jl @@ -1,3 +1,3 @@ using SciMLTesting, DDEProblemLibrary, Test -run_qa(DDEProblemLibrary; explicit_imports = true, aqua_kwargs = (; ambiguities = false)) +run_qa(DDEProblemLibrary) diff --git a/lib/DDEProblemLibrary/test/runtests.jl b/lib/DDEProblemLibrary/test/runtests.jl index 763e0a6..74c45bc 100644 --- a/lib/DDEProblemLibrary/test/runtests.jl +++ b/lib/DDEProblemLibrary/test/runtests.jl @@ -18,7 +18,6 @@ if TEST_GROUP == "Core" || TEST_GROUP == "All" end # Quality assurance: no undefined exports, stale dependencies, etc. -# Ambiguity checks are disabled since tests fail due to ambiguities in dependencies. if TEST_GROUP == "QA" || TEST_GROUP == "All" activate_qa_env() @time @safetestset "Aqua" include("qa/qa.jl") diff --git a/lib/JumpProblemLibrary/docs/Project.toml b/lib/JumpProblemLibrary/docs/Project.toml new file mode 100644 index 0000000..6c9a7a3 --- /dev/null +++ b/lib/JumpProblemLibrary/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +JumpProblemLibrary = "faf0f6d7-8cee-47cb-b27c-1eb80cef534e" + +[compat] +Documenter = "1" +JumpProblemLibrary = "2" +julia = "1.10" diff --git a/lib/JumpProblemLibrary/docs/make.jl b/lib/JumpProblemLibrary/docs/make.jl new file mode 100644 index 0000000..512c634 --- /dev/null +++ b/lib/JumpProblemLibrary/docs/make.jl @@ -0,0 +1,5 @@ +using Documenter, JumpProblemLibrary + +makedocs( + ; sitename = "JumpProblemLibrary.jl", modules = [JumpProblemLibrary], checkdocs = :exports +) diff --git a/lib/JumpProblemLibrary/docs/src/index.md b/lib/JumpProblemLibrary/docs/src/index.md new file mode 100644 index 0000000..a9f9eb7 --- /dev/null +++ b/lib/JumpProblemLibrary/docs/src/index.md @@ -0,0 +1,11 @@ +# JumpProblemLibrary.jl + +Premade jump-process problems for testing and benchmarking jump solvers. + +## Public API + +```@autodocs +Modules = [JumpProblemLibrary] +Public = true +Private = false +``` diff --git a/lib/JumpProblemLibrary/test/qa/Project.toml b/lib/JumpProblemLibrary/test/qa/Project.toml index 34599b9..1f3821d 100644 --- a/lib/JumpProblemLibrary/test/qa/Project.toml +++ b/lib/JumpProblemLibrary/test/qa/Project.toml @@ -7,6 +7,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Aqua = "0.8" JumpProblemLibrary = "2" -SciMLTesting = "2.1" +SciMLTesting = "2.4" Test = "1.10" julia = "1.10" diff --git a/lib/JumpProblemLibrary/test/qa/qa.jl b/lib/JumpProblemLibrary/test/qa/qa.jl index ed40700..060ec31 100644 --- a/lib/JumpProblemLibrary/test/qa/qa.jl +++ b/lib/JumpProblemLibrary/test/qa/qa.jl @@ -1,6 +1,3 @@ using SciMLTesting, JumpProblemLibrary, Test -run_qa( - JumpProblemLibrary; explicit_imports = true, - aqua_kwargs = (; ambiguities = false, persistent_tasks = false) -) +run_qa(JumpProblemLibrary) diff --git a/lib/JumpProblemLibrary/test/runtests.jl b/lib/JumpProblemLibrary/test/runtests.jl index 9c66c71..c542586 100644 --- a/lib/JumpProblemLibrary/test/runtests.jl +++ b/lib/JumpProblemLibrary/test/runtests.jl @@ -18,7 +18,6 @@ if TEST_GROUP == "Core" || TEST_GROUP == "All" end # Quality assurance: no undefined exports, stale dependencies, etc. -# Ambiguity checks are disabled since tests fail due to ambiguities in dependencies. if TEST_GROUP == "QA" || TEST_GROUP == "All" activate_qa_env() @time @safetestset "Aqua" include("qa/qa.jl") diff --git a/lib/NonlinearProblemLibrary/docs/Project.toml b/lib/NonlinearProblemLibrary/docs/Project.toml new file mode 100644 index 0000000..b2f251c --- /dev/null +++ b/lib/NonlinearProblemLibrary/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +NonlinearProblemLibrary = "b7050fa9-e91f-4b37-bcee-a89a063da141" + +[compat] +Documenter = "1" +NonlinearProblemLibrary = "0.1" +julia = "1.10" diff --git a/lib/NonlinearProblemLibrary/docs/make.jl b/lib/NonlinearProblemLibrary/docs/make.jl new file mode 100644 index 0000000..4ebd90d --- /dev/null +++ b/lib/NonlinearProblemLibrary/docs/make.jl @@ -0,0 +1,5 @@ +using Documenter, NonlinearProblemLibrary + +makedocs( + ; sitename = "NonlinearProblemLibrary.jl", modules = [NonlinearProblemLibrary], checkdocs = :exports +) diff --git a/lib/NonlinearProblemLibrary/docs/src/index.md b/lib/NonlinearProblemLibrary/docs/src/index.md new file mode 100644 index 0000000..260e2a4 --- /dev/null +++ b/lib/NonlinearProblemLibrary/docs/src/index.md @@ -0,0 +1,11 @@ +# NonlinearProblemLibrary.jl + +Premade nonlinear systems for testing and benchmarking nonlinear solvers. + +## Public API + +```@autodocs +Modules = [NonlinearProblemLibrary] +Public = true +Private = false +``` diff --git a/lib/NonlinearProblemLibrary/test/qa/Project.toml b/lib/NonlinearProblemLibrary/test/qa/Project.toml index d7eb98a..8ce592d 100644 --- a/lib/NonlinearProblemLibrary/test/qa/Project.toml +++ b/lib/NonlinearProblemLibrary/test/qa/Project.toml @@ -9,6 +9,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" AllocCheck = "0.2" Aqua = "0.8" NonlinearProblemLibrary = "0.1" -SciMLTesting = "2.1" +SciMLTesting = "2.4" Test = "1" julia = "1.10" diff --git a/lib/NonlinearProblemLibrary/test/qa/qa.jl b/lib/NonlinearProblemLibrary/test/qa/qa.jl index 5c4dc61..2ca92bd 100644 --- a/lib/NonlinearProblemLibrary/test/qa/qa.jl +++ b/lib/NonlinearProblemLibrary/test/qa/qa.jl @@ -1,3 +1,3 @@ using SciMLTesting, NonlinearProblemLibrary, Test -run_qa(NonlinearProblemLibrary; explicit_imports = true, aqua_kwargs = (; ambiguities = false)) +run_qa(NonlinearProblemLibrary) diff --git a/lib/ODEProblemLibrary/Project.toml b/lib/ODEProblemLibrary/Project.toml index cfe7979..51a8b88 100644 --- a/lib/ODEProblemLibrary/Project.toml +++ b/lib/ODEProblemLibrary/Project.toml @@ -5,13 +5,11 @@ version = "1.5.2" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [compat] DiffEqBase = "6, 7" LinearAlgebra = "1.10" -Markdown = "1.10" Pkg = "1.10" Random = "1.10" SafeTestsets = "0.1" diff --git a/lib/ODEProblemLibrary/docs/Project.toml b/lib/ODEProblemLibrary/docs/Project.toml new file mode 100644 index 0000000..7ac4daa --- /dev/null +++ b/lib/ODEProblemLibrary/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" + +[compat] +Documenter = "1" +ODEProblemLibrary = "1" +julia = "1.10" diff --git a/lib/ODEProblemLibrary/docs/make.jl b/lib/ODEProblemLibrary/docs/make.jl new file mode 100644 index 0000000..d7f8354 --- /dev/null +++ b/lib/ODEProblemLibrary/docs/make.jl @@ -0,0 +1,5 @@ +using Documenter, ODEProblemLibrary + +makedocs( + ; sitename = "ODEProblemLibrary.jl", modules = [ODEProblemLibrary], checkdocs = :exports +) diff --git a/lib/ODEProblemLibrary/docs/src/index.md b/lib/ODEProblemLibrary/docs/src/index.md new file mode 100644 index 0000000..264d72f --- /dev/null +++ b/lib/ODEProblemLibrary/docs/src/index.md @@ -0,0 +1,11 @@ +# ODEProblemLibrary.jl + +Premade ordinary differential equation problems for testing and benchmarking ODE solvers. + +## Public API + +```@autodocs +Modules = [ODEProblemLibrary] +Public = true +Private = false +``` diff --git a/lib/ODEProblemLibrary/src/ODEProblemLibrary.jl b/lib/ODEProblemLibrary/src/ODEProblemLibrary.jl index bf022ee..cc671e2 100644 --- a/lib/ODEProblemLibrary/src/ODEProblemLibrary.jl +++ b/lib/ODEProblemLibrary/src/ODEProblemLibrary.jl @@ -2,7 +2,6 @@ module ODEProblemLibrary using DiffEqBase: DiffEqBase, ODEFunction, ODEProblem using LinearAlgebra: LinearAlgebra, Diagonal, I, SymTridiagonal, diagind, ldiv!, mul!, rmul! -using Markdown: Markdown, @doc_str using Random: Random Random.seed!(100) diff --git a/lib/ODEProblemLibrary/src/brusselator_prob.jl b/lib/ODEProblemLibrary/src/brusselator_prob.jl index 703092c..eab0475 100644 --- a/lib/ODEProblemLibrary/src/brusselator_prob.jl +++ b/lib/ODEProblemLibrary/src/brusselator_prob.jl @@ -61,41 +61,41 @@ function init_brusselator_2d(xyd) end xyd_brusselator = range(0, stop = 1, length = 32) -@doc doc""" +""" 2D Brusselator ```math -\begin{align*} -\frac{∂u}{∂t} &= 1 + u^2v - 4.4u + α\left(\frac{∂^2 u}{∂x^2} + \frac{∂^2 u}{∂y^2}\right) + f(x, y, t) \\ -\frac{∂v}{∂t} &= 3.4u - u^2v + α\left(\frac{∂^2 u}{∂x^2} + \frac{∂^2 u}{∂y^2}\right) -\end{align*} +\\begin{align*} +\\frac{∂u}{∂t} &= 1 + u^2v - 4.4u + α\\left(\\frac{∂^2 u}{∂x^2} + \\frac{∂^2 u}{∂y^2}\\right) + f(x, y, t) \\\\ +\\frac{∂v}{∂t} &= 3.4u - u^2v + α\\left(\\frac{∂^2 u}{∂x^2} + \\frac{∂^2 u}{∂y^2}\\right) +\\end{align*} ``` where ```math -f(x, y, t) = \begin{cases} - 5 & \text{if } (x-0.3)^2+(y-0.6)^2 ≤ 0.1^2 \text{ and } t ≥ 1.1 \\ - 0 & \text{else} -\end{cases} +f(x, y, t) = \\begin{cases} + 5 & \\text{if } (x-0.3)^2+(y-0.6)^2 ≤ 0.1^2 \\text{ and } t ≥ 1.1 \\\\ + 0 & \\text{else} +\\end{cases} ``` and the initial conditions are ```math -\begin{align*} -u(x, y, 0) &= 22 ⋅ y(1-y)^{3/2} \\ +\\begin{align*} +u(x, y, 0) &= 22 ⋅ y(1-y)^{3/2} \\\\ v(x, y, 0) &= 27 ⋅ x(1-x)^{3/2} -\end{align*} +\\end{align*} ``` with the periodic boundary condition ```math -\begin{align*} -u(x+1,y,t) &= u(x,y,t) \\ +\\begin{align*} +u(x+1,y,t) &= u(x,y,t) \\\\ u(x,y+1,t) &= u(x,y,t) -\end{align*} +\\end{align*} ``` From Hairer Norsett Wanner Solving Ordinary Differential Equations II - Stiff and Differential-Algebraic Problems Page 152 @@ -137,32 +137,32 @@ function init_brusselator_1d(N) return u end -@doc doc""" +""" 1D Brusselator ```math -\begin{align*} -\frac{∂u}{∂t} &= A - (B+1) u + u^2 v + α \frac{∂^2 u}{∂x^2} \\ -\frac{∂v}{∂t} &= B u - u^2 v + α \frac{∂^2 u}{∂x^2} -\end{align*} +\\begin{align*} +\\frac{∂u}{∂t} &= A - (B+1) u + u^2 v + α \\frac{∂^2 u}{∂x^2} \\\\ +\\frac{∂v}{∂t} &= B u - u^2 v + α \\frac{∂^2 u}{∂x^2} +\\end{align*} ``` and the initial conditions are ```math -\begin{align*} -u(x,0) &= 1 + \sin(2πx) \\ +\\begin{align*} +u(x,0) &= 1 + \\sin(2πx) \\\\ v(x,0) &= 3 -\end{align*} +\\end{align*} ``` with periodic boundary conditions ```math -\begin{align*} -u(0,t) &= u(1,t) \\ +\\begin{align*} +u(0,t) &= u(1,t) \\\\ v(0,t) &= v(1,t) -\end{align*} +\\end{align*} ``` From Hairer Norsett Wanner Solving Ordinary Differential Equations II - Stiff and Differential-Algebraic Problems Page 6 diff --git a/lib/ODEProblemLibrary/src/nonlinchem.jl b/lib/ODEProblemLibrary/src/nonlinchem.jl index f087b01..4302c48 100644 --- a/lib/ODEProblemLibrary/src/nonlinchem.jl +++ b/lib/ODEProblemLibrary/src/nonlinchem.jl @@ -29,18 +29,18 @@ function nlc_analytic(u0, p, t) end nonLinChem_f = ODEFunction(nonLinChem, analytic = nlc_analytic) -@doc doc""" +""" Nonlinear system of reactions with an analytical solution ```math -\begin{align*} -\frac{dy_1}{dt} &= -y_1 \\ -\frac{dy_2}{dt} &= y_1 - y_2^2 \\ -\frac{dy_3}{dt} &= y_2^2 -\end{align*} +\\begin{align*} +\\frac{dy_1}{dt} &= -y_1 \\\\ +\\frac{dy_2}{dt} &= y_1 - y_2^2 \\\\ +\\frac{dy_3}{dt} &= y_2^2 +\\end{align*} ``` -with initial condition ``y=[1;0;0]`` on a time span of ``t \in (0,20)`` +with initial condition ``y=[1;0;0]`` on a time span of ``t \\in (0,20)`` From diff --git a/lib/ODEProblemLibrary/src/ode_linear_prob.jl b/lib/ODEProblemLibrary/src/ode_linear_prob.jl index 01ec3f0..ce3a64e 100644 --- a/lib/ODEProblemLibrary/src/ode_linear_prob.jl +++ b/lib/ODEProblemLibrary/src/ode_linear_prob.jl @@ -1,14 +1,14 @@ # Linear ODE linear = (u, p, t) -> (p * u) linear_analytic = (u0, p, t) -> u0 * exp(p * t) -@doc doc""" +""" Linear ODE ```math -\frac{du}{dt} = αu +\\frac{du}{dt} = αu ``` -with initial condition ``u_0=\frac{1}{2}``, ``α=1.01``, and solution +with initial condition ``u_0=\\frac{1}{2}``, ``α=1.01``, and solution ```math u(t) = u_0 e^{αt} @@ -21,14 +21,14 @@ prob_ode_linear = ODEProblem( 1 / 2, (0.0, 1.0), 1.01 ) -@doc doc""" +""" Linear ODE ```math -\frac{du}{dt} = αu +\\frac{du}{dt} = αu ``` -with initial condition ``u_0=\frac{1}{2}``, ``α=1.01``, and solution +with initial condition ``u_0=\\frac{1}{2}``, ``α=1.01``, and solution ```math u(t) = u_0 e^{αt} @@ -43,11 +43,11 @@ prob_ode_bigfloatlinear = ODEProblem( f_2dlinear = (du, u, p, t) -> (@. du = p * u) f_2dlinear_analytic = (u0, p, t) -> @. u0 * exp(p * t) -@doc doc""" +""" 4×2 version of the Linear ODE ```math -\frac{du}{dt} = αu +\\frac{du}{dt} = αu ``` with initial condition ``u_0`` as all uniformly distributed random numbers, @@ -64,11 +64,11 @@ prob_ode_2Dlinear = ODEProblem( rand(4, 2), (0.0, 1.0), 1.01 ) -@doc doc""" +""" 100×100 version of the Linear ODE ```math -\frac{du}{dt} = αu +\\frac{du}{dt} = αu ``` with initial condition ``u_0`` as all uniformly distributed random numbers, @@ -85,11 +85,11 @@ prob_ode_large2Dlinear = ODEProblem( rand(100, 100), (0.0, 1.0), 1.01 ) -@doc doc""" +""" 4×2 version of the Linear ODE ```math -\frac{du}{dt} = αu +\\frac{du}{dt} = αu ``` with initial condition ``u_0`` as all uniformly distributed random numbers, @@ -111,11 +111,11 @@ prob_ode_bigfloat2Dlinear = ODEProblem( ) f_2dlinear_notinplace = (u, p, t) -> p * u -@doc doc""" +""" 4×2 version of the Linear ODE ```math -\frac{du}{dt} = αu +\\frac{du}{dt} = αu ``` with initial condition ``u_0`` as all uniformly distributed random numbers, diff --git a/lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl b/lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl index 0df7586..7e5f54d 100644 --- a/lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl +++ b/lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl @@ -7,14 +7,14 @@ function lotka(du, u, p, t) return du[2] = -p[3] * y + p[4] * x * y end -@doc doc""" +""" Lotka-Volterra Equations (Non-stiff) ```math -\begin{align*} -\frac{dx}{dt} &= ax - bxy \\ -\frac{dy}{dt} &= -cy + dxy \\ -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= ax - bxy \\\\ +\\frac{dy}{dt} &= -cy + dxy \\\\ +\\end{align*} ``` with initial condition ``x=y=1`` @@ -33,14 +33,14 @@ function fitz(du, u, p, t) du[1] = v - v^3 / 3 - w + l return du[2] = τinv * (v + a - b * w) end -@doc doc""" +""" Fitzhugh-Nagumo (Non-stiff) ```math -\begin{align*} -\frac{dv}{dt} &= v - \frac{v^3}{3} - w + I_{est} \\ -τ \frac{dw}{dt} &= v + a -bw -\end{align*} +\\begin{align*} +\\frac{dv}{dt} &= v - \\frac{v^3}{3} - w + I_{est} \\\\ +τ \\frac{dw}{dt} &= v + a -bw +\\end{align*} ``` with initial condition ``v=w=1`` @@ -70,17 +70,17 @@ function vanderpol_jac(J, u, p, t) return J[2, 2] = μ * (1 - x^2) end -@doc doc""" +""" Van der Pol Equations ```math -\begin{align*} -\frac{dx}{dt} &= y \\ -\frac{dy}{dt} &= μ \left(\left(1-x^2\right) y - x\right) -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= y \\\\ +\\frac{dy}{dt} &= μ \\left(\\left(1-x^2\\right) y - x\\right) +\\end{align*} ``` -with ``μ=1.0`` and ``u_0=[\sqrt{3}, 0]`` (where ``u[1] = x``, ``u[2] = y``) +with ``μ=1.0`` and ``u_0=[\\sqrt{3}, 0]`` (where ``u[1] = x``, ``u[2] = y``) Non-stiff parameters. """ @@ -89,17 +89,17 @@ prob_ode_vanderpol = ODEProblem( [sqrt(3), 0.0], (0.0, 1.0), [1.0] ) -@doc doc""" +""" Van der Pol Equations ```math -\begin{align*} -\frac{dx}{dt} &= y \\ -\frac{dy}{dt} &= μ \left(\left(1 - x^2\right) y - x\right) -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= y \\\\ +\\frac{dy}{dt} &= μ \\left(\\left(1 - x^2\\right) y - x\\right) +\\end{align*} ``` -with ``μ=10^6`` and ``u_0=[\sqrt{3}, 0]`` (where ``u[1] = x``, ``u[2] = y``) +with ``μ=10^6`` and ``u_0=[\\sqrt{3}, 0]`` (where ``u[1] = x``, ``u[2] = y``) Stiff parameters. """ @@ -119,15 +119,15 @@ function rober(du, u, p, t) return du[3] = k₂ * y₂^2 end -@doc doc""" +""" The Robertson biochemical reactions: (Stiff) ```math -\begin{align*} -\frac{dy₁}{dt} &= -k₁y₁ + k₃y₂y₃ \\ -\frac{dy₂}{dt} &= k₁y₁ - k₂y₂^2 - k₃y₂y₃ \\ -\frac{dy₃}{dt} &= k₂y₂^2 -\end{align*} +\\begin{align*} +\\frac{dy₁}{dt} &= -k₁y₁ + k₃y₂y₃ \\\\ +\\frac{dy₂}{dt} &= k₁y₁ - k₂y₂^2 - k₃y₂y₃ \\\\ +\\frac{dy₃}{dt} &= k₂y₂^2 +\\end{align*} ``` where ``k₁=0.04``, ``k₂=3×10^7``, ``k₃=10^4``. For details, see: @@ -161,22 +161,22 @@ threebody = ( du[4] = u[2] - 2u[3] - threebody_μ′ * u[2] / D₁ - threebody_μ * u[2] / D₂ end -@doc doc""" +""" The ThreeBody problem as written by Hairer: (Non-stiff) ```math -\begin{align*} -\frac{dy₁}{dt} &= y₁ + 2\frac{dy₂}{dt} - \bar{μ}\frac{y₁+μ}{D₁} - μ\frac{y₁-\bar{μ}}{D₂} \\ -\frac{dy₂}{dt} &= y₂ - 2\frac{dy₁}{dt} - \bar{μ}\frac{y₂}{D₁} - μ\frac{y₂}{D₂} -\end{align*} +\\begin{align*} +\\frac{dy₁}{dt} &= y₁ + 2\\frac{dy₂}{dt} - \\bar{μ}\\frac{y₁+μ}{D₁} - μ\\frac{y₁-\\bar{μ}}{D₂} \\\\ +\\frac{dy₂}{dt} &= y₂ - 2\\frac{dy₁}{dt} - \\bar{μ}\\frac{y₂}{D₁} - μ\\frac{y₂}{D₂} +\\end{align*} ``` ```math -\begin{align*} -D₁ &= \left((y₁+μ)^2 + y₂^2\right)^{3/2} \\ -D₂ &= \left((y₁-\bar{μ})^2 + y₂^2\right)^{3/2} \\ -μ &= 0.012277471 \\ -\bar{μ} &= 1-μ -\end{align*} +\\begin{align*} +D₁ &= \\left((y₁+μ)^2 + y₂^2\\right)^{3/2} \\\\ +D₂ &= \\left((y₁-\\bar{μ})^2 + y₂^2\\right)^{3/2} \\\\ +μ &= 0.012277471 \\\\ +\\bar{μ} &= 1-μ +\\end{align*} ``` From Hairer Norsett Wanner Solving Ordinary Differential Equations I - Nonstiff Problems Page 129 @@ -204,15 +204,15 @@ function rigidbody(du, u, p, t) return du[3] = I₃ * y₁ * y₂ end -@doc doc""" +""" Rigid Body Equations (Non-stiff) ```math -\begin{align*} -\frac{dy₁}{dt} &= I₁y₂y₃ \\ -\frac{dy₂}{dt} &= I₂y₁y₃ \\ -\frac{dy₃}{dt} &= I₃y₁y₂ -\end{align*} +\\begin{align*} +\\frac{dy₁}{dt} &= I₁y₂y₃ \\\\ +\\frac{dy₂}{dt} &= I₂y₁y₃ \\\\ +\\frac{dy₃}{dt} &= I₃y₁y₂ +\\end{align*} ``` with ``I₁=-2``, ``I₂=1.25``, and ``I₃=-1/2``. @@ -248,45 +248,45 @@ pleiades = (du, u, p, t) -> begin end end -@doc doc""" +""" Pleiades Problem (Non-stiff) ```math -\begin{align*} -\frac{d^2xᵢ}{dt^2} &= \sum_{j≠i} mⱼ(xⱼ-xᵢ)/rᵢⱼ \\ -\frac{d^2yᵢ}{dt^2} &= \sum_{j≠i} mⱼ(yⱼ-yᵢ)/rᵢⱼ -\end{align*} +\\begin{align*} +\\frac{d^2xᵢ}{dt^2} &= \\sum_{j≠i} mⱼ(xⱼ-xᵢ)/rᵢⱼ \\\\ +\\frac{d^2yᵢ}{dt^2} &= \\sum_{j≠i} mⱼ(yⱼ-yᵢ)/rᵢⱼ +\\end{align*} ``` where ```math -rᵢⱼ = \left((xᵢ-xⱼ)^2 + (yᵢ-yⱼ)^2\right)^{3/2} +rᵢⱼ = \\left((xᵢ-xⱼ)^2 + (yᵢ-yⱼ)^2\\right)^{3/2} ``` and initial conditions are ```math -\begin{align*} -x₁(0) &= 3, & y₁(0) &= 3, \\ -x₂(0) &= 3, & y₂(0) &= -3, \\ -x₃(0) &= -1, & y₃(0) &= 2, \\ -x₄(0) &= -3, & y₄(0) &= 0, \\ -x₅(0) &= 2, & y₅(0) &= 0, \\ -x₆(0) &= -2, & y₆(0) &= -4, \\ +\\begin{align*} +x₁(0) &= 3, & y₁(0) &= 3, \\\\ +x₂(0) &= 3, & y₂(0) &= -3, \\\\ +x₃(0) &= -1, & y₃(0) &= 2, \\\\ +x₄(0) &= -3, & y₄(0) &= 0, \\\\ +x₅(0) &= 2, & y₅(0) &= 0, \\\\ +x₆(0) &= -2, & y₆(0) &= -4, \\\\ x₇(0) &= 2, & y₇(0) &= 4 -\end{align*} +\\end{align*} ``` -and with ``\frac{dxᵢ(0)}{dt} = \frac{dyᵢ(0)}{dt} = 0`` except for +and with ``\\frac{dxᵢ(0)}{dt} = \\frac{dyᵢ(0)}{dt} = 0`` except for ```math -\begin{align*} -\frac{dx₆(0)}{dt} &= 1.75, & -\frac{dx₇(0)}{dt} &= -1.5, \\ -\frac{dy₄(0)}{dt} &= -1.25, & -\frac{dy₅(0)}{dt} &= 1 -\end{align*} +\\begin{align*} +\\frac{dx₆(0)}{dt} &= 1.75, & +\\frac{dx₇(0)}{dt} &= -1.5, \\\\ +\\frac{dy₄(0)}{dt} &= -1.25, & +\\frac{dy₅(0)}{dt} &= 1 +\\end{align*} ``` From Hairer Norsett Wanner Solving Ordinary Differential Equations I - Nonstiff Problems Page 244 @@ -375,34 +375,34 @@ u0[8] = 0.0057 p = (1.71, 0.43, 8.32, 0.0007, 8.75, 10.03, 0.035, 1.12, 1.745, 280.0, 0.69, 1.81) -@doc doc""" +""" Hires Problem (Stiff) It is in the form of ```math -\frac{dy}{dt} = f(y) +\\frac{dy}{dt} = f(y) ``` with ```math - y(0)=y_0, \quad y \in ℝ^8, \quad 0 ≤ t ≤ 321.8122 + y(0)=y_0, \\quad y \\in ℝ^8, \\quad 0 ≤ t ≤ 321.8122 ``` where ``f`` is defined by ```math -f(y) = \begin{pmatrix} -−1.71y_1 + 0.43y_2 + 8.32y_3 + 0.0007y_4 \\ - 1.71y_1 − 8.75y_2 \\ -−10.03y_3 + 0.43y_4 + 0.035y_5 \\ - 8.32y_2 + 1.71y_3 − 1.12y_4 \\ -−1.745y_5 + 0.43y_6 + 0.43y_7 \\ -−280y_6y_8 + 0.69y_4 + 1.71y_5 − 0.43y_6 + 0.69y_7 \\ - 280y_6y_8 − 1.81y_7 \\ +f(y) = \\begin{pmatrix} +−1.71y_1 + 0.43y_2 + 8.32y_3 + 0.0007y_4 \\\\ + 1.71y_1 − 8.75y_2 \\\\ +−10.03y_3 + 0.43y_4 + 0.035y_5 \\\\ + 8.32y_2 + 1.71y_3 − 1.12y_4 \\\\ +−1.745y_5 + 0.43y_6 + 0.43y_7 \\\\ +−280y_6y_8 + 0.69y_4 + 1.71y_5 − 0.43y_6 + 0.69y_7 \\\\ + 280y_6y_8 − 1.81y_7 \\\\ −280y_6y_8 + 1.81y_7 -\end{pmatrix} +\\end{pmatrix} ``` Reference: [demohires.pdf](http://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoHires/demohires.pdf) @@ -421,23 +421,23 @@ function orego(du, u, p, t) return du[3] = p3 * (y1 - y3) end -@doc doc""" +""" Orego Problem (Stiff) -It is in the form of ``\frac{dy}{dt}=f(y), \quad y(0)=y_0,`` with +It is in the form of ``\\frac{dy}{dt}=f(y), \\quad y(0)=y_0,`` with ```math -y \in ℝ^3, \quad 0 ≤ t ≤ 360 +y \\in ℝ^3, \\quad 0 ≤ t ≤ 360 ``` where ``f`` is defined by ```math -f(y) = \begin{pmatrix} -s(y_2 - y_1 (1 - q y_1 - y_2)) \\ -(y_3 - y_2 (1 + y_1)) / s \\ +f(y) = \\begin{pmatrix} +s(y_2 - y_1 (1 - q y_1 - y_2)) \\\\ +(y_3 - y_2 (1 + y_1)) / s \\\\ w (y_1 - y_3) -\end{pmatrix} +\\end{pmatrix} ``` where ``s=77.27``, ``w=0.161`` and ``q=8.375×10^{-6}``. diff --git a/lib/ODEProblemLibrary/src/pollution_prob.jl b/lib/ODEProblemLibrary/src/pollution_prob.jl index f8be0bb..b7c78e9 100644 --- a/lib/ODEProblemLibrary/src/pollution_prob.jl +++ b/lib/ODEProblemLibrary/src/pollution_prob.jl @@ -188,46 +188,46 @@ u0[8] = 0.3 u0[9] = 0.01 u0[17] = 0.007 -@doc doc""" +""" Pollution Problem (Stiff) This IVP is a stiff system of 20 non-linear Ordinary Differential Equations. It is in the form of ```math -\frac{dy}{dt}=f(y) +\\frac{dy}{dt}=f(y) ``` with ```math -y(0)=y_0, \quad y \in ℝ^{20}, \quad 0 ≤ t ≤ 60 +y(0)=y_0, \\quad y \\in ℝ^{20}, \\quad 0 ≤ t ≤ 60 ``` where ``f`` is defined by ```math -f(y) = \begin{pmatrix} --\sum_{j\in{1,10,14,23,24}} r_j + \sum_{j\in{2,3,9,11,12,22,25}} r_j \\ --r_2 - r_3 - r_9 - r_12 + r_1 + r_{21} \\ --r_{15} + r_1 + r_{17} + r_{19} + r_{22} \\ --r_2 - r_{16} - r_{17} - r_{23} + r_{15} \\ --r_3 + 2r_4 + r_6 + r_7 + r_{13} + r_{20} \\ --r_6 - r_8 - r_{14} - r_{20} + r_3 + 2r_{18} \\ --r_4 - r_5 - r_6 + r_{13} \\ -r_4 + r_5 + r_6 + r_7 \\ --r_7 - r_8 \\ --r_{12} + r_7 + r_9 \\ --r_9 - r_{10} + r_8 + r_{11} \\ -r_9 \\ --r_{11} + r_{10} \\ --r_{13} + r_{12} \\ -r_{14} \\ --r_{18} - r_{19} + r_{16} \\ --r_{20} \\ -r_{20} \\ --r_{21} - r_{22} - r_{24} + r_{23} + r_{25} \\ +f(y) = \\begin{pmatrix} +-\\sum_{j\\in{1,10,14,23,24}} r_j + \\sum_{j\\in{2,3,9,11,12,22,25}} r_j \\\\ +-r_2 - r_3 - r_9 - r_12 + r_1 + r_{21} \\\\ +-r_{15} + r_1 + r_{17} + r_{19} + r_{22} \\\\ +-r_2 - r_{16} - r_{17} - r_{23} + r_{15} \\\\ +-r_3 + 2r_4 + r_6 + r_7 + r_{13} + r_{20} \\\\ +-r_6 - r_8 - r_{14} - r_{20} + r_3 + 2r_{18} \\\\ +-r_4 - r_5 - r_6 + r_{13} \\\\ +r_4 + r_5 + r_6 + r_7 \\\\ +-r_7 - r_8 \\\\ +-r_{12} + r_7 + r_9 \\\\ +-r_9 - r_{10} + r_8 + r_{11} \\\\ +r_9 \\\\ +-r_{11} + r_{10} \\\\ +-r_{13} + r_{12} \\\\ +r_{14} \\\\ +-r_{18} - r_{19} + r_{16} \\\\ +-r_{20} \\\\ +r_{20} \\\\ +-r_{21} - r_{22} - r_{24} + r_{23} + r_{25} \\\\ -r_{25} + r_{24} -\end{pmatrix} +\\end{pmatrix} ``` with the initial condition of diff --git a/lib/ODEProblemLibrary/src/strange_attractors.jl b/lib/ODEProblemLibrary/src/strange_attractors.jl index a85cba2..633cfad 100644 --- a/lib/ODEProblemLibrary/src/strange_attractors.jl +++ b/lib/ODEProblemLibrary/src/strange_attractors.jl @@ -27,15 +27,15 @@ prob = prob_ode_thomas ``` """ thomas = ODEFunction(thomas_eqs) -@doc doc""" +""" Thomas' cyclically symmetric attractor equations ```math -\begin{align*} -\frac{dx}{dt} &= \sin(y) - bx \\ -\frac{dy}{dt} &= \sin(z) - by \\ -\frac{dz}{dt} &= \sin(x) - bz -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= \\sin(y) - bx \\\\ +\\frac{dy}{dt} &= \\sin(z) - by \\\\ +\\frac{dz}{dt} &= \\sin(x) - bz +\\end{align*} ``` with parameter ``b = 0.208186`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -71,15 +71,15 @@ prob = prob_ode_lorenz ``` """ lorenz = ODEFunction(lorenz_eqs) -@doc doc""" +""" Lorenz equations ```math -\begin{align*} -\frac{dx}{dt} &= σ(y - x) \\ -\frac{dy}{dt} &= x(ρ - z) - y \\ -\frac{dz}{dt} &= xy - βz -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= σ(y - x) \\\\ +\\frac{dy}{dt} &= x(ρ - z) - y \\\\ +\\frac{dz}{dt} &= xy - βz +\\end{align*} ``` with parameters ``σ=10, ρ=28, β=8/3`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -115,15 +115,15 @@ prob = prob_ode_aizawa ``` """ aizawa = ODEFunction(aizawa_eqs) -@doc doc""" +""" Aizawa equations ```math -\begin{align*} -\frac{dx}{dt} &= (z - b)x - dy \\ -\frac{dy}{dt} &= dx + (z - b)y \\ -\frac{dz}{dt} &= c + az - \frac{z^3}{3} - (x^2 + y^2)(1 + ez) + fzx^3 -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= (z - b)x - dy \\\\ +\\frac{dy}{dt} &= dx + (z - b)y \\\\ +\\frac{dz}{dt} &= c + az - \\frac{z^3}{3} - (x^2 + y^2)(1 + ez) + fzx^3 +\\end{align*} ``` with parameters ``a=0.95, b=0.7, c=0.6, d=3.5, e=0.25, f=0.1`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -157,15 +157,15 @@ prob = prob_ode_dadras ``` """ dadras = ODEFunction(dadras_eqs) -@doc doc""" +""" Dadras equations ```math -\begin{align*} -\frac{dx}{dt} &= y - ax + byz \\ -\frac{dy}{dt} &= cy - xz + z \\ -\frac{dz}{dt} &= dxy - ez -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= y - ax + byz \\\\ +\\frac{dy}{dt} &= cy - xz + z \\\\ +\\frac{dz}{dt} &= dxy - ez +\\end{align*} ``` with parameters ``a=3, b=2.7, c=1.7, d=2, e=9`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -199,15 +199,15 @@ prob = prob_ode_chen ``` """ chen = ODEFunction(chen_eqs) -@doc doc""" +""" Chen equations ```math -\begin{align*} -\frac{dx}{dt} &= a(y - x) \\ -\frac{dy}{dt} &= (c - a)x - xz + cy \\ -\frac{dz}{dt} &= xy - bz -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= a(y - x) \\\\ +\\frac{dy}{dt} &= (c - a)x - xz + cy \\\\ +\\frac{dz}{dt} &= xy - bz +\\end{align*} ``` with parameters ``a=35, b=3, c=28`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -241,15 +241,15 @@ prob = prob_ode_rossler ``` """ rossler = ODEFunction(rossler_eqs) -@doc doc""" +""" Rössler equations ```math -\begin{align*} -\frac{dx}{dt} &= -(y + z) \\ -\frac{dy}{dt} &= x + ay \\ -\frac{dz}{dt} &= b + z(x - c) -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= -(y + z) \\\\ +\\frac{dy}{dt} &= x + ay \\\\ +\\frac{dz}{dt} &= b + z(x - c) +\\end{align*} ``` with parameters ``a=0.2, b=0.2, c=5.7`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -284,15 +284,15 @@ prob = prob_ode_rabinovich_fabrikant ``` """ rabinovich_fabrikant = ODEFunction(rabinovich_fabrikant_eqs) -@doc doc""" +""" Rabinovich-Fabrikant equations ```math -\begin{align*} -\frac{dx}{dt} &= y(z - 1 + x^2) + bx \\ -\frac{dy}{dt} &= x(3z + 1 - x^2) + by \\ -\frac{dz}{dt} &= -2z(a + xy) -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= y(z - 1 + x^2) + bx \\\\ +\\frac{dy}{dt} &= x(3z + 1 - x^2) + by \\\\ +\\frac{dz}{dt} &= -2z(a + xy) +\\end{align*} ``` with parameters ``a=0.14, b=0.10`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -326,15 +326,15 @@ prob = prob_ode_sprott ``` """ sprott = ODEFunction(sprott_eqs) -@doc doc""" +""" Sprott equations ```math -\begin{align*} -\frac{dx}{dt} &= y + axy + xz \\ -\frac{dy}{dt} &= 1 - bx^2 + yz \\ -\frac{dz}{dt} &= x - x^2 - y^2 -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= y + axy + xz \\\\ +\\frac{dy}{dt} &= 1 - bx^2 + yz \\\\ +\\frac{dz}{dt} &= x - x^2 - y^2 +\\end{align*} ``` with parameters ``a=2.07, b=1.79`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -368,15 +368,15 @@ prob = prob_ode_hindmarsh_rose ``` """ hindmarsh_rose = ODEFunction(hindmarsh_rose_eqs) -@doc doc""" +""" Hindmarsh-Rose equations ```math -\begin{align*} -\frac{dx}{dt} &= y - ax^3 + bx^2 - z + i \\ -\frac{dy}{dt} &= c - dx^2 - y \\ -\frac{dz}{dt} &= r(s(x - x_r) - z) -\end{align*} +\\begin{align*} +\\frac{dx}{dt} &= y - ax^3 + bx^2 - z + i \\\\ +\\frac{dy}{dt} &= c - dx^2 - y \\\\ +\\frac{dz}{dt} &= r(s(x - x_r) - z) +\\end{align*} ``` with parameters ``a=1, b=3, c=1, d=5, r=10^{-2}, s=4, x_r=-8/5, i=5`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` diff --git a/lib/ODEProblemLibrary/test/qa/Project.toml b/lib/ODEProblemLibrary/test/qa/Project.toml index 420792b..bd84b29 100644 --- a/lib/ODEProblemLibrary/test/qa/Project.toml +++ b/lib/ODEProblemLibrary/test/qa/Project.toml @@ -7,6 +7,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Aqua = "0.8" ODEProblemLibrary = "1" -SciMLTesting = "2.1" +SciMLTesting = "2.4" Test = "1.10" julia = "1.10" diff --git a/lib/ODEProblemLibrary/test/qa/qa.jl b/lib/ODEProblemLibrary/test/qa/qa.jl index f5b5bb5..a68a973 100644 --- a/lib/ODEProblemLibrary/test/qa/qa.jl +++ b/lib/ODEProblemLibrary/test/qa/qa.jl @@ -1,3 +1,3 @@ using SciMLTesting, ODEProblemLibrary, Test -run_qa(ODEProblemLibrary; explicit_imports = true, aqua_kwargs = (; ambiguities = false)) +run_qa(ODEProblemLibrary) diff --git a/lib/ODEProblemLibrary/test/runtests.jl b/lib/ODEProblemLibrary/test/runtests.jl index e9d3940..05aa14d 100644 --- a/lib/ODEProblemLibrary/test/runtests.jl +++ b/lib/ODEProblemLibrary/test/runtests.jl @@ -18,7 +18,6 @@ if TEST_GROUP == "Core" || TEST_GROUP == "All" end # Quality assurance: no undefined exports, stale dependencies, etc. -# Ambiguity checks are disabled since tests fail due to ambiguities in dependencies. if TEST_GROUP == "QA" || TEST_GROUP == "All" activate_qa_env() @time @safetestset "Aqua" include("qa/qa.jl") diff --git a/lib/SDEProblemLibrary/Project.toml b/lib/SDEProblemLibrary/Project.toml index 7f23d9f..85d7856 100644 --- a/lib/SDEProblemLibrary/Project.toml +++ b/lib/SDEProblemLibrary/Project.toml @@ -4,13 +4,11 @@ version = "1.2.2" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" [compat] DiffEqBase = "6, 7" -Markdown = "1.10" Pkg = "1.10" RuntimeGeneratedFunctions = "0.5" SafeTestsets = "0.1" diff --git a/lib/SDEProblemLibrary/docs/Project.toml b/lib/SDEProblemLibrary/docs/Project.toml new file mode 100644 index 0000000..2209ecf --- /dev/null +++ b/lib/SDEProblemLibrary/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +SDEProblemLibrary = "c72e72a9-a271-4b2b-8966-303ed956772e" + +[compat] +Documenter = "1" +SDEProblemLibrary = "1" +julia = "1.10" diff --git a/lib/SDEProblemLibrary/docs/make.jl b/lib/SDEProblemLibrary/docs/make.jl new file mode 100644 index 0000000..f451a53 --- /dev/null +++ b/lib/SDEProblemLibrary/docs/make.jl @@ -0,0 +1,5 @@ +using Documenter, SDEProblemLibrary + +makedocs( + ; sitename = "SDEProblemLibrary.jl", modules = [SDEProblemLibrary], checkdocs = :exports +) diff --git a/lib/SDEProblemLibrary/docs/src/index.md b/lib/SDEProblemLibrary/docs/src/index.md new file mode 100644 index 0000000..e2a0b0f --- /dev/null +++ b/lib/SDEProblemLibrary/docs/src/index.md @@ -0,0 +1,11 @@ +# SDEProblemLibrary.jl + +Premade stochastic differential equation problems for testing and benchmarking SDE solvers. + +## Public API + +```@autodocs +Modules = [SDEProblemLibrary] +Public = true +Private = false +``` diff --git a/lib/SDEProblemLibrary/src/SDEProblemLibrary.jl b/lib/SDEProblemLibrary/src/SDEProblemLibrary.jl index e859680..fca4d12 100644 --- a/lib/SDEProblemLibrary/src/SDEProblemLibrary.jl +++ b/lib/SDEProblemLibrary/src/SDEProblemLibrary.jl @@ -1,7 +1,6 @@ module SDEProblemLibrary using DiffEqBase: DiffEqBase, SDEFunction, SDEProblem -using Markdown: Markdown, @doc_str import RuntimeGeneratedFunctions RuntimeGeneratedFunctions.init(@__MODULE__) @@ -20,14 +19,14 @@ f_linear(u, p, t) = 1.01u σ_linear(u, p, t) = 0.87u linear_analytic(u0, p, t, W) = @.(u0 * exp(0.63155t + 0.87W)) -@doc doc""" +""" ```math -du_t = αu\,dt + βu\,dW_t +du_t = αu\\,dt + βu\\,dW_t ``` where ``α=1.01``, ``β=0.87``, and initial condition ``u_0=1/2``, with solution ```math -u(u_0,p,t,W_t) = u_0 \exp\left(\left(α - \tfrac{1}{2}β^2\right) t + βW_t\right) +u(u_0,p,t,W_t) = u_0 \\exp\\left(\\left(α - \\tfrac{1}{2}β^2\\right) t + βW_t\\right) ``` """ @@ -62,16 +61,16 @@ prob_sde_linear_stratonovich = SDEProblem( ) f_linear_iip(du, u, p, t) = @.(du = 1.01 * u) σ_linear_iip(du, u, p, t) = @.(du = 0.87 * u) -@doc doc""" +""" 8 linear SDEs (as a 4×2 matrix): ```math -du_t = αu\,dt + βu\,dW_t +du_t = αu\\,dt + βu\\,dW_t ``` -where ``α=1.01``, ``β=0.87``, and initial condition ``u_0=\frac{1}{2}`` with solution +where ``α=1.01``, ``β=0.87``, and initial condition ``u_0=\\frac{1}{2}`` with solution ```math -u(u_0,p,t,W_t) = u_0 \exp\left(\left(α - \tfrac{1}{2}β^2\right) t + βW_t\right) +u(u_0,p,t,W_t) = u_0 \\exp\\left(\\left(α - \\tfrac{1}{2}β^2\\right) t + βW_t\\right) ``` """ prob_sde_2Dlinear = SDEProblem( @@ -107,15 +106,15 @@ f_cubic(u, p, t) = -0.25 * u * (1 - u^2) σ_cubic(u, p, t) = 0.5 * (1 - u^2) cubic_analytic(u0, p, t, W) = @. ((1 + u0) * exp(W) + u0 - 1) / ((1 + u0) * exp(W) + 1 - u0) ff_cubic = SDEFunction(f_cubic, σ_cubic, analytic = cubic_analytic) -@doc doc""" +""" ```math -du_t = \frac{1}{4}u(1-u^2) \, dt + \frac{1}{2}(1-u^2) \, dW_t +du_t = \\frac{1}{4}u(1-u^2) \\, dt + \\frac{1}{2}(1-u^2) \\, dW_t ``` -and initial condition ``u_0=\frac{1}{2}``, with solution +and initial condition ``u_0=\\frac{1}{2}``, with solution ```math -u(u0,p,t,W_t) = \frac{(1+u_0) \exp(W_t) + u_0 - 1}{(1+u_0) \exp(W_t) + 1 - u_0} +u(u0,p,t,W_t) = \\frac{(1+u_0) \\exp(W_t) + u_0 - 1}{(1+u_0) \\exp(W_t) + 1 - u_0} ``` """ prob_sde_cubic = SDEProblem(ff_cubic, 1 / 2, (0.0, 1.0)) @@ -124,15 +123,15 @@ f_wave(u, p, t) = @. -0.01 * sin(u) * cos(u)^3 σ_wave(u, p, t) = @. 0.1 * cos(u)^2 wave_analytic(u0, p, t, W) = @. atan(0.1 * W + tan(u0)) ff_wave = SDEFunction(f_wave, σ_wave, analytic = wave_analytic) -@doc doc""" +""" ```math -du_t = -\frac{1}{100}\sin(u)\cos^3(u)\, dt + \frac{1}{10}\cos^2(u_t)\, dW_t +du_t = -\\frac{1}{100}\\sin(u)\\cos^3(u)\\, dt + \\frac{1}{10}\\cos^2(u_t)\\, dW_t ``` and initial condition ``u_0=1`` with solution ```math -u(u_0,p,t,W_t) = \arctan\left(\frac{W_t}{10} + \tan(u_0)\right) +u(u_0,p,t,W_t) = \\arctan\\left(\\frac{W_t}{10} + \\tan(u_0)\\right) ``` """ prob_sde_wave = SDEProblem(ff_wave, 1.0, (0.0, 1.0)) @@ -142,17 +141,17 @@ f_additive(u, p, t) = @. p[2] / sqrt(1 + t) - u / (2 * (1 + t)) p = (0.1, 0.05) additive_analytic(u0, p, t, W) = @. u0 / sqrt(1 + t) + p[2] * (t + p[1] * W) / sqrt(1 + t) ff_additive = SDEFunction(f_additive, σ_additive, analytic = additive_analytic) -@doc doc""" +""" Additive noise problem ```math -u_t = \left(\frac{β}{\sqrt{1+t}} - \frac{1}{2(1+t)}u_t\right) \, dt + \frac{αβ}{\sqrt{1+t}} \, dW_t +u_t = \\left(\\frac{β}{\\sqrt{1+t}} - \\frac{1}{2(1+t)}u_t\\right) \\, dt + \\frac{αβ}{\\sqrt{1+t}} \\, dW_t ``` and initial condition ``u_0=1`` with ``α=0.1`` and ``β=0.05``, with solution ```math -u(u_0,p,t,W_t)=\frac{u_0}{\sqrt{1+t}} + \frac{β(t+αW_t)}{\sqrt{1+t}} +u(u_0,p,t,W_t)=\\frac{u_0}{\\sqrt{1+t}} + \\frac{β(t+αW_t)}{\\sqrt{1+t}} ``` """ prob_sde_additive = SDEProblem(ff_additive, 1.0, (0.0, 1.0), p) @@ -161,7 +160,7 @@ f_additive_iip(du, u, p, t) = @.(du = p[2] / sqrt(1 + t) - u / (2 * (1 + t))) σ_additive_iip(du, u, p, t) = @.(du = p[1] * p[2] / sqrt(1 + t)) ff_additive_iip = SDEFunction(f_additive_iip, σ_additive_iip, analytic = additive_analytic) p = ([0.1; 0.1; 0.1; 0.1], [0.5; 0.25; 0.125; 0.1115]) -@doc doc""" +""" A multiple dimension extension of `additiveSDEExample` """ @@ -176,15 +175,15 @@ function f_lorenz(du, u, p, t) return du[3] = u[1] * u[2] - p[3] * u[3] end σ_lorenz(du, u, p, t) = @.(du = 3.0) -@doc doc""" +""" Lorenz Attractor with additive noise ```math -\begin{align*} -dx &= σ(y-x) \, dt + α \, dW_t \\ -dy &= (x(ρ-z) - y) \, dt + α \, dW_t \\ -dz &= (xy - βz) \, dt + α \, dW_t -\end{align*} +\\begin{align*} +dx &= σ(y-x) \\, dt + α \\, dW_t \\\\ +dy &= (x(ρ-z) - y) \\, dt + α \\, dW_t \\\\ +dz &= (xy - βz) \\, dt + α \\, dW_t +\\end{align*} ``` with ``σ=10``, ``ρ=28``, ``β=8/3``, ``α=3.0`` and initial condition ``u_0=[1;1;1]``. @@ -195,13 +194,13 @@ f_nltest(u, p, t) = (1 / 3) * u^(1 / 3) + 6 * u^(2 / 3) σ_nltest(u, p, t) = u^(2 / 3) analytic_nltest(u0, p, t, W) = (2t + 1 + W / 3)^3 ff_nltest = SDEFunction(f_nltest, σ_nltest, analytic = analytic_nltest) -@doc doc""" +""" Runge–Kutta methods for numerical solution of stochastic differential equations Tocino and Ardanuy """ prob_sde_nltest = SDEProblem(ff_nltest, 1.0, (0.0, 10.0)) -@doc doc""" +""" oval2ModelExample(;largeFluctuations=false,useBigs=false,noiseLevel=1) A function which generates the Oval2 Epithelial-Mesenchymal Transition model @@ -463,7 +462,7 @@ ff_stiff_quad_strat = SDEFunction( analytic = stiff_quad_f_strat_analytic ) -@doc doc""" +""" The composite Euler method for stiff stochastic differential equations @@ -485,7 +484,7 @@ prob_sde_stiffquadito = SDEProblem( (1.0, 1.0) ) -@doc doc""" +""" The composite Euler method for stiff stochastic differential equations @@ -507,7 +506,7 @@ prob_sde_stiffquadstrat = SDEProblem( (1.0, 1.0) ) -@doc doc""" +""" Stochastic Heat Equation with scalar multiplicative noise S-ROCK: CHEBYSHEV METHODS FOR STIFF STOCHASTIC diff --git a/lib/SDEProblemLibrary/test/qa/Project.toml b/lib/SDEProblemLibrary/test/qa/Project.toml index f5ad822..9db12b6 100644 --- a/lib/SDEProblemLibrary/test/qa/Project.toml +++ b/lib/SDEProblemLibrary/test/qa/Project.toml @@ -7,6 +7,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Aqua = "0.8" SDEProblemLibrary = "1" -SciMLTesting = "2.1" +SciMLTesting = "2.4" Test = "1.10" julia = "1.10" diff --git a/lib/SDEProblemLibrary/test/qa/qa.jl b/lib/SDEProblemLibrary/test/qa/qa.jl index 0a4e0d8..c803895 100644 --- a/lib/SDEProblemLibrary/test/qa/qa.jl +++ b/lib/SDEProblemLibrary/test/qa/qa.jl @@ -1,6 +1,3 @@ using SciMLTesting, SDEProblemLibrary, Test -run_qa( - SDEProblemLibrary; explicit_imports = true, - aqua_kwargs = (; ambiguities = false, persistent_tasks = false) -) +run_qa(SDEProblemLibrary) diff --git a/lib/SDEProblemLibrary/test/runtests.jl b/lib/SDEProblemLibrary/test/runtests.jl index 7f06a4a..c63be0f 100644 --- a/lib/SDEProblemLibrary/test/runtests.jl +++ b/lib/SDEProblemLibrary/test/runtests.jl @@ -18,7 +18,6 @@ if TEST_GROUP == "Core" || TEST_GROUP == "All" end # Quality assurance: no undefined exports, stale dependencies, etc. -# Ambiguity checks are disabled since tests fail due to ambiguities in dependencies. if TEST_GROUP == "QA" || TEST_GROUP == "All" activate_qa_env() @time @safetestset "Aqua" include("qa/qa.jl") diff --git a/test/qa/Project.toml b/test/qa/Project.toml index 9b5f705..59acde2 100644 --- a/test/qa/Project.toml +++ b/test/qa/Project.toml @@ -1,12 +1,14 @@ [deps] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqProblemLibrary = "a077e3f3-b75c-5d7f-a0c6-6bc4c8ec64a9" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] +Aqua = "0.8" DiffEqProblemLibrary = "5" SafeTestsets = "0.0.1, 0.1" -SciMLTesting = "2.1" +SciMLTesting = "2.4" Test = "1.10" julia = "1.10" diff --git a/test/qa/qa.jl b/test/qa/qa.jl index 9d44248..6b9f154 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,11 +1,3 @@ using SciMLTesting, DiffEqProblemLibrary, Test -# The root umbrella package re-exports each sublibrary; it owns no methods of its own, -# so the reported method ambiguities all come from the imported dependency tree -# (DiffEqBase / SciMLBase / Catalyst), matching the `ambiguities = false` each sublib uses. -run_qa( - DiffEqProblemLibrary; - explicit_imports = true, - aqua_kwargs = (; ambiguities = false), - api_docs_kwargs = (; rendered = true), -) +run_qa(DiffEqProblemLibrary) diff --git a/test/runtests.jl b/test/runtests.jl index b0ca3ab..6131d8b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -20,48 +20,11 @@ function qa_group() end @time begin - # Monorepo sublibrary routing. The root reads GROUP to pick a `lib/` - # sublibrary, transitively develops its `[sources]` on Julia < 1.11, then - # `Pkg.test`s it with the sub-group handed off via DIFFEQPROBLEMLIBRARY_TEST_GROUP. - # This is kept as an explicit pre-step (rather than delegated to `run_tests`'s - # built-in `lib_dir` path) so the sublibrary `Pkg.test` invocation — `julia_args`, - # `force_latest_compatible_version = false`, `allow_reresolve = true` — stays - # byte-for-byte identical to the previous runtests.jl. (`run_tests`'s sublibrary - # path only passes `allow_reresolve`, which would silently drop `--depwarn=yes` / - # `force_latest_compatible_version`.) + # Route a requested monorepo sublibrary test group to its local package. base_group, test_group = detect_sublibrary_group(GROUP, LIB_DIR) if !isempty(base_group) && isdir(joinpath(LIB_DIR, base_group)) Pkg.activate(joinpath(LIB_DIR, base_group)) - # On Julia < 1.11, the [sources] section in Project.toml is not supported. - # Manually Pkg.develop local path dependencies so CI tests the PR branch code. - # The transitive walk also develops each developed dependency's own [sources]. - if VERSION < v"1.11.0-DEV.0" - developed = Set{String}() - push!(developed, normpath(joinpath(LIB_DIR, base_group))) - specs = Pkg.PackageSpec[] - queue = [joinpath(LIB_DIR, base_group)] - while !isempty(queue) - pkg_dir = popfirst!(queue) - toml_path = joinpath(pkg_dir, "Project.toml") - isfile(toml_path) || continue - toml = Pkg.TOML.parsefile(toml_path) - if haskey(toml, "sources") - for (dep_name, source_spec) in toml["sources"] - if source_spec isa Dict && haskey(source_spec, "path") - dep_path = normpath(joinpath(pkg_dir, source_spec["path"])) - if isdir(dep_path) && !(dep_path in developed) - push!(developed, dep_path) - @info "Queuing local source dependency" dep_name dep_path - push!(specs, Pkg.PackageSpec(path = dep_path)) - push!(queue, dep_path) - end - end - end - end - end - isempty(specs) || Pkg.develop(specs) - end withenv("DIFFEQPROBLEMLIBRARY_TEST_GROUP" => test_group) do Pkg.test(base_group, julia_args = ["--check-bounds=auto", "--compiled-modules=yes", "--depwarn=yes"], force_latest_compatible_version = false, allow_reresolve = true) end