choreo.segm.multiprec_tables.ComputeQuadrature#

ComputeQuadrature(n=10, dps=30, method='Gauss', nodes=None)[source]#

Computes a choreo.segm.quad.QuadTable

The computation is performed at a user-defined precision using mpmath to ensure that the result does not suffer from precision loss, even at relatively high orders.

Available choices for method are:

  • "Gauss"

  • "Radau_I" and "Radau_II"

  • "Lobatto_III"

  • "Cheb_I" and "Cheb_II"

  • "ClenshawCurtis"

Alternatively, the user can supply an array of node values between 0. and 1.. The result is then the associated collocation method.

Example

>>> import choreo
>>> choreo.segm.multiprec_tables.ComputeQuadrature(n=2, dps=60, method="Lobatto_III")
QuadTable object with 2 nodes
Nodes: [7.7787691e-62 1.0000000e+00]
Weights: [0.5 0.5]
Barycentric Lagrange interpolation weights: [-1.  1.]
>>>
>>> choreo.segm.multiprec_tables.ComputeQuadrature(nodes=[0., 0.25, 0.5, 0.75, 1.])
QuadTable object with 5 nodes
Nodes: [0.   0.25 0.5  0.75 1.  ]
Weights: [0.07777778 0.35555556 0.13333333 0.35555556 0.07777778]
Barycentric Lagrange interpolation weights: [ 10.66666667 -42.66666667  64.         -42.66666667  10.66666667]
Parameters:
  • n (int, optional) – Order of the method. By default 10.

  • dps (int, optional) –

    Context precision in mpmath. See Contexts for more info. By default 30.

  • method (str, optional) – Name of the method, by default "Gauss".

  • nodes (numpy.ndarray | mpmath:mpmath.matrix | None, optional) – Array of integration node values. By default, None.

Returns:

The resulting nodes and weights of the quadrature.

Return type:

choreo.segm.quad.QuadTable