Skip to content

Lie Algebra

The Lie algebra utilities are organized by semantic responsibility:

  • so2 and so3 contain pure rotational Lie group and Lie algebra operators.
  • se2 and se3 contain rigid-body Lie group and Lie algebra operators, including left Jacobians and their analytic directional derivatives for accumulated algebra coordinates.
  • jacobian_coefficients contains reusable stable scalar coefficients.
  • constant_strain.se2 and constant_strain.se3 contain arclength operators for planar and spatial rod segment kinematics.

SO(2)

soromox.utils.lie_algebra.so2

Lie group and Lie algebra operators for planar rotations.

This module contains pure SO(2) / so(2) operations. It does not handle translations or pose-coordinate encodings; use se2 for planar rigid-body transforms and soromox.utils.geometry.poses for direct pose coordinates.

skew

skew(angle: Array) -> Array

Return the so(2) skew-symmetric matrix for a scalar angle.

The planar Lie algebra is one-dimensional. This function maps the scalar coordinate theta to theta * J where J = [[0, -1], [1, 0]]. Positive theta follows the standard right-handed convention for counter-clockwise rotation in the xy-plane.

Parameters:

Name Type Description Default
angle Array

Scalar or array-like value broadcastable to a scalar. The first flattened entry is interpreted as the angular coordinate theta in radians.

required

Returns:

Type Description
Array

Array with shape (2, 2) containing the skew-symmetric matrix

Array

theta * J.

exp

exp(angle: Array) -> Array

Compute the Lie-group exponential from so(2) to SO(2).

For SO(2), the exponential map is the standard planar rotation matrix R(theta). The input is an angular Lie-algebra coordinate, not a direct planar pose; translations are handled by se2.exp or by geometry pose helpers depending on the coordinate convention.

Parameters:

Name Type Description Default
angle Array

Scalar or array-like value broadcastable to a scalar. The first flattened entry is interpreted as the rotation angle theta in radians.

required

Returns:

Type Description
Array

Rotation matrix with shape (2, 2).

log

log(R: Array, eps: float | Array = 1e-10) -> Array

Compute the principal Lie-group logarithm from SO(2) to so(2).

The returned scalar is the principal angle obtained from atan2 and therefore lies in the half-open wrapping convention induced by atan2. Very small angles are regularized to exact zero to keep downstream comparisons and control errors stable near identity.

Parameters:

Name Type Description Default
R Array

Rotation matrix with shape (2, 2). The angle is read from atan2(R[1, 0], R[0, 0]).

required
eps float | Array

Small nonnegative scalar threshold. If the recovered angle has magnitude less than eps, the function returns exact zero.

1e-10

Returns:

Type Description
Array

Scalar array containing the principal rotation angle in radians.

SO(3)

soromox.utils.lie_algebra.so3

Lie group and Lie algebra operators for spatial rotations.

This module contains pure SO(3) / so(3) operations. Rotation vectors use axis-angle coordinates: the vector direction is the rotation axis and its Euclidean norm is the rotation angle in radians.

vee

vee(matrix: Array) -> Array

Extract the vector coordinate of the skew part of a matrix.

This is the inverse of :func:skew for matrices in so(3). For a general matrix, it first projects onto so(3) using 0.5 * (matrix - matrix.T). In particular, vee(skew(omega)) == omega.

Parameters:

Name Type Description Default
matrix Array

Matrix with shape (3, 3).

required

Returns:

Type Description
Array

Vector with shape (3,) in [x, y, z] order.

skew

skew(vec: Array) -> Array

Return the so(3) skew-symmetric cross-product matrix.

For a vector a = [x, y, z], the returned matrix a_hat satisfies a_hat @ b == cross(a, b) for any Cartesian 3-vector b. This is the matrix representation used by SO(3) and the rotational blocks of spatial SE(3) operators.

Parameters:

Name Type Description Default
vec Array

Vector with shape (3,) or (3, 1) in Cartesian [x, y, z] order.

required

Returns:

Type Description
Array

Array with shape (3, 3) containing the skew-symmetric

Array

cross-product matrix.

exp

exp(omega: Array, eps: float | Array = 1e-10) -> Array

Compute the Lie-group exponential from so(3) to SO(3).

The input is an axis-angle rotation vector. The function evaluates Rodrigues' formula and switches to a Taylor series near zero rotation to avoid singular divisions.

