Helpers to use
assignment1.dg1 with high-precision numbers.
High-precision is achieved by using
High-precision replacement for
Implements interfaces that are essentially identical (at least up to the usage in
dg1) as those provided by NumPy.
All matrices returned are
mpmath.mpfas the data type and all matrix inputs are assumed to be of the same form.
Vectorized exponential function.
linspace(start, stop, num=50)¶
Linearly spaced points.
Points are computed with
mpmath.linspace()but the output (a
list) is converted back to a
Matrix inversion, using
The high-precision numerical type:
Ax = bfor
Ais given by
This method seeks to mirror
mpmath.matrices.linalg.LinearAlgebraMethods.lu_solve(), which uses
mpmath.matrices.linalg.LinearAlgebraMethods.U_solve(). Due to limitations of
mpmathwe use modified helpers to accomplish the upper- and lower-triangular solves. We also cache the LU-factorization for future uses.
It’s worth pointing out that
numpy.linalg.solve()works in exactly this fashion. From the C source there is a
lapack_functhat gets defined and is eventually used in Python as
gufunc. Notice that the
dgesvfor doubles. Checking the LAPACK docs verifies the
dgesvdoes an LU and then two triangular solves.
Produce a matrix of zeros of a given shape.
gauss_lobatto_points(start, stop, num_points)¶
Get the node points for Gauss-Lobatto quadrature.
Rather than using the optimizations in
dg1.gauss_lobatto_points(), this uses
mpmathutilities directly to find the roots of \(P_n'(x)\) (where \(n\) is equal to
num_points - 1).
- start (
float)) – The beginning of the interval.
- stop (
float)) – The end of the interval.
- num_points (int) – The number of points to use.
Return type: Returns:
1D array, the interior quadrature nodes.
- start (