diff --git a/CHANGELOG.md b/CHANGELOG.md index e5884a48b8..7d5855bb19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ example notebook ([#1602](https://github.com/pybamm-team/PyBaMM/pull/1602)) ## Bug fixes +- Updated documentation to include some previously missing functions, such as `erf` and `tanh` ([#1628](https://github.com/pybamm-team/PyBaMM/pull/1628)) - Fixed reading citation file without closing ([#1620](https://github.com/pybamm-team/PyBaMM/pull/1620)) - Porosity variation for SEI and plating models is calculated from the film thickness rather than from a separate ODE ([#1617](https://github.com/pybamm-team/PyBaMM/pull/1617)) - Fixed a bug where the order of the indexing for the entries of variables discretised using FEM was incorrect ([#1556](https://github.com/pybamm-team/PyBaMM/pull/1556)) diff --git a/docs/source/expression_tree/functions.rst b/docs/source/expression_tree/functions.rst index 4ffecf4b68..17f79c7692 100644 --- a/docs/source/expression_tree/functions.rst +++ b/docs/source/expression_tree/functions.rst @@ -7,6 +7,16 @@ Functions .. autoclass:: pybamm.SpecificFunction :members: +.. autoclass:: pybamm.Arcsinh + :members: + +.. autofunction:: pybamm.arcsinh + +.. autoclass:: pybamm.Arctan + :members: + +.. autofunction:: pybamm.arctan + .. autoclass:: pybamm.Cos :members: @@ -17,6 +27,13 @@ Functions .. autofunction:: pybamm.cosh +.. autoclass:: pybamm.Erf + :members: + +.. autofunction:: pybamm.erf + +.. autofunction:: pybamm.erfc + .. autoclass:: pybamm.Exponential :members: @@ -27,10 +44,20 @@ Functions .. autofunction:: pybamm.log +.. autofunction:: pybamm.log10 + +.. autoclass:: pybamm.Max + :members: + .. autofunction:: pybamm.max +.. autoclass:: pybamm.Min + :members: + .. autofunction:: pybamm.min +.. autofunction:: pybamm.sech + .. autoclass:: pybamm.Sin :members: @@ -40,3 +67,13 @@ Functions :members: .. autofunction:: pybamm.sinh + +.. autoclass:: pybamm.Sqrt + :members: + +.. autofunction:: pybamm.sqrt + +.. autoclass:: pybamm.Tanh + :members: + +.. autofunction:: pybamm.tanh diff --git a/pybamm/expression_tree/functions.py b/pybamm/expression_tree/functions.py index cb8252a76c..ebe2cfd356 100644 --- a/pybamm/expression_tree/functions.py +++ b/pybamm/expression_tree/functions.py @@ -311,6 +311,22 @@ def arcsinh(child): return simplified_function(Arcsinh, child) +class Arctan(SpecificFunction): + """Arctan function.""" + + def __init__(self, child): + super().__init__(np.arctan, child) + + def _function_diff(self, children, idx): + """See :meth:`pybamm.Function._function_diff()`.""" + return 1 / (children[0] ** 2 + 1) + + +def arctan(child): + """Returns hyperbolic tan function of child.""" + return simplified_function(Arctan, child) + + class Cos(SpecificFunction): """Cosine function.""" @@ -343,6 +359,27 @@ def cosh(child): return simplified_function(Cosh, child) +class Erf(SpecificFunction): + """Error function.""" + + def __init__(self, child): + super().__init__(special.erf, child) + + def _function_diff(self, children, idx): + """See :meth:`pybamm.Function._function_diff()`.""" + return 2 / np.sqrt(np.pi) * Exponential(-children[0] ** 2) + + +def erf(child): + """Returns error function of child.""" + return simplified_function(Erf, child) + + +def erfc(child): + """Returns complementary error function of child.""" + return 1 - simplified_function(Erf, child) + + class Exponential(SpecificFunction): """Exponential function.""" @@ -491,40 +528,3 @@ def _function_diff(self, children, idx): def tanh(child): """Returns hyperbolic tan function of child.""" return simplified_function(Tanh, child) - - -class Arctan(SpecificFunction): - """Arctan function.""" - - def __init__(self, child): - super().__init__(np.arctan, child) - - def _function_diff(self, children, idx): - """See :meth:`pybamm.Function._function_diff()`.""" - return 1 / (children[0] ** 2 + 1) - - -def arctan(child): - """Returns hyperbolic tan function of child.""" - return simplified_function(Arctan, child) - - -class Erf(SpecificFunction): - """Error function.""" - - def __init__(self, child): - super().__init__(special.erf, child) - - def _function_diff(self, children, idx): - """See :meth:`pybamm.Function._function_diff()`.""" - return 2 / np.sqrt(np.pi) * Exponential(-children[0] ** 2) - - -def erf(child): - """Returns error function of child.""" - return simplified_function(Erf, child) - - -def erfc(child): - """Returns complementary error function of child.""" - return 1 - simplified_function(Erf, child)