bluemira.magnetostatics._ellipk

Attributes

_FloatOrArray

_P

_Q

_C1

_MACHEP

Functions

eval_polynomial(→ float)

Evaluate a polynomial via Horner's method.

_ellipk(→ float)

K(m) for m >= 0.

ellipk_nb(→ _FloatOrArray)

Complete elliptic integral of the first kind, K(m).

Module Contents

bluemira.magnetostatics._ellipk._FloatOrArray
bluemira.magnetostatics._ellipk._P = (0.00013798286460627325, 0.002280257240058756, 0.007974040132204152, 0.00985821379021226,...
bluemira.magnetostatics._ellipk._Q = (2.940789550485985e-05, 0.0009141847238659173, 0.005940583037531678, 0.01548505166497624,...
bluemira.magnetostatics._ellipk._C1 = 1.3862943611198906
bluemira.magnetostatics._ellipk._MACHEP = 1.1102230246251565e-16
bluemira.magnetostatics._ellipk.eval_polynomial(x: float, coefs: collections.abc.Sequence[float]) float

Evaluate a polynomial via Horner’s method.

Returns:

The evaluation of the polynomial.

Parameters:
  • x (float)

  • coefs (collections.abc.Sequence[float])

Return type:

float

bluemira.magnetostatics._ellipk._ellipk(m: float) float

K(m) for m >= 0.

Parameters:

m (float) – Positive scalar.

Returns:

Evaluation of K(m).

Return type:

float

bluemira.magnetostatics._ellipk.ellipk_nb(m: _FloatOrArray) _FloatOrArray

Complete elliptic integral of the first kind, K(m).

Parameters:

m (_FloatOrArray) – Parameter(s) of the elliptic integral. Values m > 1 return NaN. Can be a float or an NDArray. If an array, the function is executed elementwise.

Returns:

K(m).

Return type:

_FloatOrArray

Notes

\[K(m) = \int_{0}^{\tfrac{\pi}{2}}{(1 - m \sin^2(t)})^{-\tfrac{1}{2}} dt\]

[ellipk_1]

Implementation based on Scipy’s XSF implementation [ellipk_3] of the Cephes C [ellipk_2] library (MIT licensed) - with help from Claude to translate the C into Python.

[ellipk_1]

Abramowitz, M., and I. A. Stegun. Handbook of Mathematical Functions. Dover Publications, 1965.

[ellipk_2]

Moshier, S. L. (2000). Cephes Math Library Release 2.8. http://www.netlib.org/cephes