diff --git a/doc/convergence.rst b/doc/convergence.rst new file mode 100644 index 0000000000000000000000000000000000000000..f4c28775ec4107f2d61840f17964feb97ce46073 --- /dev/null +++ b/doc/convergence.rst @@ -0,0 +1,4 @@ +Testing convergence +------------------- + +.. automodule:: pytools.convergence diff --git a/doc/index.rst b/doc/index.rst index 1a1e9c444a55b9f7aed9aeb27b0bf8bfc725daea..f37ab972a2eb43b19ee3ca4cc69667f9fc9dc0ae 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -8,6 +8,7 @@ Welcome to pytools's documentation! reference obj_array persistent_dict + convergence graph tag codegen diff --git a/pytools/convergence.py b/pytools/convergence.py index ead7f97ff6425c2f5f054a26ca85f29cd3e403b0..aa85c2014f9dfd5367a10d45bfca8f377a0ea295 100644 --- a/pytools/convergence.py +++ b/pytools/convergence.py @@ -1,3 +1,11 @@ +""" +.. autofunction:: estimate_order_of_convergence +.. autoclass:: EOCRecorder +.. autofunction:: stringify_eocs +.. autoclass:: PConvergenceVerifier +""" + + import numbers from typing import List, Optional, Tuple @@ -7,9 +15,11 @@ import numpy as np # {{{ eoc estimation -------------------------------------------------------------- def estimate_order_of_convergence(abscissae, errors): - """Assuming that abscissae and errors are connected by a law of the form + r"""Assuming that abscissae and errors are connected by a law of the form + + .. math:: - error = constant * abscissa ^ (order), + \text{Error} = \text{constant} \cdot \text{abscissa }^{\text{order}}, this function finds, in a least-squares sense, the best approximation of constant and order for the given data set. It returns a tuple (constant, order).