Skip to content

Commit 70c2833

Browse files
committed
Documentation and code clean-up. We are very close to the next dot-release.
1 parent 3a95620 commit 70c2833

16 files changed

+458
-230
lines changed

Numerics/Analysis/FunctionMath_Odes.cs

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ public static partial class FunctionMath {
2323
/// <exception cref="ArgumentNullException">The <paramref name="rhs"/> is null.</exception>
2424
/// <exception cref="NonconvergenceException">The ODE could not be integrated to the required precision before exhausting the maximum allowed number of <paramref name="rhs"/> evaluations.</exception>
2525
/// <remarks>
26-
/// <para>A conservative ordinary differential equation has the form</para>
27-
/// <img src="../images/ConservativeODE.png" />
28-
/// <para>where the right-hand-side depends only on x and y, not on the derivative y'. ODEs of this form are called conservative because
29-
/// they exhibit conserved quantities: combinations of y and y' that maintain the same value as the system evolves. Many forms of
30-
/// Newtonian equations of motion, for example, are conservative ODEs, with conserved quantities such as energy, momentum, and
31-
/// angular momentum. Our specialized conservative ODE integrator is not only more efficient for conservative ODEs, but does a
32-
/// better job of maintaining the conserved quantities.</para>
26+
/// <para>For information on integrating conservative ODEs, see
27+
/// <see cref="IntegrateConservativeOde(Func{double, double, double}, double, double, double, double, OdeEvaluationSettings)"/>.</para>
28+
/// <para>This overload uses default values for precision and evaluation budget. It targets a relative precision of
29+
/// about 10<sup>-12</sup> and an absolute precision of about 10<sup>-24</sup> with an evaluation budget of about 8000.
30+
/// </para>
3331
/// </remarks>
3432
public static OdeResult IntegrateConservativeOde (Func<double, double, double> rhs, double x0, double y0, double yPrime0, double x1) {
3533
return (IntegrateConservativeOde(rhs, x0, y0, yPrime0, x1, new OdeEvaluationSettings()));
@@ -83,22 +81,9 @@ public static OdeResult IntegrateConservativeOde (Func<double, double, double> r
8381
/// <exception cref="ArgumentNullException">The <paramref name="rhs"/> is null.</exception>
8482
/// <exception cref="NonconvergenceException">The ODE could not be integrated to the required precision before exhausting the maximum allowed number of <paramref name="rhs"/> evaluations.</exception>
8583
/// <remarks>
86-
/// <para>An ordinary differential equation (ODE) has the form:</para>
87-
/// <img src="../images/ODE.png" />
88-
/// <para>The function specifying the derivative as a function of x and y is called the right-hand-side (RHS).</para>
89-
/// <para>The integration of an ODE consists of specifying the value of y at some initial x and computing its value
90-
/// at a different x in accordance with the differential equation. The terms "initial" and "final" are derived from
91-
/// the common case where the indepdent variable is time, but the technique applies whether the independent variable
92-
/// repsents a time, a location, or a completely non-physical quantity, as long as the problem has form of an ODE.</para>
93-
/// <para>ODEs involving multi-dimensional, coupled dependent variables can be integrated using the
94-
/// <see cref="MultiFunctionMath.IntegrateOde(Func{double, IList{double}, IList{double}}, double, IList{double}, double)"/>
95-
/// method. Higher order ODEs can be integrated by representing them as coupled ODEs in which the zeroth component
96-
/// is the desired y, the first component is y', the second component is y'', etc. So-called conservative second order
97-
/// ODEs should be integrated using the <see cref="FunctionMath.IntegrateConservativeOde(Func{double, double, double}, double, double, double, double)"/>
98-
/// method. If your ODE's RHS depends only on x, the problem reduces to a simple integral, which can be solved more rapidly and
99-
/// accurately using the <see cref="FunctionMath.Integrate(Func{double, double}, Interval)"/> method. Analytic techniques can
100-
/// also be used to reduce several other kinds of ODEs to simple integrals or lower-order ODEs.</para>
101-
/// <para>This overload using default values for precision and evaluation budget. It targets a relative precision of
84+
/// <para>For information on integrating ODEs, see
85+
/// <see cref="IntegrateOde(Func{double, double, double}, double, double, double, OdeEvaluationSettings)"/>.</para>
86+
/// <para>This overload uses default values for precision and evaluation budget. It targets a relative precision of
10287
/// about 10<sup>-12</sup> and an absolute precision of about 10<sup>-24</sup> with an evaluation budget of about 8000.
10388
/// </para>
10489
/// </remarks>
@@ -126,18 +111,18 @@ public static OdeResult IntegrateOde (Func<double, double, double> rhs, double x
126111
/// <para>The integration of an ODE consists of specifying the value of y at some initial x and computing its value
127112
/// at a different x in accordance with the differential equation. The terms "initial" and "final" are derived from
128113
/// the common case where the indepdent variable is time, but the technique applies whether the independent variable
129-
/// repsents a time, a location, or a completely non-physical quantity, as long as the problem has form of an ODE.</para>
130-
/// <para>ODEs involving multi-dimensional, coupled dependent variables can be integrated using the
131-
/// <see cref="MultiFunctionMath.IntegrateOde(Func{double, IList{double}, IList{double}}, double, IList{double}, double)"/>
114+
/// repsents a time, a location, or a completely non-physical quantity, as long as the problem has the form of an ODE.</para>
115+
/// <para>ODEs involving multiple, coupled dependent variables can be integrated using the
116+
/// <see cref="MultiFunctionMath.IntegrateOde(Func{double, IList{double}, IList{double}}, double, IList{double}, double, MultiOdeEvaluationSettings)"/>
132117
/// method. Higher order ODEs can be integrated by representing them as coupled ODEs in which the zeroth component
133118
/// is the desired y, the first component is y', the second component is y'', etc. So-called conservative second order
134-
/// ODEs should be integrated using the <see cref="FunctionMath.IntegrateConservativeOde(Func{double, double, double}, double, double, double, double)"/>
119+
/// ODEs should be integrated using the
120+
/// <see cref="FunctionMath.IntegrateConservativeOde(Func{double, double, double}, double, double, double, double, OdeEvaluationSettings)"/>
135121
/// method. If your ODE's RHS depends only on x, the problem reduces to a simple integral, which can be solved more rapidly and
136-
/// accurately using the <see cref="FunctionMath.Integrate(Func{double, double}, Interval)"/> method. Analytic techniques can
137-
/// also be used to reduce several other kinds of ODEs to simple integrals or lower-order ODEs.</para>
122+
/// accurately using the <see cref="FunctionMath.Integrate(Func{double, double}, Interval, EvaluationSettings)"/> method.
123+
/// Analytic techniques can also be used to reduce several other kinds of ODEs to simple integrals or lower-order ODEs.</para>
138124
/// </remarks>
139125
/// <seealso href="https://en.wikipedia.org/wiki/Ordinary_differential_equation"/>
140-
141126
public static OdeResult IntegrateOde (Func<double, double, double> rhs, double x0, double y0, double x1, OdeEvaluationSettings settings) {
142127

143128
if (rhs == null) throw new ArgumentNullException(nameof(rhs));

Numerics/Analysis/MultiFunctionMath_Ode.cs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ public static partial class MultiFunctionMath {
1919
/// <param name="yPrime0">The intial values of the functions' derivatives.</param>
2020
/// <param name="x1">The final value of the independent variable.</param>
2121
/// <returns>The solution, including the final value of the functions and their derivatives.</returns>
22+
/// <remarks>
23+
/// <para>For information on integrating coupled, conservative ODEs, see
24+
/// <see cref="IntegrateConservativeOde(Func{double, IList{double}, IList{double}}, double, IList{double}, IList{double}, double, MultiOdeEvaluationSettings)"/>.</para>
25+
/// <para>This overload uses default settings for precision and evaluation budget. It targets a relative precision of
26+
/// about 10<sup>-12</sup> and an absolute precision of about 10<sup>-24</sup> with an evaluation budget of about 8000.
27+
/// </para>
28+
/// </remarks>
29+
/// <exception cref="ArgumentNullException"><paramref name="rhs"/>, <paramref name="y0"/>, or <paramref name="yPrime0"/>
30+
/// is <see langword="null"/>.</exception>
31+
/// <exception cref="DimensionMismatchException"><paramref name="y0"/> and <paramref name="yPrime0"/> do not have the same
32+
/// dimension.</exception>
33+
/// <exception cref="NonconvergenceException">The ODE could not be integrated to the required precision before exhausting
34+
/// the maximum allowed number of <paramref name="rhs"/>evaluations.</exception>
2235
public static MultiOdeResult IntegrateConservativeOde (Func<double, IList<double>, IList<double>> rhs, double x0, IList<double> y0, IList<double> yPrime0, double x1) {
2336
return (IntegrateConservativeOde(rhs, x0, y0, yPrime0, x1, new MultiOdeEvaluationSettings()));
2437
}
@@ -33,6 +46,15 @@ public static MultiOdeResult IntegrateConservativeOde (Func<double, IList<double
3346
/// <param name="x1">The final value of the independent variable.</param>
3447
/// <param name="settings">The settings to use when solving the problem.</param>
3548
/// <returns>The solution, including the final value of the functions and their derivatives.</returns>
49+
/// <exception cref="ArgumentNullException"><paramref name="rhs"/>, <paramref name="y0"/>, <paramref name="yPrime0"/>,
50+
/// or <paramref name="settings"/> is <see langword="null"/>.</exception>
51+
/// <exception cref="DimensionMismatchException"><paramref name="y0"/> and <paramref name="yPrime0"/> do not have the same
52+
/// dimension.</exception>
53+
/// <exception cref="NonconvergenceException">The ODE could not be integrated to the required precision before exhausting
54+
/// the maximum allowed number of <paramref name="rhs"/>evaluations.</exception>
55+
/// <remarks>
56+
/// <para>For information on conservative ODEs, see <see cref="FunctionMath.IntegrateConservativeOde(Func{double, double, double}, double, double, double, double, OdeEvaluationSettings)"/>.</para>
57+
/// </remarks>
3658
public static MultiOdeResult IntegrateConservativeOde (Func<double, IList<double>, IList<double>> rhs, double x0, IList<double> y0, IList<double> yPrime0, double x1, MultiOdeEvaluationSettings settings) {
3759

3860
if (rhs == null) throw new ArgumentNullException(nameof(rhs));
@@ -63,8 +85,11 @@ public static MultiOdeResult IntegrateConservativeOde (Func<double, IList<double
6385
/// <exception cref="NonconvergenceException">The ODE could not be integrated to the required precision before exhausting
6486
/// the maximum allowed number of <paramref name="rhs"/> evaluations.</exception>
6587
/// <remarks>
66-
/// <para>The default settings for ODE integration are a relative precision of about 10<sup>-12</sup>, an absolute precision
67-
/// of about 10<sup>-24</sup>, and a maximum of about 8000 right-hand-side evaluations.</para>
88+
/// <para>For infomration about integrating coupled ODEs, see
89+
/// <see cref="IntegrateOde(Func{double, IList{double}, IList{double}}, double, IList{double}, double, MultiOdeEvaluationSettings)"/>.</para>
90+
/// <para>This overload uses default settings for precision and evaluation budget. It targets a relative precision of
91+
/// about 10<sup>-12</sup> and an absolute precision of about 10<sup>-24</sup> with an evaluation budget of about 8000.
92+
/// </para>
6893
/// </remarks>
6994
public static MultiOdeResult IntegrateOde (Func<double, IList<double>, IList<double>> rhs, double x0, IList<double> y0, double x1) {
7095
return (IntegrateOde(rhs, x0, y0, x1, new MultiOdeEvaluationSettings()));
@@ -86,8 +111,8 @@ public static MultiOdeResult IntegrateOde (Func<double, IList<double>, IList<dou
86111
/// the maximum allowed number of <paramref name="rhs"/>evaluations.</exception>
87112
/// <remarks>
88113
/// <para>This method integrates a set of coupled ordinary differential equations. The dependent variable y is a vector
89-
/// with an arbitrary number of components, and the right-hand-side is a vector-valued function that gives the derivative
90-
/// of each component, and may depend on the values of all the components as well as the independent variable.
114+
/// with any number of components, and the right-hand-side is a vector-valued function that gives the derivative
115+
/// of each component. Each component's derivative may depend itself and any other components, as well as on the independent variable.
91116
/// The independent variable x still takes only a single real value.</para>
92117
/// </remarks>
93118
public static MultiOdeResult IntegrateOde (Func<double, IList<double>, IList<double>> rhs, double x0, IList<double> y0, double x1, MultiOdeEvaluationSettings settings) {

Numerics/Analysis/MultiOdeEvaluationSettings.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
namespace Meta.Numerics.Analysis {
55

66
/// <summary>
7-
/// Contains settings used to solve a multi-dimensional ordinary differential equation.
7+
/// Contains settings used to solve a set of coupled ordinary differential equations.
88
/// </summary>
99
public class MultiOdeEvaluationSettings : EvaluationSettings {
1010

1111
/// <summary>
12-
/// Initializes a new instance of evaluation settings for multiple ODEs.
12+
/// Initializes a new instance of evaluation settings for coupled ODEs.
1313
/// </summary>
1414
public MultiOdeEvaluationSettings () : base(null) { }
1515

@@ -18,11 +18,9 @@ public MultiOdeEvaluationSettings () : base(null) { }
1818
/// Gets or sets the handler that is called to report on progress toward the solution.
1919
/// </summary>
2020
/// <remarks>
21-
/// <para>
22-
/// For each successful step, this delegate is called to report the solution at the
23-
/// new abcissa. If you have the listener record these results, we can interpolate
24-
/// in order to approximate the solution at intermediate points.
25-
/// </para>
21+
/// <para>As the ODE is integrated, the specified handler is called for each integration
22+
/// step. This allows the handler to monitor progress toward the solution and to
23+
/// obtain intermediate values via interpolation.</para>
2624
/// </remarks>
2725
public Action<MultiOdeResult> Listener { get; set; }
2826

0 commit comments

Comments
 (0)