Parameters:

Name Type Description Default
omega Array

Rotation vector with shape (3,) or (3, 1). Its direction is the rotation axis and its Euclidean norm is the angle in radians.

required
eps float | Array

Small nonnegative scalar threshold. If norm(omega) <= eps, the small-angle series branch is used.

1e-10

Returns:

Type Description
Array

Rotation matrix with shape (3, 3).

log

log(R: Array, eps: float | Array = 1e-10) -> Array

Compute the principal Lie-group logarithm from SO(3) to so(3).

The returned vector is the principal axis-angle coordinate of R. Its norm is in [0, pi] and its direction is the corresponding rotation axis. The implementation uses the skew part of R in the regular case, a first-order series near identity, and a diagonal-axis reconstruction near pi where the skew part becomes singular.

Parameters:

Name Type Description Default
R Array

Rotation matrix with shape (3, 3).

required
eps float | Array

Small nonnegative scalar threshold used for normalization and small-angle handling.

1e-10

Returns:

Type Description
Array

Rotation vector with shape (3,) whose Euclidean norm is the

Array

principal rotation angle in radians.

SE(2)

soromox.utils.lie_algebra.se2

hat

hat(xi: Array) -> Array

Return the homogeneous matrix representation of an se(2) twist.

Twists use angular-first coordinates xi = [theta, v_x, v_y]. The first entry is the scalar angular component and the last two entries are the translational twist coordinates. The resulting matrix is [[so2.skew(theta), v], [0, 0, 0]] and is suitable for use in the matrix exponential.

Parameters:

Name Type Description Default
xi Array

Planar twist with shape (3,) or (3, 1) in [theta, v_x, v_y] order.

required

Returns:

Type Description
Array

Array with shape (3, 3) representing the same algebra element in

Array

homogeneous matrix form.

exp

exp(xi: Array, eps: float | Array) -> Array

Compute the Lie-group exponential from se(2) to SE(2).

This is the matrix exponential of :func:hat. The translational part is integrated through the SE(2) left Jacobian, so the input translation is a twist coordinate, not a direct pose translation. Use poses.planar_pose_to_transform when the input is a direct [theta, x, y] pose.

Parameters:

Name Type Description Default
xi Array

Planar twist with shape (3,) or (3, 1) in [theta, v_x, v_y] order.

required
eps float | Array

Minimum small-angle series threshold. A dtype-aware threshold may select the series over a larger interval to preserve Hessian accuracy near zero rotation.

required

Returns:

Type Description
Array

Homogeneous SE(2) transform with shape (3, 3).

log

log(g: Array, eps: float | Array) -> Array

Compute the Lie-group logarithm from SE(2) to se(2).

This function is the inverse of :func:exp for regular planar transforms: it returns twist coordinates, not direct pose coordinates. In particular, the returned translational coordinates are obtained by applying the inverse SE(2) left Jacobian to the transform translation. Use poses.planar_pose_from_transform when the desired output is direct pose coordinates [theta, x, y].

Parameters:

Name Type Description Default
g Array

Homogeneous SE(2) transform with shape (3, 3). The rotation is read from g[:2, :2] and the translation from g[:2, 2].

required
eps float | Array

Small positive scalar threshold forwarded to :func:so2.log. Recovered angles with magnitude below this threshold are rounded to zero.

required

Returns:

Type Description
Array

Array with shape (3,) containing twist coordinates

Array

[theta, v_x, v_y].

small_adjoint

small_adjoint(xi: Array) -> Array

Return the Lie algebra adjoint matrix ad_xi.

The returned matrix implements the planar Lie bracket in angular-first coordinates: small_adjoint(xi) @ eta == [xi, eta] for twists xi and eta written as [theta, v_x, v_y].

Parameters:

Name Type Description Default
xi Array

Planar twist with shape (3,) or (3, 1) in [theta, v_x, v_y] order.

required

Returns:

Type Description
Array

Array with shape (3, 3) representing ad_xi.

left_jacobian

left_jacobian(xi: Array, eps: float | Array) -> Array

Return the left Jacobian of the :math:SE(2) exponential.

For an accumulated planar twist xi, this evaluates

.. math::

J_l(\xi) = \int_0^1
\exp(\sigma\,\operatorname{ad}_\xi)\,d\sigma.

The operation is intrinsic to SE(2) and does not assume that xi came from a constant-strain rod segment.

