Skip to content

Commit cd8a6dc

Browse files
committed
Unfrenched derivation -> derivative
1 parent 9a9e5f8 commit cd8a6dc

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

qmat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
**Utility modules** ⚙️
1010
11-
- :class:`lagrange` : Barycentric polynomial approximations (integral, interpolation, derivation)
11+
- :class:`lagrange` : Barycentric polynomial approximations (integral, interpolation, derivative)
1212
- :class:`nodes` : generation of multiple types of quadrature nodes
1313
- :class:`sdc` : utility function to run SDC on simple problems
1414
- :class:`mathutils` : utility functions for math operations

qmat/lagrange.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
"""
44
Base module for Barycentric Lagrange Approximation, based on `[Berrut & Trefethen, 2004] <https://doi.org/10.1137/S0036144502417715>`_.
5-
Allows to easily build integration / interpolation / derivation matrices, from any list of node points.
5+
Allows to easily build integration / interpolation / derivative matrices, from any list of node points.
66
77
Examples
88
--------
@@ -22,8 +22,8 @@
2222
>>> # Alternative interpolation using the object as a function
2323
>>> uFine = approx(fGrid)
2424
>>>
25-
>>> # Derivation
26-
>>> D = approx.getDerivationMatrix()
25+
>>> # Derivative
26+
>>> D = approx.getDerivativeMatrix()
2727
>>> du = D @ u
2828
"""
2929
import numpy as np
@@ -437,9 +437,9 @@ def getIntegrationMatrix(self, intervals, numQuad='FEJER', duplicates=True):
437437

438438
return Q
439439

440-
def getDerivationMatrix(self, order=1, duplicates=True):
440+
def getDerivativeMatrix(self, order=1, duplicates=True):
441441
r"""
442-
Generate derivation matrix of first or second order (or both) based on
442+
Generate derivative matrix of first or second order (or both) based on
443443
the Lagrange interpolant.
444444
The first order differentiation matrix :math:`D^{(1)}` approximates
445445
@@ -473,11 +473,11 @@ def getDerivationMatrix(self, order=1, duplicates=True):
473473
.. math::
474474
D^{(2)}_{jj} = -\sum_{i \neq j} D^{(2)}_{ij}
475475
476-
⚠️ If you want a derivation matrix with many points (~1000 or more),
476+
⚠️ If you want a derivative matrix with many points (~1000 or more),
477477
favor the use of `weightComputation="STABLE"` when initializing
478478
the `LagrangeApproximation` object. If not, some (very small) weights
479479
could be approximated by zeros, which would make the computation
480-
of the derivation matrices fail ...
480+
of the derivative matrices fail ...
481481
482482
Note
483483
----
@@ -487,7 +487,7 @@ def getDerivationMatrix(self, order=1, duplicates=True):
487487
Parameters
488488
----------
489489
order : int or str, optional
490-
The order of the derivation matrix, use "ALL" to retrieve both.
490+
The order of the derivative matrix, use "ALL" to retrieve both.
491491
The default is 1.
492492
duplicates : bool
493493
Wether or not take into account duplicates in the points.
@@ -497,8 +497,8 @@ def getDerivationMatrix(self, order=1, duplicates=True):
497497
Returns
498498
-------
499499
D : np.2darray or tuple of np.2darray
500-
Derivation matrix. If order="ALL", return a tuple containing all
501-
derivations matrix in increasing derivation order.
500+
Derivative matrix. If order="ALL", return a tuple containing all
501+
derivative matrices in increasing derivative order.
502502
"""
503503
if order not in [1, 2, "ALL"]:
504504
raise NotImplementedError(f"order={order}")

tests/test_2_lagrange.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ def testIntegration(nNodes, weightComputation, numQuad):
9797

9898
@pytest.mark.parametrize("weightComputation", ["AUTO", "FAST", "STABLE", "CHEBFUN"])
9999
@pytest.mark.parametrize("nNodes", nNodeTests)
100-
def testDerivation(nNodes, weightComputation):
100+
def testDerivative(nNodes, weightComputation):
101101
nodes = np.sort(np.random.rand(nNodes))
102102
approx = LagrangeApproximation(nodes, weightComputation=weightComputation)
103103

104-
D1, D2 = approx.getDerivationMatrix(order="ALL")
104+
D1, D2 = approx.getDerivativeMatrix(order="ALL")
105105

106-
assert np.allclose(D1, approx.getDerivationMatrix())
107-
assert np.allclose(D2, approx.getDerivationMatrix(order=2))
106+
assert np.allclose(D1, approx.getDerivativeMatrix())
107+
assert np.allclose(D2, approx.getDerivativeMatrix(order=2))
108108

109109
polyCoeffs = np.random.rand(nNodes)
110110
polyNodes = np.polyval(polyCoeffs, nodes)
@@ -156,9 +156,9 @@ def testDuplicates(nPoints, nCopy, duplicates):
156156
assert np.allclose(Q[:, approx._nnzIdx], Q_ref), "[Q] nonzero values different from reference"
157157
assert np.allclose(Q_noDuplicates, Q_ref), "[Q] no duplicates values different from reference"
158158

159-
D1, D2 = approx.getDerivationMatrix(order="ALL")
160-
D1_noDuplicates, D2_noDuplicates = approx.getDerivationMatrix(order="ALL", duplicates=False)
161-
D1_ref, D2_ref = approxUnique.getDerivationMatrix(order="ALL")
159+
D1, D2 = approx.getDerivativeMatrix(order="ALL")
160+
D1_noDuplicates, D2_noDuplicates = approx.getDerivativeMatrix(order="ALL", duplicates=False)
161+
D1_ref, D2_ref = approxUnique.getDerivativeMatrix(order="ALL")
162162

163163
assert np.allclose(D1[:, approx._zerIdx], 0), "[D1] zero indices have non-zero values"
164164
assert np.allclose(D1[:, approx._nnzIdx], D1_ref), "[D1] nonzero values different from reference"

0 commit comments

Comments
 (0)