22 % A simple linear differential algebraic problem.
33 %
44 % The Ascher linear DAE Problem :cite:p:`Asc89` is an index-1 differential agebraic
5- % equation given by $M(t) y' = A(t) y + q(t) $ where
5+ % equation given by
66 %
77 % $$
8- % M=\left(\ begin{array}{cc }
8+ % \ begin{bmatrix }
99 % 1 & -t \\
1010 % 0 & 0
11- % \end{array}\right), \quad A= \left( \begin{array}{cc}
11+ % \end{bmatrix} \begin{bmatrix} y'(t) \\ z'(t) \end{bmatrix} = \left[ \begin{array}{cc}
1212 % -1 & 1+t \\
1313 % \beta & -1-\beta t
14- % \end{array}\right), \quad {q}=\left(\begin{array}{c }
14+ % \end{array}\right] \begin{bmatrix} y(t) \\ z(t) \end{bmatrix} + \begin{bmatrix }
1515 % 0 \\
1616 % \sin t
17- % \end{array}\right),
17+ % \end{bmatrix}.
1818 % $$
1919 %
20- % defined on timespan $t \in [0,1]$, and initial condition $y_0 = [1, \beta]^T$. The exact solution
21- % is given by
20+ % The problem has the following closed-form solution when the initial condition $y(0) = 1 , z(0) = \beta$ is used:
2221 %
2322 % $$
24- % y = \begin{pmatrix }
23+ % \begin{bmatrix} y(t)\\ z(t) \end{bmatrix} = \begin{bmatrix }
2524 % t \sin(t) + (1 + \beta t) e^{-t}\\
2625 % \beta e^{-t} + \sin(t)
27- % \end{pmatrix }.
26+ % \end{bmatrix }.
2827 % $$
29- %
30- % Due to its stiffness and time-dependant mass
31- % matrix, this simple DAE problem can
32- % become challenging to solve. This problem is introduced in :cite:p:`Asc89`
33- % to study the convergence of implcit solvers applied to DAEs.
28+ % This DAE problem
29+ % can be used to investigate
30+ % the convergence of implcit time-stepping methods due to its stiffness and time-dependant mass
31+ % matrix.
3432 %
3533 % Notes
3634 % -----
3937 % +---------------------+-----------------------------------------+
4038 % | Number of Variables | 2 |
4139 % +---------------------+-----------------------------------------+
42- % | Stiff | typically , depending on $\beta$ |
40+ % | Stiff | possibly , depending on $\beta$ |
4341 % +---------------------+-----------------------------------------+
4442 %
4543 % Example
4644 % -------
47- % >>> problem = otp.ascherlineardae.presets.Canonical(0.1);
48- % >>> sol = problem.solve('MaxStep',1e-5);
49- % >>> problem.plotPhaseSpace(sol);
45+ % >>> problem = otp.ascherlineardae.presets.Canonical('Beta', 50);
46+ % >>> t = linspace(0,1,100);
47+ % >>> sol = problem.solveExcatly(t);
48+ % >>> problem.plot(sol);
5049
5150 properties (Access = private , Constant )
5251 NumComps = 2
6564 % The initial conditions.
6665 % parameters : AscherLinearDAEParameters
6766 % The parameters.
68- %
69- % Returns
70- % -------
71- % obj : AscherLinearDAEProblem
72- % The constructed problem.
7367 obj@otp.Problem(' Ascher Linear DAE' , 2 , timeSpan , y0 , parameters );
7468 end
7569 end
@@ -85,7 +79,8 @@ function onSettingsChanged(obj)
8579 ' MassSingular' , ' yes' );
8680 end
8781
88- function y = internalSolveExactly(obj , t )
82+ function sol = internalSolveExactly(obj , t )
83+ sol = [];
8984 beta = obj .Parameters .Beta ;
9085 if ~isequal(obj .Y0 , [1 ; beta ])
9186 error(' OTP:noExactSolution' , ...
@@ -94,6 +89,8 @@ function onSettingsChanged(obj)
9489
9590 y = [t .* sin(t ) + (1 + beta * t ) .* exp(-t ); ...
9691 beta * exp(-t ) + sin(t )];
92+ sol.x = t ;
93+ sol.y = y ;
9794 end
9895
9996 function sol = internalSolve(obj , varargin )
0 commit comments