-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docs to linear problem #128
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,16 @@ | |
'show-inheritance': True | ||
} | ||
|
||
mathjax3_config = { | ||
'tex': { | ||
'macros': { | ||
'diag': ['\\operatorname{diag}'] | ||
} | ||
} | ||
} | ||
|
||
myst_heading_anchors = 2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes an unrelated warning from the contributing guide markdown |
||
|
||
bibtex_bibfiles = ['references.bib'] | ||
|
||
html_theme = 'sphinx_rtd_theme' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
classdef Alpha < otp.linear.LinearProblem | ||
%ALPHA | ||
% A diagonal linear preset with eigenvalues logarithmically spaced between distances $r_{min}$ and $r_{max}$ from | ||
% the origin at an angle $α$ measured in degrees clockwise from the negative real axis. It can be used to check for | ||
% $A(α)$ stability of a time integration scheme. This preset uses $t ∈ [0, 1]$, $y_0 = [1, 1, …, 1]^T$, and | ||
% | ||
% $$ | ||
% Λ_1 &= \diag(-r_1 e^{-i π α / 180}, -r_2 e^{-i π α / 180}, …, -r_N e^{-i π α / 180}), \\ | ||
% r_j &= r_{min}^{\frac{N - j}{N - 1}} r_{max}^{\frac{j - 1}{N - 1}}. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we do \max and \min ? that might make it look better |
||
% $$ | ||
|
||
methods | ||
function obj = Alpha(varargin) | ||
% Create the alpha linear problem object. | ||
% | ||
% Parameters | ||
% ---------- | ||
% varargin | ||
% A variable number of name-value pairs. The accepted names are | ||
% | ||
% - ``Alpha`` – The angle $α$ measured in degrees clockwise from the negative real axis. | ||
% - ``N`` – The number of eigenvalues $N$. | ||
% - ``Range`` – The range $[r_{min}, r_{max}]$ of the eigenvalues. | ||
% - ``Sparse`` – If true, the matrix will be in sparse format. Otherwise, it will be dense. | ||
|
||
p = inputParser(); | ||
p.addParameter('Alpha', 0); | ||
p.addParameter('N', 10); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,56 @@ | ||
classdef LinearProblem < otp.Problem | ||
% A linear, constant coefficient, homogeneous ODE which supports a partitioned right-hand side. | ||
% | ||
% The linear problem is given by | ||
% | ||
% $$ | ||
% y' = \sum_{i=1}^{p} Λ_i y, | ||
% $$ | ||
% | ||
% where $p$ is the number of partitions and $Λ_i ∈ ℂ^{N × N}$ for $i = 1, …, p$. | ||
% | ||
% This is often used to assess the stability of time integration methods, with the case of $p = N = 1$ referred to | ||
% as the Dahlquist test problem. | ||
% | ||
% Notes | ||
% ----- | ||
% +---------------------+----------------------------------------------------------------+ | ||
% | Type | ODE | | ||
% +---------------------+----------------------------------------------------------------+ | ||
% | Number of Variables | arbitrary | | ||
% +---------------------+----------------------------------------------------------------+ | ||
% | Stiff | possibly, depending on the eigenvalues of $\sum_{i=1}^{p} Λ_i$ | | ||
% +---------------------+----------------------------------------------------------------+ | ||
% | ||
% Example | ||
% ------- | ||
% >>> problem = otp.linear.presets.Canonical('Lambda', {-1, -2, -3}); | ||
% >>> problem.RHSPartitions{2}.JacobianMatrix | ||
% ans = -2 | ||
|
||
properties (SetAccess = private) | ||
RHSPartitions | ||
% A cell array of $p$ right-hand sides for each partition $Λ_i y$. | ||
RHSPartitions | ||
end | ||
|
||
properties (Dependent) | ||
% The number of partitions $p$. | ||
NumPartitions | ||
end | ||
|
||
methods | ||
function obj = LinearProblem(timeSpan, y0, parameters) | ||
% Create a linear problem object. | ||
% | ||
% Parameters | ||
% ---------- | ||
% timeSpan : numeric(1, 2) | ||
% The start and final time. | ||
% y0 : numeric(:, 1) | ||
% The initial conditions. | ||
% parameters : LinearParameters | ||
% The parameters. | ||
|
||
[email protected]('Linear', [], timeSpan, y0, parameters); | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh very nice that we can add macros!