The angular-first convention makes the first coordinate the accumulated rotation and the remaining coordinates the accumulated translation. The result is a coordinate Jacobian in the same basis as xi; it is not an arclength-scaled constant-strain tangent operator.

Parameters:

Name Type Description Default
xi Array

Accumulated planar twist with shape (3,) or (3, 1) in [theta, v_x, v_y] order.

required
eps float | Array

Minimum dimensionless small-angle threshold for the stable coefficient series. The implementation also applies a dtype-aware threshold so first and higher derivatives remain finite near zero.

required

Returns:

Type Description
Array

Left Jacobian with shape (3, 3).

left_jacobian_directional_derivative

left_jacobian_directional_derivative(xi: Array, xid: Array, eps: float | Array) -> Array

Return D J_l(xi)[xid] for the :math:SE(2) left Jacobian.

xid is an arbitrary direction in the Lie algebra; it need not be a physical time derivative or a constant-strain rate.

This is the Fréchet derivative of the full matrix-valued function left_jacobian along xid. Both the rotational and translational components of xid contribute to the result.

Parameters:

Name Type Description Default
xi Array

Accumulated planar twist with shape (3,) or (3, 1) in [theta, v_x, v_y] order.

required
xid Array

Direction with the same shape and coordinate order as xi. It is interpreted as a directional derivative, not necessarily a physical time derivative.

required
eps float | Array

Minimum dimensionless small-angle threshold for the stable coefficient series.

required

Returns:

Type Description
Array

Directional derivative with shape (3, 3).

left_jacobian_and_directional_derivative

left_jacobian_and_directional_derivative(xi: Array, xid: Array, eps: float | Array) -> tuple[Array, Array]

Evaluate J_l(xi) and D J_l(xi)[xid] with shared work.

This bundle is numerically equivalent to calling :func:left_jacobian and :func:left_jacobian_directional_derivative separately, but reuses the scalar coefficients needed by both evaluations. Use it when both the Jacobian and its directional derivative are required at the same point.

Parameters:

Name Type Description Default
xi Array

Accumulated planar twist with shape (3,) or (3, 1) in [theta, v_x, v_y] order.

required
xid Array

Direction with the same shape and coordinate order as xi.

required
eps float | Array

Minimum dimensionless small-angle threshold for the stable coefficient series.

required

Returns:

Type Description
tuple[Array, Array]

Tuple (J, Jd) whose arrays both have shape (3, 3).

coadjoint

coadjoint(xi: Array) -> Array

Return the planar coadjoint matrix used for dual wrench dynamics.

Vectors are angular-first, so dual quantities are ordered as [moment_z, force_x, force_y]. With xi = [theta, v_x, v_y] this function returns the package's planar coadjoint convention: [[0, v_y, -v_x], [0, 0, -theta], [0, theta, 0]]. This matches the existing dynamics convention for planar mass and force terms.

Parameters:

Name Type Description Default
xi Array

Planar twist with shape (3,) or (3, 1) in [theta, v_x, v_y] order.

required

Returns:

Type Description
Array

Array with shape (3, 3) acting on angular-first dual vectors.

coadjoint_action

coadjoint_action(xi: Array, dual: Array) -> Array

Apply the planar coadjoint without materializing its matrix.

Parameters:

Name Type Description Default
xi Array

Planar twist with shape (3,) or (3, 1) in [theta, v_x, v_y] order.

required
dual Array

Planar dual vector with shape (3,) or (3, 1) in [moment_z, force_x, force_y] order.

required

Returns:

Type Description
Array

The three-vector coadjoint(xi) @ dual.

adjoint

adjoint(g: Array) -> Array

Return the group adjoint matrix Ad_g for an SE(2) transform.

The adjoint maps planar twists between frames according to the homogeneous transform g and the angular-first twist convention. It is constructed so that hat(adjoint(g) @ xi) == g @ hat(xi) @ inverse(g).

Parameters:

Name Type Description Default
g Array

Homogeneous SE(2) transform with shape (3, 3). The rotation block is g[:2, :2] and the translation is g[:2, 2].

required

Returns:

Type Description
Array

Array with shape (3, 3) representing Ad_g in

Array

[theta, v_x, v_y] coordinates.

adjoint_inverse

adjoint_inverse(g: Array) -> Array

