diff --git a/lib/BVProblemLibrary/src/BVProblemLibrary.jl b/lib/BVProblemLibrary/src/BVProblemLibrary.jl index 1cb7ad9..2b98b36 100644 --- a/lib/BVProblemLibrary/src/BVProblemLibrary.jl +++ b/lib/BVProblemLibrary/src/BVProblemLibrary.jl @@ -41,49 +41,29 @@ This test problem is about the optimal-time launching of a satellite into orbit Given by ```math -\frac{dz_1}{dt}=z_3t_f -``` -```math -\frac{dz_2}{dt}=z_4t_f -``` -```math -\frac{dz_3}{dt}=A\cos(z_5)t_f -``` -```math -\frac{dz_4}{dt}=(A\sin(z_5)-g)t_f -``` -```math -\frac{dz_5}{dt}=-z_6\cos(z_5)t_F -``` -```math -\frac{dz_6}{dt}=z_6^2\sin(z_5)t_f -``` -```math -\frac{dz_7}{dt}=0 +\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 -z_1(0)=0 -``` -```math -z_2(0)=0 -``` -```math -z_3(0)=0 -``` -```math -z_4(0)=0 -``` -```math -z_5(1)=h -``` -```math -z_6(1)=V_c -``` -```math -z_7(1)=0 +\begin{align*} +z_1(0) &= 0, & +z_2(0) &= 0, \\ +z_3(0) &= 0, & +z_4(0) &= 0, \\ +z_5(1) &= h, & +z_6(1) &= V_c, \\ +z_7(1) &= 0. +\end{align*} ``` # Solution @@ -134,49 +114,29 @@ Launch of a satellite into circular orbit from a flat Earth where we assume a un Given by ```math -\frac{dz_1}{dt}=z_3\frac{V_c}{h} -``` -```math -\frac{dz_2}{dt}=z_4\frac{V_c}{h} -``` -```math -\frac{dz_3}{dt}=acc\frac{1}{|V_c|\sqrt{1+z_6^2}} -``` -```math -\frac{dz_4}{dt}=acc\frac{1}{|V_c|\sqrt{1+z_6^2}}-\frac{g}{V_c} -``` -```math -\frac{dz_5}{dt}=0 -``` -```math -\frac{dz_6}{dt}=-z_5\frac{V_c}{h} -``` -```math -\frac{dz_7}{dt}=0 +\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 condition +with boundary conditions ```math -z_1(0)=0 -``` -```math -z_2(0)=0 -``` -```math -z_3(0)=0 -``` -```math -z_4(0)=0 -``` -```math -z_5(1)=h -``` -```math -z_6(1)=V_c -``` -```math -z_7(1)=0 +\begin{align*} +z_1(0) &= 0, & +z_2(0) &= 0, \\ +z_3(0) &= 0, & +z_4(0) &= 0, \\ +z_5(1) &= h, & +z_6(1) &= V_c, \\ +z_7(1) &= 0. +\end{align*} ``` # Solution @@ -261,49 +221,29 @@ Launch into circular orbit from a flat Earth including athmosferic drag. Given by ```math -\frac{dz_1}{dt}=z_3\frac{V_c}{h} -``` -```math -\frac{dz_2}{dt}=z_4\frac{V_c}{h} -``` -```math -\frac{dz_3}{dt}=\frac{f}{V_c}(-\frac{z_6}{z_6^2+z_7^2}-V_c\eta\exp(-z_2\beta)z_3\sqrt{z_3^3+z_4^2})/m -``` -```math -\frac{dz_4}{dt}=\frac{f}{V_c}(-\frac{z_7}{z_6^2+z_7^2}-V_c\eta\exp(-z_2\beta)z_4\sqrt{z_3^3+z_4^2})/m - g_{accel}/V_c -``` -```math -\frac{dz_5}{dt}=-\eta\beta\exp(-z_2\beta)(z_6z_3+z_7z_4)\sqrt{z_3^3+z_4^2}\frac{V_c}{m} -``` -```math -\frac{dz_6}{dt}=\eta\exp(-z_2\beta)(z_6(2z_3^2+z_4^2)+z_7z_3z_4)V_c/\sqrt{z_3^2+z_4^2}/m -``` -```math -\frac{dz_7}{dt}=\eta\exp(-z_2\beta)(z_7(z_3^2+2z_4^2)+z_6z_3z_4)V_c/\sqrt{z_3^2+z_4^2}/m +\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 condition +with boundary conditions ```math -z_1(0)=0 -``` -```math -z_2(0)=0 -``` -```math -z_3(0)=0 -``` -```math -z_4(0)=0 -``` -```math -z_5(1)=h -``` -```math -z_6(1)=V_c -``` -```math -z_7(1)=0 +\begin{align*} +z_1(0) &= 0, & +z_2(0) &= 0, \\ +z_3(0) &= 0, & +z_4(0) &= 0, \\ +z_5(1) &= h, & +z_6(1) &= V_c, \\ +z_7(1) &= 0. +\end{align*} ``` # Solution @@ -346,22 +286,19 @@ This is an epidemiology model, about the spread of diseases. Given by ```math -\frac{dy_1}{dt}=\mu-\beta(t)y_1y_3 -``` -```math -\frac{dy_2}{dt}=\beta(t)y_1y_3-y_2/\lambda -``` -```math -\frac{dy_3}{dt}=y_2/\lambda-y_3/\eta +\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 ```math -y(0)=y(1) +y(0) = y(1) ``` - # Solution No analytical solution diff --git a/lib/BVProblemLibrary/src/linear.jl b/lib/BVProblemLibrary/src/linear.jl index 0947e39..aa9a414 100644 --- a/lib/BVProblemLibrary/src/linear.jl +++ b/lib/BVProblemLibrary/src/linear.jl @@ -27,16 +27,16 @@ prob_bvp_linear_1_tspan = (0.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}y_1 +\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 @@ -44,10 +44,10 @@ y_1(0)=1, y_1(1)=0 The analytical solution for ``t \in [0, 1]`` is ```math -y_1(t) = \frac{\exp(-t/\sqrt{\lambda}) - \exp((t-2)/\sqrt{\lambda})}{1-\exp(-2/\sqrt{\lambda})} -``` -```math -y_2(t)=y_1'(t) +\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*} ``` # References @@ -85,16 +85,16 @@ prob_bvp_linear_2_tspan = (0.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}y_2 +\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 @@ -102,10 +102,10 @@ y_1(0)=1, y_1(1)=0 The analytical solution for ``t \in [0, 1]`` is ```math -y_1(t) = \frac{1-\exp((t-1)/\lambda)}{1-\exp(-1/\lambda)} -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \frac{1-\exp((t-1)/λ)}{1-\exp(-1/λ)} \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -146,22 +146,22 @@ prob_bvp_linear_3_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_1, y_2) +\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(\pi t))y_2 + y_1 -(1+\lambda \pi^2)\cos(\pi t) - (2+\cos(\pi t))\pi\sin(\pi 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 @@ -169,10 +169,10 @@ y_1(-1)=-1, y_1(1)=-1 The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \cos(\pi t) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \cos(πt) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -210,22 +210,25 @@ prob_bvp_linear_4_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(y_1, y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) +\end{align*} ``` where ```math -f(y_1, y_2)=-y2+(1+\lambda)y1 +f(y_1, y_2) = -y_2 + (1+λ) y_1 ``` with boundary condition ```math -y_1(-1)=1+\exp(-2), y_1(1)=1+\exp(-2(1+\lambda)) +\begin{align*} +y_1(-1) &= 1 + \exp(-2), \\ +y_1(1) &= 1 + \exp(-2(1+λ)) +\end{align*} ``` # Solution @@ -233,10 +236,10 @@ y_1(-1)=1+\exp(-2), y_1(1)=1+\exp(-2(1+\lambda)) The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \exp(t-1)+\exp(-(1+\lambda)(1+t)/\lambda) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \exp(t-1) + \exp(-(1+λ)(1+t)/λ) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -276,22 +279,22 @@ prob_bvp_linear_5_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_1, y_2) +\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+\lambda\pi^2)\cos(\pi t)+\pi t\sin(\pi 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 @@ -299,10 +302,10 @@ y_1(-1)=-1, y_1(1)=-1 The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \cos(\pi t) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \cos(πt) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -341,22 +344,22 @@ prob_bvp_linear_6_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_2) +\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 - \lambda\pi^2\cos(\pi t)-\pi t\sin(\pi 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 @@ -364,10 +367,10 @@ y_1(-1)=-2, y_1(1)=0 The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \cos(\pi t) + \erf(t/\sqrt{2\lambda})/\erf(1/\sqrt{2\lambda}) -``` -```math -y_2(t) = y_1'(t) +\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*} ``` # References @@ -413,22 +416,22 @@ prob_bvp_linear_7_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_1, y_2) +\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+\lambda\pi^2)\cos(\pi t)+\pi t\sin(\pi 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 @@ -436,10 +439,10 @@ y_1(-1)=-1, y_1(1)=1 The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \cos(\pi t) + t + \frac{t\erf(t/\sqrt{2\lambda}) + \sqrt{2\lambda/\pi}\exp(-t^2/2\lambda)}{} -``` -```math -y_2(t) = y_1'(t) +\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*} ``` # References @@ -477,16 +480,16 @@ prob_bvp_linear_8_tspan = (0.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = -\frac{1}{\lambda}y_2 +\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 @@ -494,10 +497,10 @@ y_1(0)=1, y_1(1)=2 The analytical solution for ``t \in [0, 1]`` is ```math -y_1(t) = (2-\exp(-1/\lambda)-\exp(-t/\lambda))/(1-\exp(-1/\lambda)) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \frac{2 - \exp(-1/λ) - \exp(-t/λ)}{1 - \exp(-1/λ)} \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -535,10 +538,10 @@ prob_bvp_linear_9_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda+t^2}f(t, y_1, y_2) +\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 @@ -550,7 +553,7 @@ f(t, y_1, y_2)=-4ty_2 - 2y_1 with boundary condition ```math -y_1(-1)=1/(1+\lambda), y_1(1)=1/(1+\lambda) +y_1(-1)=1/(1+λ), y_1(1)=1/(1+λ) ``` # Solution @@ -558,10 +561,10 @@ y_1(-1)=1/(1+\lambda), y_1(1)=1/(1+\lambda) The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = 1/(\lambda+t^2) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \frac{1}{λ + t^2} \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -600,22 +603,16 @@ prob_bvp_linear_10_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_2) -``` - -where - -```math -f(t, y_2)=-ty_2 +\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 @@ -623,10 +620,10 @@ y_1(-1)=0, y_1(1)=2 The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = 1+\erf(t/\sqrt{2\lambda})/\erf(1/\sqrt{2\lambda}) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= 1 + \operatorname{erf}(t/\sqrt{2λ})/\operatorname{erf}(1/\sqrt{2λ}) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -664,22 +661,22 @@ prob_bvp_linear_11_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_1) +\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+\lambda\pi^2)\cos(\pi 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 @@ -687,10 +684,10 @@ y_1(-1)=0, y_1(1)=2 The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \cos(\pi t) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \cos(πt) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -730,16 +727,16 @@ prob_bvp_linear_12_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_1) +\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+\lambda\pi^2)\cos(\pi t) +f(t, y_1) = y_1 - (1+λπ^2)\cos(πt) ``` with boundary condition @@ -753,10 +750,10 @@ y_1(-1)=-1, y_1(1)=0 The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \cos(\pi t)+\frac{\exp((t+1)/\sqrt{\lambda})-\exp((-t-1))/\sqrt{\lambda}}{\exp(2/\sqrt{\lambda})-\exp(-2/\sqrt{\lambda})} -``` -```math -y_2(t) = y_1'(t) +\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*} ``` # References @@ -795,22 +792,22 @@ prob_bvp_linear_13_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_1) +\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+\lambda\pi^2)\cos(\pi 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 @@ -818,10 +815,10 @@ y_1(-1)=0, y_1(1)=-1 The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \cos(\pi t)+\exp(-(t+1)/\sqrt{\lambda}) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \cos(πt) + \exp(-(t+1)/\sqrt{λ}) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -860,22 +857,23 @@ prob_bvp_linear_14_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_1) +\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+\lambda\pi^2)\cos(\pi t) +f(t, y_1)=y_1-(1+λπ^2)\cos(πt) ``` with boundary condition ```math -y_1(-1)=\exp(-2/\sqrt{\lambda}, y_1(1)=\exp(-2/\sqrt{\lambda}) +y_1(-1) = \exp(-2/\sqrt{λ}), \;\; +y_1(1) = \exp(-2/\sqrt{λ}) ``` # Solution @@ -883,10 +881,10 @@ y_1(-1)=\exp(-2/\sqrt{\lambda}, y_1(1)=\exp(-2/\sqrt{\lambda}) The analytical solution for ``t \in [-1, 1]`` is ```math -y_1(t) = \cos(\pi t)+\exp((t-1)/\sqrt{\lambda})+\exp(-(t+1)/\sqrt{\lambda}) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \cos(πt) + \exp((t-1)/\sqrt{λ}) + \exp(-(t+1)/\sqrt{λ}) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -921,22 +919,16 @@ prob_bvp_linear_15_tspan = (-1.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(t, y_1) -``` - -where - -```math -f(t, y_1)=ty_1 +\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 @@ -978,22 +970,22 @@ prob_bvp_linear_16_tspan = (0.0, 1.0) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda^2}f(y_1) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= \frac{1}{λ^2} f(y_1) +\end{align*} ``` where ```math -f(t, y_1)=-π^2y_1/4 +f(t, y_1) = -π^2 y_1/4 ``` with boundary condition ```math -y_1(0)=0, y_1(1)=\sin(\pi/(2*\lambda)) +y_1(0)=0, \;\; y_1(1)=\sin(π/(2λ)) ``` # Solution @@ -1001,10 +993,10 @@ y_1(0)=0, y_1(1)=\sin(\pi/(2*\lambda)) The analytical solution for ``t \in [0, 1]`` is ```math -y_1(t) = \sin(\pi t/2\lambda) when 1/\lambda is odd -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \sin(πt/2λ) \text{ when } 1/λ \text{ is odd } \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -1041,22 +1033,23 @@ prob_bvp_linear_17_tspan = (-0.1, 0.1) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = f(y_1) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= f(y_1) +\end{align*} ``` where ```math -f(t, y_1)=-3\lambda y_1/(\lambda+t^2)^2 +f(t, y_1) = -3λ y_1 / (λ+t^2)^2 ``` with boundary condition ```math -y_1(-0.1)=-0.1/\sqrt{\lambda+0.01}, y_1(0.1)=0.1/\sqrt{\lambda+0.01} +y_1(-0.1) = \frac{-0.1}{\sqrt{λ+0.01}}, +y_1(0.1) = \frac{ 0.1}{\sqrt{λ+0.01}} ``` # Solution @@ -1064,10 +1057,10 @@ y_1(-0.1)=-0.1/\sqrt{\lambda+0.01}, y_1(0.1)=0.1/\sqrt{\lambda+0.01} The analytical solution for ``t \in [-0.1, 0.1]`` is ```math -y_1(t) = t/\sqrt{\lambda+t^2} -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= t/\sqrt{λ+t^2} \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -1105,22 +1098,16 @@ prob_bvp_linear_18_tspan = (0, 1) Linear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = -\frac{1}{\lambda}y_2 -``` - -where - -```math -f(y_2)=-y_1 +\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.1/\sqrt{\lambda+0.01} +y_1(0)=1, \;\; y_1(1)=\frac{0.1}{\sqrt{λ+0.01}} ``` # Solution @@ -1128,10 +1115,10 @@ y_1(0)=1, y_1(1)=0.1/\sqrt{\lambda+0.01} The analytical solution for ``t \in [0, 1]`` is ```math -y_1(t) = \exp(-t/\lambda) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \exp(-t/λ) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References diff --git a/lib/BVProblemLibrary/src/nonlinear.jl b/lib/BVProblemLibrary/src/nonlinear.jl index 9e5b974..b96d95a 100644 --- a/lib/BVProblemLibrary/src/nonlinear.jl +++ b/lib/BVProblemLibrary/src/nonlinear.jl @@ -23,10 +23,10 @@ prob_bvp_nonlinear_1_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = -\frac{1}{\lambda}y_2 +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= -\frac{1}{λ} y_2 +\end{align*} ``` where @@ -38,7 +38,7 @@ f(y_2)=-y_1 with boundary condition ```math -y_1(0)=1, y_1(1)=0.1/\sqrt{\lambda+0.01} +y_1(0)=1, y_1(1)=0.1/\sqrt{λ+0.01} ``` # Solution @@ -46,10 +46,10 @@ y_1(0)=1, y_1(1)=0.1/\sqrt{\lambda+0.01} The analytical solution for ``t \in [0, 1]`` is ```math -y_1(t) = \exp(-t/\lambda) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \exp(-t/λ) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -87,10 +87,10 @@ prob_bvp_nonlinear_2_tspan = (0, 1) Nonlinear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = -\frac{1}{\lambda}f(y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= -\frac{1}{λ} f(y_2) +\end{align*} ``` where @@ -102,7 +102,10 @@ f(y_2)=--y_2^2+1 with boundary condition ```math -y_1(0)=1+\lambda\ln\cosh(-0.745/\lambda), y_1(1)=1+\lambda\ln\cosh(0.255/\lambda) +\begin{align*} +y_1(0) &= 1 + λ \ln\cosh(-0.745/λ), \\ +y_1(1) &= 1 + λ \ln\cosh(0.255/λ) +\end{align*} ``` # Solution @@ -110,10 +113,10 @@ y_1(0)=1+\lambda\ln\cosh(-0.745/\lambda), y_1(1)=1+\lambda\ln\cosh(0.255/\lambda The analytical solution for ``t \in [0, 1]`` is ```math -y_1(t) = 1+\lambda\ln\cosh((t-0.745)/\lambda) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= 1 + λ \ln\cosh((t-0.745)/λ) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -152,22 +155,22 @@ prob_bvp_nonlinear_3_tspan = (0, 1) Nonlinear boundary value problem with analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = -\frac{1}{\lambda}f(y, y_1) +\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{\lambda}) +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{\lambda}) +y_1(0)=1, y_1(1)=\exp(-1/\sqrt{λ}) ``` # Solution @@ -175,10 +178,10 @@ y_1(0)=1, y_1(1)=\exp(-1/\sqrt{\lambda}) The analytical solution for ``t \in [0, 1]`` is ```math -y_1(t) = \exp(-t/\sqrt{\lambda}) -``` -```math -y_2(t) = y_1'(t) +\begin{align*} +y_1(t) &= \exp(-t/\sqrt{λ}) \\ +y_2(t) &= y_1'(t) +\end{align*} ``` # References @@ -213,10 +216,10 @@ prob_bvp_nonlinear_4_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = -\frac{1}{\lambda}f(y_1, y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= -\frac{1}{λ} f(y_1, y_2) +\end{align*} ``` where @@ -267,16 +270,16 @@ prob_bvp_nonlinear_5_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = -\frac{1}{\lambda}f(y_1) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= -\frac{1}{λ} f(y_1) +\end{align*} ``` where ```math -f(y_1)=\lambda\sinh(\lambda z) +f(y_1) = λ\sinh(λz) ``` with boundary condition @@ -327,22 +330,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 -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = -\frac{1}{\lambda}f(y_1) +\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)=(\frac{1+\gamma}{2}-\lambda A'(t))y_1y_2-\frac{y_2}{y_1}-\frac{A'(t)}{A(t)}(1-(\frac{\gamma-1}{2})y_1^2) +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 @@ -381,22 +384,22 @@ prob_bvp_nonlinear_7_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(y_1, y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) +\end{align*} ``` where ```math -f(y_1, y_2)=-y_1y_2+y_1 +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 @@ -435,10 +438,10 @@ prob_bvp_nonlinear_8_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(y_1, y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) +\end{align*} ``` where @@ -450,7 +453,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 @@ -489,10 +492,10 @@ prob_bvp_nonlinear_9_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(y_1, y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) \\ +\end{align*} ``` where @@ -543,10 +546,10 @@ prob_bvp_nonlinear_10_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(y_1, y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) +\end{align*} ``` where @@ -558,7 +561,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 @@ -597,10 +600,10 @@ prob_bvp_nonlinear_11_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(y_1, y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) +\end{align*} ``` where @@ -612,7 +615,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 @@ -651,22 +654,22 @@ prob_bvp_nonlinear_12_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}f(y_1, y_2) +\begin{align*} +\frac{dy_1}{dt} &= y_2 \\ +\frac{dy_2}{dt} &= \frac{1}{λ} f(y_1, y_2) +\end{align*} ``` where ```math -f(y_1, y_2)=-y_1y_2+y_1 +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 @@ -711,28 +714,25 @@ prob_bvp_nonlinear_13_tspan = (0, 1) Nonlinear boundary value problem with no analytical solution, given by ```math -\frac{dy_1}{dt} = \sin(y_2) -``` -```math -\frac{dy_2}{dt} = y_3 -``` -```math -\frac{dy_3}{dt} = -y_4/\lambda -``` -```math -\frac{dy_4}{dt} = f(y_1, y_2, y_3, y_4) +\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, \theta, M, Q)=\frac{1}{\lambda}((z-1)\cos\theta-M\sec\theta)+\lambda Q\tan\theta +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 @@ -777,28 +777,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 -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = y_3 -``` -```math -\frac{dy_3}{dt} = y_4 -``` -```math -\frac{dy_4}{dt} = f(y_1, y_2, y_3, y_4) -``` - -where - -```math -f(y_1, y_2, y_3, y_4)=\lambda(y_2y_3-y_1y_4) +\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 @@ -846,28 +837,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 -\frac{dy_1}{dt} = y_2 -``` -```math -\frac{dy_2}{dt} = \frac{1}{\lambda}y_1y_4-y_3y_2 -``` -```math -\frac{dy_3}{dt} = y_4 -``` -```math -\frac{dy_4}{dt} = y_5 -``` -```math -\frac{dy_5}{dt} = y_6 -``` -```math -\frac{dy_6}{dt} = \frac{1}{\lambda}(-y_3y_6-y_1y_2) +\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 -y_1(0)=-1, y_3(0)=0, y_4(0)=0, y_1(1)=1, y_3(1)=0, y_4(1)=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*} ``` # Solution diff --git a/lib/DAEProblemLibrary/src/DAEProblemLibrary.jl b/lib/DAEProblemLibrary/src/DAEProblemLibrary.jl index 1dc34b3..ff9299e 100644 --- a/lib/DAEProblemLibrary/src/DAEProblemLibrary.jl +++ b/lib/DAEProblemLibrary/src/DAEProblemLibrary.jl @@ -20,17 +20,15 @@ du0 = [-0.04, 0.04, 0.0] The Robertson biochemical reactions in DAE form ```math -\frac{dy₁}{dt} = -k₁y₁+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*} ``` -```math -\frac{dy₂}{dt} = k₁y₁-k₂y₂^2-k₃y₂y₃ -``` -```math -1 = y₁ + y₂ + y₃ -``` -where ``k₁=0.04``, ``k₂=3\times10^7``, ``k₃=10^4``. For details, see: +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 -Usually solved on ``[0,1e11]`` +Usually solved on ``[0,10^{11}]`` """ prob_dae_resrob = DAEProblem(f, du0, u0, (0.0, 100000.0)) @@ -71,36 +69,38 @@ du0 = [ @doc doc""" The Transistor Amplifier model -M\frac{dy}{dt}=f(t,y),\quad y(0)=y_0,\quad y'(0)=y_0' +```math +M\frac{dy}{dt} = f(t,y), \quad y(0)=y_0,\quad y'(0)=y_0' +``` ```math -M=\left(\begin{array}{cccccccc} --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{array}\right) +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} ``` ```math -f(t, y)=\left(\begin{array}{c} --\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)-(\alpha-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}}+\alpha g\left(y_{2}-y_{3}\right) \\ --\frac{U_{b}}{R_{6}}+y_{5}\left(\frac{1}{R_{5}}+\frac{1}{R_{6}}\right)-(\alpha-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}}+\alpha g\left(y_{5}-y_{6}\right) \\ -\frac{y_{8}}{R_{9}} -\end{array}\right) +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 -DAE testset: https://archimede.uniba.it/~testset/problems/transamp.php +DAE testset: """ prob_dae_transamp = DAEProblem(transamp, du0, u0, (0.0, 0.2)) diff --git a/lib/DDEProblemLibrary/src/constant_delays.jl b/lib/DDEProblemLibrary/src/constant_delays.jl index a87d671..9d1c150 100644 --- a/lib/DDEProblemLibrary/src/constant_delays.jl +++ b/lib/DDEProblemLibrary/src/constant_delays.jl @@ -55,7 +55,7 @@ Delay differential equation u'(t) = -u(t - 1) ``` -for ``t \in [0, 1]`` with history function ``\phi(t) = 0`` if ``t < 0`` and ``\phi(0) = 1``. +for ``t \in [0, 1]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and ``ϕ(0) = 1``. # Solution @@ -174,8 +174,8 @@ Delay differential equation u'(t) = u(t) - u(t - 1/5) ``` -for ``t \in [0, 100]`` with history function ``\phi(t) = 0`` if ``t < 0`` and -``\phi(0) = 1``. +for ``t \in [0, 100]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and +``ϕ(0) = 1``. """ prob_dde_constant_1delay_long_ip @@ -247,7 +247,7 @@ Delay differential equation u'(t) = -u(t - 1/3) - u(t - 1/5) ``` -for ``t \in [0, 1]`` with history function ``\phi(t) = 0`` if ``t < 0`` and ``\phi(0) = 1``. +for ``t \in [0, 1]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and ``ϕ(0) = 1``. # Solution @@ -364,8 +364,8 @@ Delay differential equation u'(t) = - u(t - 1/3) - u(t - 1/5) ``` -for ``t \in [0, 100]`` with history function ``\phi(t) = 0`` if ``t < 0`` and -``\phi(0) = 1``. +for ``t \in [0, 100]`` with history function ``ϕ(t) = 0`` if ``t < 0`` and +``ϕ(0) = 1``. """ prob_dde_constant_2delays_long_ip diff --git a/lib/DDEProblemLibrary/src/ddetst.jl b/lib/DDEProblemLibrary/src/ddetst.jl index 410bea6..d2e9a34 100644 --- a/lib/DDEProblemLibrary/src/ddetst.jl +++ b/lib/DDEProblemLibrary/src/ddetst.jl @@ -14,7 +14,7 @@ Delay differential equation model of blood production, given by 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 ``\phi(t) = 0.5`` for ``t \leq 0``. +for ``t \in [0, 500]`` and history function ``ϕ(t) = 0.5`` for ``t ≤ 0``. # References @@ -45,22 +45,22 @@ const prob_dde_DDETST_A1 = DDEProblem(f_dde_DDETST_A1, h_dde_DDETST_A1, (0.0, 50 Delay differential equation model of chronic granulocytic leukemia, given by ```math -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)}, -``` -```math -u_2'(t) = \frac{100 u_1(t)}{1 + 40 u_2(t)} - 2.43 u_2(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, 100]`` and history function ```math -\phi_1(t) = 1.05767027/3, -``` -```math -\phi_2(t) = 1.030713491/3, +\begin{align*} +ϕ_1(t) &= 1.05767027/3, \\ +ϕ_2(t) &= 1.030713491/3, +\end{align*} ``` -for ``t \leq 0``. +for ``t ≤ 0``. # References @@ -105,7 +105,7 @@ Delay differential equation u'(t) = 1 - u(\exp(1 - 1/t)) ``` -for ``t \in [0.1, 10]`` with history function ``\phi(t) = \log t`` for ``t \in (0, 0.1]``. +for ``t \in [0.1, 10]`` with history function ``ϕ(t) = \log t`` for ``t \in (0, 0.1]``. # Solution @@ -155,7 +155,7 @@ Delay differential equation u'(t) = - 1 - u(t) + 2 [u(t / 2) < 0] ``` -for ``t \in [0, 2 \log 66]`` with history function ``\phi(0) = 1``. +for ``t \in [0, 2 \log 66]`` with history function ``ϕ(0) = 1``. # Solution @@ -220,7 +220,7 @@ Delay differential equation u'(t) = - 2 u(t - 1 - |u(t)|) (1 - u(t)^2) ``` -for ``t \in [0, 30]`` with history function ``\phi(t) = 0.5`` for ``t \leq 0``. +for ``t \in [0, 30]`` with history function ``ϕ(t) = 0.5`` for ``t ≤ 0``. # References @@ -247,22 +247,22 @@ const prob_dde_DDETST_C1 = DDEProblem(f_dde_DDETST_C1, h_dde_DDETST_C1, (0.0, 30 Delay differential equation ```math -u_1'(t) = - 2 u_1(t - u_2(t)), -``` -```math -u_₂'(t) = \frac{|u_1(t - u_2(t))| - |u_1(t)|}{1 + |u_1(t - u_2(t))|}, +\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 ```math -\phi_1(t) = 1, -``` -```math -\phi_2(t) = 0.5, +\begin{align*} +ϕ_1(t) &= 1, \\ +ϕ_2(t) &= 0.5, +\end{align*} ``` -for ``t \leq 0``. +for ``t ≤ 0``. # References @@ -305,25 +305,23 @@ const prob_dde_DDETST_C2 = DDEProblem(f_dde_DDETST_C2!, h_dde_DDETST_C2, (0.0, 3 Delay differential equation model of hematopoiesis, given by ```math -u_1'(t) = \hat{s}_0 u_2(t - T_1) - \gamma u_1(t) - Q, -``` -```math -u_2'(t) = f(u_1(t)) - k u_2(t), -``` -```math -u_3'(t) = 1 - \frac{Q \exp(\gamma u_3(t))}{\hat{s}_0 u_2(t - T_1 - u_3(t))}, +\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 ``\phi_1(0) = 3.325``, ``\phi_3(0) = 120``, and +for ``t \in [0, 300]`` with history function ``ϕ_1(0) = 3.325``, ``ϕ_3(0) = 120``, and ```math -\phi_2(t) = \begin{cases} - 10 & \text{if } t \in [- T_1, 0],\\ +ϕ_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``, ``\gamma = 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 @@ -370,18 +368,16 @@ Delay differential equation model of hematopoiesis, given by the same delay diff equation as [`prob_dde_DDETST_C3`](@ref) ```math -u_1'(t) = \hat{s}_0 u_2(t - T_1) - \gamma u_1(t) - Q, -``` -```math -u_2'(t) = f(u_1(t)) - k u_2(t), -``` -```math -u_3'(t) = 1 - \frac{Q \exp(\gamma u_3(t))}{\hat{s}_0 u_2(t - T_1 - u_3(t))}, +\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 -``\phi_1(0) = 3.5``, ``\phi_3(0) = 50``, and ``\phi_2(t) = 10`` for ``t \leq 0``, where -``f(y) = a / (1 + K y^r)``, ``\hat{s}_0 = 0.00372``, ``T_1 = 3``, ``\gamma = 0.1``, +``ϕ_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``, ``Q = 0.00178``, ``k = 6.65``, ``a = 15600``, ``K = 0.0382``, and ``r = 6.96``. # References @@ -427,19 +423,19 @@ end Delay differential equation ```math -u_1'(t) = u_2(t), -``` -```math -u_2'(t) = - u_2(\exp(1 - u_2(t))) u_2(t)^2 \exp(1 - u_2(t)), +\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 ```math -\phi_1(t) = \log t, -``` -```math -\phi_2(t) = 1 / t, +\begin{align*} +ϕ_1(t) &= \log t, \\ +ϕ_2(t) &= 1 / t, +\end{align*} ``` for ``t \in (0, 0.1]``. @@ -449,10 +445,10 @@ for ``t \in (0, 0.1]``. The analytical solution for ``t \in [0.1, 5]`` is ```math -u_1(t) = \log t, -``` -```math +\begin{align*} +u_1(t) = \log t, \\ u_2(t) = 1 / t. +\end{align*} ``` # References @@ -505,34 +501,26 @@ const prob_dde_DDETST_D1 = DDEProblem( Delay differential equation model of antigen antibody dynamics with fading memory, given by ```math -u_1'(t) = - r_1 u_1(t) u_2(t) + r_2 u_3(t), -``` -```math -u_2'(t) = - r_1 u_1(t) u_2(t) + \alpha r_1 u_1(t - u_4(t)) u_2(t - u_4(t)), -``` -```math -u_3'(t) = r_1 u_1(t) u_2(t) - r_2 u_3(t), -``` -```math -u_4'(t) = 1 + \frac{3 \delta - 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(\delta u_4(t)), +\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 ```math -\phi_1(t) = 5, -``` -```math -\phi_2(t) = 0.1, -``` -```math -\phi_3(t) = 0, -``` -```math -\phi_4(t) = 0, +\begin{align*} +ϕ_1(t) &= 5, & +ϕ_2(t) &= 0.1, \\ +ϕ_3(t) &= 0, & +ϕ_4(t) &= 0, +\end{align*} ``` -for ``t \leq 0``, where ``r_1 = 0.02``, ``r_2 = 0.005``, ``\alpha = 3``, and ``\delta = 0.01``. +for ``t ≤ 0``, where ``r_1 = 0.02``, ``r_2 = 0.005``, ``α = 3``, and ``δ = 0.01``. # References @@ -577,8 +565,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 ``\phi(t) = 2 + t`` for ``t \leq 0``, where -``r = \pi / \sqrt{3} + 1/20`` and ``c = \sqrt{3} / (2 \pi) - 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 @@ -611,22 +599,22 @@ end Delay differential equation model of a logistic Gauss-type predator-prey system, given by ```math -u_1'(t) = u_1(t) (1 - u_1(t - \tau) - \rho u_1'(t - \tau)) - \frac{u_2(t) u_1(t)^2}{u_1(t)^2 + 1}, -``` -```math -u_2'(t) = u_2(t) \left(\frac{u_1(t)^2}{u_1(t)^2 + 1} - \alpha\right), +\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 ```math -\phi_1(t) = 0.33 - t / 10, -``` -```math -\phi_2(t) = 2.22 + t / 10, +\begin{align*} +ϕ_1(t) &= 0.33 - t / 10, \\ +ϕ_2(t) &= 2.22 + t / 10, +\end{align*} ``` -for ``t \leq 0``, where ``\alpha = 0.1``, ``\rho = 2.9``, and ``\tau = 0.42``. +for ``t ≤ 0``, where ``α = 0.1``, ``ρ = 2.9``, and ``τ = 0.42``. # References @@ -685,7 +673,7 @@ Delay differential equation 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 ``\phi(0) = 1`` and ``\phi'(0) = 2``. +for ``t \in [0, 1]`` with history function ``ϕ(0) = 1`` and ``ϕ'(0) = 2``. # Solution @@ -749,8 +737,8 @@ Delay differential equation u'(t) = u'(2t - 0.5) ``` -for ``t \in [0.25, 0.499]`` with history function ``\phi(t) = \exp(-t^2)`` and -``\phi'(t) = -2t \exp(-t^2)`` for ``t \leq 0.25``. +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 @@ -763,16 +751,12 @@ 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 -x_i = (1 - 2^{-i}) / 2, -``` -```math -B_i = 2 (4^{i-1} + B_{i-1}), -``` -```math -C_i = - 4^{i-2} - B_{i-1} / 2 + C_{i-1}, -``` -```math -K_i = - \exp(-4^i x_i^2 + B_i x_i + C_i) / 2^i + u_{i-1}(x_i), +\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``. @@ -837,11 +821,11 @@ const prob_dde_DDETST_F2 = DDEProblem( Delay differential equation ```math -u'(t) = \exp(-u(t)) + L_3 \left[\sin(u'(\alpha(t))) - \sin\left(\frac{1}{3 + \alpha(t)}\right)\right] +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 ``\phi(0) = \log 3`` and ``\phi'(0) = 1 / 3``, -where ``\alpha(t) = 0.5 t (1 - \cos(2 \pi t))`` and ``L_3 = 0.2``. +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 @@ -938,8 +922,8 @@ Delay differential equation u'(t) = - u'(t - u(t)^2 / 4) ``` -for ``t \in [0, 1]`` with history function ``\phi(t) = 1 - t`` for ``t \leq 0`` and -``\phi'(t) = -1`` for ``t < 0``. +for ``t \in [0, 1]`` with history function ``ϕ(t) = 1 - t`` for ``t ≤ 0`` and +``ϕ'(t) = -1`` for ``t < 0``. # Solution @@ -994,8 +978,8 @@ Delay differential equation u'(t) = - u'(u(t) - 2) ``` -for ``t \in [0, 1]`` with history function ``\phi(t) = 1 - t`` for ``t \leq 0`` and -``\phi'(t) = -1`` for ``t < 0``. +for ``t \in [0, 1]`` with history function ``ϕ(t) = 1 - t`` for ``t ≤ 0`` and +``ϕ'(t) = -1`` for ``t < 0``. # Solution @@ -1048,11 +1032,11 @@ Delay differential equation 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, 0.225 \pi]`` with history function ``\phi(0) = 0`` and ``\phi'(0) = 0``. +for ``t \in [0, 0.225 π]`` with history function ``ϕ(0) = 0`` and ``ϕ'(0) = 0``. # Solution -The analytical solution for ``t \in [0, 0.225 \pi]`` is +The analytical solution for ``t \in [0, 0.225 π]`` is ```math u(t) = - \log(\cos(2t)) / 2. @@ -1108,12 +1092,12 @@ Delay differential equation 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, \pi]`` with history function ``\phi(0) = 0`` and ``\phi'(0) = 1``, where +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, \pi]`` is +The analytical solution for ``t \in [0, π]`` is ```math u(t) = \sin(t). diff --git a/lib/DDEProblemLibrary/src/radar5.jl b/lib/DDEProblemLibrary/src/radar5.jl index 7f7a04c..f06f5bf 100644 --- a/lib/DDEProblemLibrary/src/radar5.jl +++ b/lib/DDEProblemLibrary/src/radar5.jl @@ -11,23 +11,23 @@ http://www.unige.ch/~hairer/radar5-v2.1.tar Delay differential equation model from chemical kinetics, given by ```math - u_1'(t) = - k_1 A u_2(t) - k_2 u_1(t) u_2(t - \tau) + k_3 B u_1(t) - 2 k_4 u_1(t)^2, -``` -```math - u_2'(t) = - k_1 A u_2(t) - k_2 u_1(t) u_2(t - \tau) + f k_3 B u_1(t), +\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*} ``` for ``t \in [0, 100.5]`` with history function ```math - \phi_1(t) = 1e-10, -``` -```math - \phi_2(t) = 1e-5, +\begin{align*} + ϕ_1(t) &= 10^{-10}, \\ + ϕ_2(t) &= 10^{-5}, +\end{align*} ``` -for ``t \leq 0``, where ``k_1 = 1.34``, ``k_2 = 1.6e9``, ``k_3 = 8000``, ``k_4 = 4e7``, -``k_5 = 1``, ``f = 1``, ``A = 0.06``, ``B = 0.06``, and ``\tau = 0.15``. +for ``t ≤ 0``, where ``k_1 = 1.34``, ``k_2 = 1.6×10^9``, ``k_3 = 8000``, ``k_4 = 4×10^7``, +``k_5 = 1``, ``f = 1``, ``A = 0.06``, ``B = 0.06``, and ``τ = 0.15``. # References @@ -75,18 +75,16 @@ Delay differential equation model of a chemical reaction with steady state solut by ```math - u_1'(t) = - a u_1(t) + b u_2(t - \tau) u_3(t), -``` -```math - u_2'(t) = a u_1(t) - b u_2(t - \tau) u_3(t) - c u_2(t)^2, -``` -```math - 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*} ``` -for ``t \in [0, 10e10]`` with history function ``\phi_1(0) = 1``, ``\phi_2(t) = 0`` for -``t \in [-\tau, 0]``, and ``\phi_3(0) = 0``, where ``a = 0.04``, ``b = 10_000``, -``c = 3e7``, and ``\tau = 0.01``. +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 @@ -132,47 +130,31 @@ end Delay differential equation model of antibody production, given by ```math - u_1'(t) = - r u_1(t) u_2(t) - s u_1(t) u_4(t), -``` -```math - u_2'(t) = - r u_1(t) u_2(t) + \alpha r u_1(u_5(t)) u_2(u_5(t)) [t \geq t_0], -``` -```math - u_3'(t) = r u_1(t) u_2(t), -``` -```math - u_4'(t) = - s u_1(t) u_4(t) - \gamma u_4(t) + \beta r u_1(u_6(t)) u_2(u_6(t)) [t > t_1], -``` -```math - u_5'(t) = [t \geq 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))}, -``` -```math - u_6'(t) = [t \geq t_1] \frac{1e-12 + u_2(t) + u_3(t)}{1e-12 + u_2(u_6(t)) + u_3(u_6(t))}, +\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 ```math - \phi_1(t) = \phi_0, -``` -```math - \phi_2(t) = 1e-15, -``` -```math - \phi_3(t) = 0, -``` -```math - \phi_4(t) = 0, -``` -```math - \phi_5(t) = 0, -``` -```math - \phi_6(t) = 0, +\begin{align*} + ϕ_1(t) &= ϕ_0, & + ϕ_2(t) &= 10^{-15}, \\ + ϕ_3(t) &= 0, & + ϕ_4(t) &= 0, \\ + ϕ_5(t) &= 0, & + ϕ_6(t) &= 0, +\end{align*} ``` -for ``t \leq 0``, where ``\alpha = 1.8``, ``\beta = 20``, ``\gamma = 0.002``, ``r = 5e4``, -``s = 1e5``, ``t_0 = 32``, ``t_1 = 119``, and ``\phi_0 = 0.75e-4``. +for ``t ≤ 0``, where ``α = 1.8``, ``β = 20``, ``γ = 0.002``, ``r = 5×10^4``, +``s = 10^5``, ``t_0 = 32``, ``t_1 = 119``, and ``ϕ_0 = 0.75×10^{-4}``. # References @@ -235,8 +217,8 @@ 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`] with ``t_0 = 32``, -``t_1 = 111``, and ``\phi_0 = 0.5e-4``. +Same delay differential equation as [`prob_dde_RADAR5_waltman`](@ref) with ``t_0 = 32``, +``t_1 = 111``, and ``ϕ_0 = 0.5×10^{-4}``. # References @@ -249,8 +231,8 @@ const prob_dde_RADAR5_waltman_2 = remake(prob_dde_RADAR5_waltman; @doc raw""" prob_dde_RADAR5_waltman_3 -Same delay differential equation as [`prob_dde_RADAR5_waltman`] with ``t_0 = 33``, -``t_1 = 145``, and ``\phi_0 = 1e-5``. +Same delay differential equation as [`prob_dde_RADAR5_waltman`](@ref) with ``t_0 = 33``, +``t_1 = 145``, and ``ϕ_0 = 10^{-5}``. # References @@ -263,8 +245,8 @@ const prob_dde_RADAR5_waltman_3 = remake(prob_dde_RADAR5_waltman; @doc raw""" prob_dde_RADAR5_waltman_4 -Same delay differential equation as [`prob_dde_RADAR5_waltman`] with ``t_0 = 34``, -``t_1 = 163``, and ``\phi_0 = 0.75e-5``. +Same delay differential equation as [`prob_dde_RADAR5_waltman`](@ref) with ``t_0 = 34``, +``t_1 = 163``, and ``ϕ_0 = 0.75×10^{-5}``. # References @@ -277,8 +259,8 @@ const prob_dde_RADAR5_waltman_4 = remake(prob_dde_RADAR5_waltman; @doc raw""" prob_dde_RADAR5_waltman_5 -Same delay differential equation as [`prob_dde_RADAR5_waltman`] with ``t_0 = 35``, -``t_1 = 197``, and ``\phi_0 = 0.5e-5``. +Same delay differential equation as [`prob_dde_RADAR5_waltman`](@ref) with ``t_0 = 35``, +``t_1 = 197``, and ``ϕ_0 = 0.5×10^{-5}``. # References diff --git a/lib/ODEProblemLibrary/src/brusselator_prob.jl b/lib/ODEProblemLibrary/src/brusselator_prob.jl index f34c7bf..4a2b30e 100644 --- a/lib/ODEProblemLibrary/src/brusselator_prob.jl +++ b/lib/ODEProblemLibrary/src/brusselator_prob.jl @@ -59,10 +59,10 @@ xyd_brusselator = range(0, stop = 1, length = 32) 2D Brusselator ```math -\frac{\partial u}{\partial t} = 1 + u^2v - 4.4u + \alpha(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}) + f(x, y, t) -``` -```math -\frac{\partial v}{\partial t} = 3.4u - u^2v + \alpha(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}) +\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 @@ -77,19 +77,19 @@ f(x, y, t) = \begin{cases} and the initial conditions are ```math -u(x, y, 0) = 22\cdot y(1-y)^{3/2} -``` -```math -v(x, y, 0) = 27\cdot x(1-x)^{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*} ``` with the periodic boundary condition ```math -u(x+1,y,t) = u(x,y,t) -``` -```math -u(x,y+1,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*} ``` From Hairer Norsett Wanner Solving Ordinary Differential Equations II - Stiff and Differential-Algebraic Problems Page 152 @@ -130,28 +130,28 @@ end 1D Brusselator ```math -\frac{\partial u}{\partial t} = A + u^2v - (B+1)u + \alpha\frac{\partial^2 u}{\partial x^2} -``` -```math -\frac{\partial v}{\partial t} = Bu - u^2v + \alpha\frac{\partial^2 u}{\partial x^2} +\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 -u(x,0) = 1+\sin(2π x) -``` -```math -v(x,0) = 3 +\begin{align*} +u(x,0) &= 1 + \sin(2πx) \\ +v(x,0) &= 3 +\end{align*} ``` with the boundary condition ```math -u(0,t) = u(1,t) = 1 -``` -```math +\begin{align*} +u(0,t) = u(1,t) = 1 \\ v(0,t) = v(1,t) = 3 +\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 54415a7..9f2885d 100644 --- a/lib/ODEProblemLibrary/src/nonlinchem.jl +++ b/lib/ODEProblemLibrary/src/nonlinchem.jl @@ -23,15 +23,11 @@ nonLinChem_f = ODEFunction(nonLinChem, analytic = nlc_analytic) Nonlinear system of reactions with an analytical solution ```math -\frac{dy_1}{dt} = -y_1 -``` - -```math -\frac{dy_2}{dt} = y_1 - y_2^2 -``` - -```math -\frac{dy_3}{dt} = y_2^2 +\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)`` diff --git a/lib/ODEProblemLibrary/src/ode_linear_prob.jl b/lib/ODEProblemLibrary/src/ode_linear_prob.jl index 042d27d..0ee61ca 100644 --- a/lib/ODEProblemLibrary/src/ode_linear_prob.jl +++ b/lib/ODEProblemLibrary/src/ode_linear_prob.jl @@ -1,17 +1,17 @@ # 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_0e^{αt} +u(t) = u_0 e^{αt} ``` with Float64s. The parameter is ``α`` @@ -19,17 +19,17 @@ with Float64s. The parameter is ``α`` prob_ode_linear = ODEProblem(ODEFunction(linear, analytic = linear_analytic), 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_0e^{αt} +u(t) = u_0 e^{αt} ``` with BigFloats @@ -39,18 +39,18 @@ prob_ode_bigfloatlinear = ODEProblem(ODEFunction(linear, analytic = linear_analy f_2dlinear = (du, u, p, t) -> (@. du = p * u) f_2dlinear_analytic = (u0, p, t) -> @. u0 * exp(p * t) -""" -4x2 version of the Linear ODE +@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, +with initial condition ``u_0`` as all uniformly distributed random numbers, ``α=1.01``, and solution ```math -u(t) = u_0e^{αt} +u(t) = u_0 e^{αt} ``` with Float64s @@ -58,18 +58,18 @@ with Float64s prob_ode_2Dlinear = ODEProblem(ODEFunction(f_2dlinear, analytic = f_2dlinear_analytic), rand(4, 2), (0.0, 1.0), 1.01) -""" -100x100 version of the Linear ODE +@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, +with initial condition ``u_0`` as all uniformly distributed random numbers, ``α=1.01``, and solution ```math -u(t) = u_0e^{αt} +u(t) = u_0 e^{αt} ``` with Float64s @@ -78,18 +78,18 @@ prob_ode_large2Dlinear = ODEProblem( ODEFunction(f_2dlinear, analytic = f_2dlinear_analytic), rand(100, 100), (0.0, 1.0), 1.01) -""" -4x2 version of the Linear ODE +@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, +with initial condition ``u_0`` as all uniformly distributed random numbers, ``α=1.01``, and solution ```math -u(t) = u_0e^{αt} +u(t) = u_0 e^{αt} ``` with BigFloats @@ -101,18 +101,18 @@ prob_ode_bigfloat2Dlinear = ODEProblem( big(1.01)) f_2dlinear_notinplace = (u, p, t) -> p * u -""" -4x2 version of the Linear ODE +@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, +with initial condition ``u_0`` as all uniformly distributed random numbers, ``α=1.01``, and solution ```math -u(t) = u_0e^{αt} +u(t) = u_0 e^{αt} ``` on Float64. Purposefully not in-place as a test. diff --git a/lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl b/lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl index a735995..b101f05 100644 --- a/lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl +++ b/lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl @@ -11,10 +11,10 @@ end Lotka-Volterra Equations (Non-stiff) ```math -\frac{dx}{dt} = ax - bxy -``` -```math -\frac{dy}{dt} = -cy + dxy +\begin{align*} +\frac{dx}{dt} &= ax - bxy \\ +\frac{dy}{dt} &= -cy + dxy \\ +\end{align*} ``` with initial condition ``x=y=1`` @@ -37,10 +37,10 @@ end Fitzhugh-Nagumo (Non-stiff) ```math -\frac{dv}{dt} = v - \frac{v^3}{3} - w + I_{est} -``` -```math -τ \frac{dw}{dt} = v + a -bw +\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`` @@ -72,10 +72,10 @@ end Van der Pol Equations ```math -\frac{dx}{dt} = y -``` -```math -\frac{dy}{dt} = μ ((1-x^2)y - x) +\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``) @@ -89,10 +89,10 @@ prob_ode_vanderpol = ODEProblem(ODEFunction(vanderpol, jac=vanderpol_jac), Van der Pol Equations ```math -\frac{dx}{dt} = y -``` -```math -\frac{dy}{dt} = μ ((1-x^2)y - x) +\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``) @@ -119,20 +119,18 @@ end The Robertson biochemical reactions: (Stiff) ```math -\frac{dy₁}{dt} = -k₁y₁+k₃y₂y₃ -``` -```math -\frac{dy₂}{dt} = k₁y₁-k₂y₂^2-k₃y₂y₃ -``` -```math -\frac{dy₃}{dt} = k₂y₂^2 +\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\times10^7``, ``k₃=10^4``. For details, see: +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 -Usually solved on ``[0,1e11]`` +Usually solved on ``[0,10^{11}]`` """ prob_ode_rober = ODEProblem(rober, [1.0, 0.0, 0.0], (0.0, 1e11), [0.04, 3e7, 1e4]) @@ -161,22 +159,18 @@ end The ThreeBody problem as written by Hairer: (Non-stiff) ```math -\frac{dy₁}{dt} = y₁ + 2\frac{dy₂}{dt} - \bar{μ}\frac{y₁+μ}{D₁} - μ\frac{y₁-\bar{μ}}{D₂} -``` -```math -\frac{dy₂}{dt} = y₂ - 2\frac{dy₁}{dt} - \bar{μ}\frac{y₂}{D₁} - μ\frac{y₂}{D₂} -``` -```math -D₁ = ((y₁+μ)^2 + y₂^2)^{3/2} +\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 -D₂ = ((y₁-\bar{μ})^2+y₂^2)^{3/2} -``` -```math -μ = 0.012277471 -``` -```math -\bar{μ} =1-μ +\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 @@ -206,13 +200,11 @@ end Rigid Body Equations (Non-stiff) ```math -\frac{dy₁}{dt} = I₁y₂y₃ -``` -```math -\frac{dy₂}{dt} = I₂y₁y₃ -``` -```math -\frac{dy₃}{dt} = I₃y₁y₂ +\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``. @@ -252,76 +244,41 @@ end Pleiades Problem (Non-stiff) ```math -\frac{d^2xᵢ}{dt^2} = \sum_{j≠i} mⱼ(xⱼ-xᵢ)/rᵢⱼ -``` -```math -\frac{d^2yᵢ}{dt^2} = \sum_{j≠i} mⱼ(yⱼ-yᵢ)/rᵢⱼ +\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ᵢⱼ = ((xᵢ-xⱼ)^2 + (yᵢ-yⱼ)^2)^{3/2} +rᵢⱼ = \left((xᵢ-xⱼ)^2 + (yᵢ-yⱼ)^2\right)^{3/2} ``` and initial conditions are ```math -x₁(0) = 3 -``` -```math -x₂(0) = 3 -``` -```math -x₃(0) = -1 -``` -```math -x₄(0) = -3 -``` -```math -x₅(0) = 2 -``` -```math -x₆(0) = -2 -``` -```math -x₇(0) = 2 -``` -```math -y₁(0) = 3 -``` -```math -y₂(0) = -3 -``` -```math -y₃(0) = 2 -``` -```math -y₄(0) = 0 -``` -```math -y₅(0) = 0 -``` -```math -y₆(0) = -4 -``` -```math -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*} ``` -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 -\frac{dx₆(0)}{dt} = 1.75 -``` -```math -\frac{dx₇(0)}{dt} = -1.5 -``` -```math -\frac{dy₄(0)}{dt} = -1.25 -``` -```math -\frac{dy₅(0)}{dt} = 1 +\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 @@ -409,7 +366,18 @@ It is in the form of where ``f`` is defined by -``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}`` +```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 \\ +−280y_6y_8 + 1.81y_7 +\end{pmatrix} +``` Reference: [demohires.pdf](http://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoHires/demohires.pdf) Notebook: [Hires.ipynb](http://nbviewer.jupyter.org/github/JuliaDiffEq/DiffEqBenchmarks.jl/blob/master/StiffODE/Hires.ipynb) @@ -438,9 +406,15 @@ y \in ℝ^3, \quad 0 ≤ t ≤ 360 where ``f`` is defined by -``f(y) = \begin{pmatrix} s(y_2 - y_1(1-qy_1-y_2)) \\ (y_3 - y_2(1+y_1))/s \\ w(y_1-y_3) \end{pmatrix}`` +```math +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} +``` -where ``s=77.27``, ``w=0.161`` and ``q=8.375⋅10^{-6}``. +where ``s=77.27``, ``w=0.161`` and ``q=8.375×10^{-6}``. Reference: [demoorego.pdf](http://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoOrego/demoorego.pdf) Notebook: [Orego.ipynb](http://nbviewer.jupyter.org/github/JuliaDiffEq/DiffEqBenchmarks.jl/blob/master/StiffODE/Orego.ipynb) diff --git a/lib/ODEProblemLibrary/src/pollution_prob.jl b/lib/ODEProblemLibrary/src/pollution_prob.jl index ba77fab..e415127 100644 --- a/lib/ODEProblemLibrary/src/pollution_prob.jl +++ b/lib/ODEProblemLibrary/src/pollution_prob.jl @@ -205,7 +205,30 @@ y(0)=y_0, \quad y \in ℝ^{20}, \quad 0 ≤ t ≤ 60 where ``f`` is defined by -``f(y) = \begin{pmatrix} -\sum_{j∈{1,10,14,23,24}} r_j + \sum_{j∈{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}`` +```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} \\ +-r_{25} + r_{24} +\end{pmatrix} +``` with the initial condition of diff --git a/lib/ODEProblemLibrary/src/strange_attractors.jl b/lib/ODEProblemLibrary/src/strange_attractors.jl index d1c62be..ddc0037 100644 --- a/lib/ODEProblemLibrary/src/strange_attractors.jl +++ b/lib/ODEProblemLibrary/src/strange_attractors.jl @@ -16,11 +16,11 @@ end Thomas' cyclically symmetric attractor equations ```math -\begin{align} +\begin{align*} \frac{dx}{dt} &= \sin(y) - bx \\ \frac{dy}{dt} &= \sin(z) - by \\ \frac{dz}{dt} &= \sin(x) - bz -\end{align} +\end{align*} ``` with parameter ``b = 0.208186`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -46,11 +46,11 @@ end Lorenz equations ```math -\begin{align} +\begin{align*} \frac{dx}{dt} &= σ(y - x) \\ \frac{dy}{dt} &= x(ρ - z) - y \\ \frac{dz}{dt} &= xy - βz -\end{align} +\end{align*} ``` with parameters ``σ=10, ρ=28, β=8/3`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -76,11 +76,11 @@ end Aizawa equations ```math -\begin{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} +\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`` @@ -104,11 +104,11 @@ end Dadras equations ```math -\begin{align} +\begin{align*} \frac{dx}{dt} &= y - ax + byz \\ \frac{dy}{dt} &= cy - xz + z \\ \frac{dz}{dt} &= dxy - ez -\end{align} +\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`` @@ -132,11 +132,11 @@ end Chen equations ```math -\begin{align} +\begin{align*} \frac{dx}{dt} &= a(y - x) \\ \frac{dy}{dt} &= (c - a)x - xz + cy \\ \frac{dz}{dt} &= xy - bz -\end{align} +\end{align*} ``` with parameters ``a=35, b=3, c=28`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -160,11 +160,11 @@ end Rössler equations ```math -\begin{align} +\begin{align*} \frac{dx}{dt} &= -(y + z) \\ \frac{dy}{dt} &= x + ay \\ \frac{dz}{dt} &= b + z(x - c) -\end{align} +\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`` @@ -189,11 +189,11 @@ end Rabinovich-Fabrikant equations ```math -\begin{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} +\end{align*} ``` with parameters ``a=0.14, b=0.10`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -217,11 +217,11 @@ end Sprott equations ```math -\begin{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} +\end{align*} ``` with parameters ``a=2.07, b=1.79`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` @@ -245,14 +245,14 @@ end Hindmarsh-Rose equations ```math -\begin{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} +\end{align*} ``` -with parameters ``a=1, b=3, c=1, d=5, r=1e-2, s=4, x_r=-8/5, i=5`` and initial conditions ``x(0)=1, y(0)=0, z(0)=0`` +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`` [Reference](https://en.wikipedia.org/wiki/Hindmarsh%E2%80%93Rose_model) """ diff --git a/lib/SDEProblemLibrary/src/SDEProblemLibrary.jl b/lib/SDEProblemLibrary/src/SDEProblemLibrary.jl index da847ad..cb9c450 100644 --- a/lib/SDEProblemLibrary/src/SDEProblemLibrary.jl +++ b/lib/SDEProblemLibrary/src/SDEProblemLibrary.jl @@ -23,12 +23,12 @@ linear_analytic(u0, p, t, W) = @.(u0*exp(0.63155t + 0.87W)) @doc doc""" ```math -du_t = αudt + βudW_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((α-\frac{β^2}{2})t+βW_t) +u(u_0,p,t,W_t) = u_0 \exp\left(\left(α - \tfrac{1}{2}β^2\right) t + βW_t\right) ``` """ @@ -44,15 +44,15 @@ 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 4x2 matrix): +8 linear SDEs (as a 4×2 matrix): ```math -du_t = αudt + βudW_t +du_t = αu\,dt + βu\,dW_t ``` 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((α-\frac{β^2}{2})t+βW_t) +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( @@ -70,13 +70,13 @@ cubic_analytic(u0, p, t, W) = @. ((1 + u0) * exp(W) + u0 - 1) / ((1 + u0) * exp( 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 ```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)) @@ -87,13 +87,13 @@ 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(\frac{W_t}{10} + \tan(u_0)) +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)) @@ -107,7 +107,7 @@ ff_additive = SDEFunction(f_additive, σ_additive, analytic = additive_analytic) Additive noise problem ```math -u_t = (\frac{β}{\sqrt{1+t}}-\frac{1}{2(1+t)}u_t)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 @@ -139,13 +139,11 @@ end Lorenz Attractor with additive noise ```math -dx = σ(y-x)dt + αdW_t -``` -```math -dy = (x(ρ-z) - y)dt + αdW_t -``` -```math -dz = (xy - βz)dt + αdW_t +\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]``.