gensbi.utils.math#

Mathematical utility functions for GenSBI.

This module provides mathematical operations and transformations used throughout the library, including dimension expansion and divergence computation for vector fields.

Functions#

_expand_dims(x)

Expand dimensions of an array to have at least 3 dimensions.

_expand_time(t)

Expand time array to have at least 2 dimensions.

divergence(vf, t, x[, args])

Compute the divergence of a vector field at specified points and times.

Module Contents#

gensbi.utils.math._expand_dims(x)[source]#

Expand dimensions of an array to have at least 3 dimensions.

Parameters:

x (Input array to expand.)

Return type:

Array with at least 3 dimensions.

gensbi.utils.math._expand_time(t)[source]#

Expand time array to have at least 2 dimensions.

Parameters:

t (Time array to expand.)

Return type:

Time array with at least 2 dimensions.

gensbi.utils.math.divergence(vf, t, x, args=None)[source]#

Compute the divergence of a vector field at specified points and times.

Parameters:
  • vf (The vector field function.)

  • t (The time at which to compute the divergence.)

  • x (The point at which to compute the divergence.)

  • args (Optional additional arguments for the vector field function.)

Return type:

The divergence of the vector field at point x and time t.