Return the inverse group adjoint matrix Ad_g^{-1}.

This is equivalent to adjoint(inverse(g)) but avoids explicitly constructing the inverse homogeneous transform. The result maps twists in the opposite direction from :func:adjoint.

Parameters:

Name Type Description Default
g Array

Homogeneous SE(2) transform with shape (3, 3).

required

Returns:

Type Description
Array

Array with shape (3, 3) representing the inverse adjoint in

Array

angular-first coordinates.

SE(3)

soromox.utils.lie_algebra.se3

hat

hat(xi: Array) -> Array

Return the homogeneous matrix representation of an se(3) twist.

Spatial twists use angular-first coordinates xi = [omega_x, omega_y, omega_z, v_x, v_y, v_z]. The returned matrix is [[so3.skew(omega), v], [0, 0, 0, 0]] and is suitable for use in the matrix exponential.

Parameters:

Name Type Description Default
xi Array

Spatial twist with shape (6,) or (6, 1). The first three entries are the angular component omega and the final three entries are the translational component v.

required

Returns:

Type Description
Array

Array with shape (4, 4) representing the same algebra element in

Array

homogeneous matrix form.

log

log(g: Array, eps: float | Array) -> Array

Compute the Lie-group logarithm from SE(3) to se(3).

The returned vector is a spatial twist in angular-first coordinates. The translational component is not the raw transform translation; it is the result of applying the inverse SE(3) left Jacobian to the translation. This makes the function the inverse of :func:exp for regular transforms.

Parameters:

Name Type Description Default
g Array

Homogeneous SE(3) transform with shape (4, 4). The rotation is read from g[:3, :3] and the translation from g[:3, 3].

required
eps float | Array

Small positive scalar threshold passed to so3.log for rotation extraction. The inverse Jacobian uses a dtype-aware Taylor series near zero rotation.

required

Returns:

Type Description
Array

Array with shape (6,) in

Array

[omega_x, omega_y, omega_z, v_x, v_y, v_z] order.

exp

exp(xi: Array, eps: float | Array) -> Array

Compute the Lie-group exponential from se(3) to SE(3).

This is the matrix exponential of :func:hat. The translational component of xi is integrated through the SE(3) left Jacobian, so it is a twist coordinate rather than a direct pose translation. Use poses.quaternion_pose_to_transform for direct quaternion-plus-position pose coordinates.

Parameters:

Name Type Description Default
xi Array

Spatial twist with shape (6,) or (6, 1) in [omega_x, omega_y, omega_z, v_x, v_y, v_z] order.

required
eps float | Array

Minimum small-angle series threshold. A dtype-aware threshold may select the series over a larger interval to preserve Hessian accuracy near zero rotation.

required

Returns:

Type Description
Array

Homogeneous SE(3) transform with shape (4, 4).

small_adjoint

small_adjoint(xi: Array) -> Array

Return the Lie algebra adjoint matrix ad_xi.

The returned matrix implements the spatial Lie bracket in angular-first coordinates: small_adjoint(xi) @ eta == [xi, eta] for twists xi and eta written as [omega, v].

Parameters:

Name Type Description Default
xi Array

Spatial twist with shape (6,) or (6, 1) in [omega_x, omega_y, omega_z, v_x, v_y, v_z] order.

required

Returns:

Type Description
Array

Array with shape (6, 6) representing ad_xi.

small_adjoint_action

small_adjoint_action(xi: Array, eta: Array) -> Array

Apply the Lie algebra adjoint without materializing its matrix.

Parameters:

Name Type Description Default
xi Array

Spatial twist with shape (6,) or (6, 1) in [omega, v] order.

required
eta Array

Spatial twist with shape (6,) or (6, 1) in [omega, v] order.

required

Returns:

Type Description
Array

The six-vector small_adjoint(xi) @ eta, equivalently the Lie

Array

bracket [xi, eta].

left_jacobian

left_jacobian(xi: Array, eps: float | Array) -> Array

Return the left Jacobian of the :math:SE(3) exponential.

For an accumulated spatial twist xi, this evaluates

.. math::

J_l(\xi) = \int_0^1 \exp(\sigma\,\operatorname{ad}_\xi)\,d\sigma.

The operation is intrinsic to SE(3) and does not assume that xi came from a constant-strain rod segment.

The angular-first convention makes the first three coordinates the accumulated rotation and the final three coordinates the accumulated translation. The result is a coordinate Jacobian in the same basis as xi; it is not an arclength-scaled constant-strain tangent operator.

Parameters:

Name Type Description Default
xi Array

Accumulated spatial twist with shape (6,) or (6, 1) in [omega_x, omega_y, omega_z, v_x, v_y, v_z] order.

required
eps float | Array

Minimum dimensionless small-angle threshold for the stable coefficient series. The implementation also applies a dtype-aware threshold so first and higher derivatives remain finite near zero.

required

Returns:

Type Description
Array

Left Jacobian with shape (6, 6).

left_jacobian_directional_derivative

left_jacobian_directional_derivative(xi: Array, xid: Array, eps: float | Array) -> Array

Return D J_l(xi)[xid] for the :math:SE(3) left Jacobian.

xid is an arbitrary direction in the Lie algebra; it need not be a physical time derivative or a constant-strain rate.

This is the Fréchet derivative of the full matrix-valued function left_jacobian along xid. Both the rotational and translational components of xid contribute through the spatial Lie-algebra polynomial.

Parameters:

Name Type Description Default
xi Array

Accumulated spatial twist with shape (6,) or (6, 1) in [omega_x, omega_y, omega_z, v_x, v_y, v_z] order.

required
xid Array

Direction with the same shape and coordinate order as xi. It is interpreted as a directional derivative, not necessarily a physical time derivative.

required
eps float | Array

Minimum dimensionless small-angle threshold for the stable coefficient series.

required

Returns:

Type Description
Array

Directional derivative with shape (6, 6).

left_jacobian_and_directional_derivative

left_jacobian_and_directional_derivative(xi: Array, xid: Array, eps: float | Array) -> tuple[Array, Array]

Evaluate J_l(xi) and D J_l(xi)[xid] with shared work.

This bundle is numerically equivalent to calling :func:left_jacobian and :func:left_jacobian_directional_derivative separately, but reuses the Lie-algebra powers and scalar coefficients needed by both evaluations. Use it when both the Jacobian and its directional derivative are required at the same point.

Parameters:

Name Type Description Default
xi Array

Accumulated spatial twist with shape (6,) or (6, 1) in [omega_x, omega_y, omega_z, v_x, v_y, v_z] order.

required
xid Array

Direction with the same shape and coordinate order as xi.

required
eps float | Array

Minimum dimensionless small-angle threshold for the stable coefficient series.

required

Returns:

Type Description
tuple[Array, Array]

Tuple (J, Jd) whose arrays both have shape (6, 6).

coadjoint

coadjoint(xi: Array) -> Array

Return the spatial coadjoint matrix -ad_xi.T.

Dual vectors are ordered consistently with angular-first twists, i.e. [moment_x, moment_y, moment_z, force_x, force_y, force_z]. The returned matrix acts on those dual vectors and is used in the dynamics terms where spatial inertia and wrench quantities are expressed in the same convention.

Parameters:

Name Type Description Default
xi Array

Spatial twist with shape (6,) or (6, 1) in [omega_x, omega_y, omega_z, v_x, v_y, v_z] order.

required

Returns:

Type Description
Array

Array with shape (6, 6) representing the coadjoint action on

Array

angular-first dual vectors.

coadjoint_action

coadjoint_action(xi: Array, dual: Array) -> Array

Apply the spatial coadjoint without materializing its matrix.

Parameters:

Name Type Description Default
xi Array

Spatial twist with shape (6,) or (6, 1) in [omega, v] order.

required
dual Array

Spatial dual vector with shape (6,) or (6, 1) in [moment, force] order.

required

Returns:

Type Description
Array

The six-vector coadjoint(xi) @ dual.

adjoint

adjoint(g: Array) -> Array

Return the group adjoint matrix Ad_g for an SE(3) transform.

The adjoint maps spatial twists between frames according to the homogeneous transform g and the angular-first twist convention. It is constructed so that hat(adjoint(g) @ xi) == g @ hat(xi) @ inverse(g).

Parameters:

Name Type Description Default
g Array

Homogeneous SE(3) transform with shape (4, 4). The rotation block is g[:3, :3] and the translation is g[:3, 3].

required

Returns:

Type Description
Array

Array with shape (6, 6) representing Ad_g in

Array

[omega, v] coordinates.

adjoint_inverse

adjoint_inverse(g: Array) -> Array

Return the inverse group adjoint matrix Ad_g^{-1}.

This is equivalent to adjoint(inverse(g)) but avoids explicitly constructing the inverse homogeneous transform. The result maps spatial twists in the opposite direction from :func:adjoint.

Parameters:

Name Type Description Default
g Array

Homogeneous SE(3) transform with shape (4, 4).

required

Returns:

Type Description
Array

Array with shape (6, 6) representing the inverse adjoint in

Array

angular-first coordinates.

Jacobian Coefficients

soromox.utils.lie_algebra.jacobian_coefficients

Public stable scalar coefficients for Lie-group Jacobians and maps.

Forward and inverse Lie-group Jacobians contain removable singularities at zero rotation. Their closed forms are accurate away from the origin, while Taylor series are needed near it for accurate reverse- and higher-order derivatives.

The cutoffs are derived for second-order autodiff, with u denoting machine epsilon for the input dtype. The closed-form Hessian of (theta / 2) cot(theta / 2) amplifies roundoff like O(u / theta**2). The inverse series has Hessian truncation error O(theta**6). Balancing those errors gives theta**8 ~= u, hence the common cutoff u**(1/8). This threshold is also conservative enough for the additional subtraction and division in the SE(3) quadratic coefficient.

The forward coefficients retain terms through theta**8. The Hessians of their subtraction-based closed forms amplify roundoff like O(u / theta**4), while the series Hessian truncation is O(theta**8). Balancing the two gives theta**12 ~= u and the forward cutoff u**(1/12).

All helpers use the same policy: select a sufficiently high-order series near zero, sanitize the closed-form input so batched selection cannot evaluate a singular dead branch, and restore the unsanitized quotients under strict_singularities_mode.

forward_left_jacobian_series_threshold

forward_left_jacobian_series_threshold(dtype: dtype) -> Array

Return the dtype-aware cutoff for forward left-Jacobian coefficients.

For an input dtype with machine epsilon u, the cutoff is u**(1/12). The subtraction-based forward closed forms have Hessian roundoff of order O(u / theta**4) near zero. The series retained in this module have Hessian truncation error O(theta**8); balancing the two errors gives theta**12 ~= u.

Parameters:

Name Type Description Default
dtype dtype

Real floating-point dtype for which to construct the cutoff.

required

Returns:

Type Description
Array

Scalar array of the requested dtype containing u**(1/12).

Notes

Callers may request a larger cutoff through their eps argument, but never a smaller dtype-aware cutoff.

inverse_left_jacobian_series_threshold

inverse_left_jacobian_series_threshold(dtype: dtype) -> Array

Return the dtype-aware cutoff for inverse left-Jacobian coefficients.

For an input dtype with machine epsilon u, the cutoff is u**(1/8). It balances the O(u / theta**2) roundoff amplification in the closed-form Hessian of (theta / 2) cot(theta / 2) against the O(theta**6) Hessian truncation error of the retained inverse series.

Parameters:

Name Type Description Default
dtype dtype

Real floating-point dtype for which to construct the cutoff.

required

Returns:

Type Description
Array

Scalar array of the requested dtype containing u**(1/8).

Notes

This is a numerical switching threshold rather than a declaration that the mathematical coefficient is singular. The singularity at zero is removable, and both branches approximate the same analytic function.

sine_over_angle

sine_over_angle(theta: Array, eps: float | Array = 0.0) -> Array

Evaluate the analytic sinc coefficient with stable derivatives.

The coefficient is

.. math::

\operatorname{sinc}(\theta) = \frac{\sin\theta}{\theta}.

Near zero it is evaluated with the even Taylor polynomial

.. math::

1 - \frac{\theta^2}{3!} + \frac{\theta^4}{5!}
- \frac{\theta^6}{7!} + \frac{\theta^8}{9!}.

Parameters:

Name Type Description Default
theta Array

Scalar rotation angle. Positive and negative values are supported and produce the same coefficient.

required
eps float | Array

User-requested minimum series cutoff. The effective cutoff is the maximum of abs(eps) and the dtype-aware forward cutoff.

0.0

Returns:

Type Description
Array

Scalar array with the continuous value one at theta == 0 in the

Array

default mode.

Notes

In :func:soromox.autodiff.strict_singularities_mode, the raw quotient is returned and therefore produces a non-finite value at zero. Outside strict mode the closed-form input is sanitized before branch selection, keeping values, Jacobians, and Hessians finite under JAX transforms.

one_minus_cosine_over_angle_squared

one_minus_cosine_over_angle_squared(theta: Array, eps: float | Array = 0.0) -> Array

Evaluate the analytic cosc coefficient with stable derivatives.

The coefficient is

.. math::

\operatorname{cosc}(\theta)
= \frac{1 - \cos\theta}{\theta^2},

with Taylor polynomial

.. math::

\frac{1}{2!} - \frac{\theta^2}{4!}
+ \frac{\theta^4}{6!} - \frac{\theta^6}{8!}
+ \frac{\theta^8}{10!}

in the small-angle region. This coefficient multiplies the squared skew matrix in Rodrigues' formula and the first skew term of the SE(3) left Jacobian.

Parameters:

Name Type Description Default
theta Array

Scalar rotation angle.

required
eps float | Array

User-requested minimum series cutoff. The dtype-aware forward cutoff remains a lower bound.

0.0

Returns:

Type Description
Array

Scalar array with the continuous value 1 / 2 at zero in default

Array

mode.

Notes

Strict-singularity mode evaluates the unsanitized quotient, exposing its removable 0 / 0 form at zero for diagnostics.

angle_minus_sine_over_angle_cubed

angle_minus_sine_over_angle_cubed(theta: Array, eps: float | Array = 0.0) -> Array

Evaluate the cubic forward-Jacobian coefficient stably.

The coefficient is

.. math::

\operatorname{tanc}(\theta)
= \frac{\theta - \sin\theta}{\theta^3},

with Taylor polynomial

.. math::

\frac{1}{3!} - \frac{\theta^2}{5!}
+ \frac{\theta^4}{7!} - \frac{\theta^6}{9!}
+ \frac{\theta^8}{11!}.

It is used as the quadratic-skew coefficient of the SE(3) forward left Jacobian.

Parameters:

Name Type Description Default
theta Array

Scalar rotation angle.

required
eps float | Array

User-requested minimum series cutoff. The dtype-aware forward cutoff remains a lower bound.

0.0

Returns:

Type Description
Array

Scalar array with the continuous value 1 / 6 at zero in default

Array

mode.

Notes

Strict-singularity mode returns the raw quotient and intentionally exposes the removable singularity at zero.

half_angle_cotangent

half_angle_cotangent(theta: Array) -> Array

Evaluate the inverse-Jacobian half-angle coefficient stably.

The analytic coefficient

.. math::

h(\theta) = \frac{\theta}{2}\cot\!\left(\frac{\theta}{2}\right)

is evaluated near zero as

.. math::

1 - \frac{\theta^2}{12} - \frac{\theta^4}{720}
- \frac{\theta^6}{30240}.

Parameters:

Name Type Description Default
theta Array

Scalar rotation angle.

required

Returns:

Type Description
Array

Scalar array with the continuous value one at zero in default mode.

Notes

The inverse cutoff u**(1/8) differs intentionally from the forward cutoff because the cancellation and retained series orders differ. Strict-singularity mode evaluates the raw half-angle quotient.

inverse_left_jacobian_quadratic_coefficient

inverse_left_jacobian_quadratic_coefficient(theta: Array) -> Array

Evaluate the quadratic coefficient of the inverse SE(3) Jacobian.

For Omega = skew(omega) and theta = norm(omega), the inverse left Jacobian is

.. math::

J_l^{-1}(\omega) = I - \frac{1}{2}\Omega + q(\theta)\Omega^2,

where

.. math::

q(\theta) =
\frac{1 - (\theta/2)\cot(\theta/2)}{\theta^2}.

The small-angle branch uses

.. math::

\frac{1}{12} + \frac{\theta^2}{720}
+ \frac{\theta^4}{30240} + \frac{\theta^6}{1209600}.

Parameters:

Name Type Description Default
theta Array

Scalar rotation magnitude.

required

Returns:

Type Description
Array

Scalar array with the continuous value 1 / 12 at zero in default

Array

mode.

Notes

The closed form contains both a cotangent quotient and an outer subtraction/division, so its input is sanitized before selection. Strict-singularity mode restores the complete raw expression.

Constant-Strain Operators

The rod-specific adjoint, tangent, tangent-derivative, and bundled operator APIs have a dedicated Constant Strain reference.