Math

class sonic.Math
Method Summary
static A_toDet1(A)

If the matrix has even dimension, normalizes the determinant to one. If it has odd dimension, normalizes the determinant to either one or minus one. If the matrix is nearly singular, returns the original matrix. Outputs the scaled matrix, the sign of the new determinant, the scale used for re-scaling and a flag indicating if rescaling took place scale, t Inputs:

  • A (nxn double): matrix

Outputs:
  • A_det1 (nxn string): matrix with determinant of 1

  • sign (1x1 double): sign of the determinant of the rescaled matrix

  • scale (1x1 double): scale used to re-scale the matrix

  • wasRescaled (1x1 logical): false if no rescaling took place, true otherwise.

Last revised: 15/11/24 Last author: Michela Mancini

static HFunction(mu, AL_ss, evalMethod)

Computes the Chandrasekhar’s H-function for a given set of directional parameters (mu) an single-scattering albedo (AL_ss) using a user-defined evaluation method

Inputs:
  • mu (nxm double): matrix of values on the domain [0,1] (can be a scalar as well)

  • AL_ss (nxm double): matrix of values on the domain [0,1] (can be a scalar as well)

  • evalMethod (string): defines evaluation method of H-Function

(must be “exact”, “numeric”, or “linear”) - Note: mu and AL_ss must have the same dimensions unless mu and/or AL_ss is a scalar value

Outputs:
  • Hval (nxm double): matrix of H-function values for either the

pairwise (if both mu and AL_ss are matrices) or for each mu/AL_ss given a scalar AL_ss/mu

References

[1] D. W. N. Stibbs, and R. E. Weir,

“On the H-Functions for Isotropic Scattering”, https://doi.org/10.1093/mnras/119.5.512

[2] B. Hapke, “Bidirectional Reflectance Spectroscopy:
  1. Theory”, https://doi.org/10.1029/JB086iB04p03039

[3] J. A. Christian, “Spacecraft Optical Navigation”

Last revised: 9/24/24 Last author: Jennifer Nolan

static adjoint3x3(matrix)

Determines the adjoint of the given 3x3 matrix

Inputs:
  • matrix (3x3 double): any 3x3 matrix

Outputs:
  • adj (3x3 double): adjoint of the given matrix

Last revised: 4/19/24 Last author: Michela Mancini

static adjoint4x4(matrix)

Determines the adjoint of the given 4x4 matrix

Inputs:
  • matrix (4x4 double): any 4x4 matrix

Outputs:
  • adj (4x4 double): adjoint of the given matrix

Last revised: 11/07/24 Last author: Michela Mancini

static atan2c(y, x)

Returns the 4-quadrant arctangent for complex values of y and x, in radians.

Inputs:
  • y (1xn double): Numerator of the tangent (Y/X). May be complex.

  • x (1xn double): Denominator of the tangent (Y/X). May be complex.

Outputs:
  • val (1xn double): The 4-quadrant arctangent of Y/X, in radians. If Y and X are real, this is equivalent to atan2().

Last revised: 5/07/24 Last author: Michael Krause

static computeI3Integrand(mu, AL_ss, theta)

Determine the value of the I3 integrand component from the Stibbs-Weird method [1] to compute the Chandrasekhar’s H-function. The functions f (Eq. 11.2 in [1]), g (Eq. 12 in [1]), and h (Eq. 16 in [1]) form the ingtegrand according to Eq. 17 in [1].

Inputs:
  • mu (double): scalar value on the domain [0,1]

  • AL_ss (double): scalar value on the domain [0,1]

  • theta (1xn double):

Outputs:
  • I3Integrand (1xn matrix): vector of values representing the ingtegrand f(theta)-g(theta)-h(theta) for each inputted theta

Last revised: 9/26/24 Last author: Jennifer Nolan

static crossmat(v)

3x3 skew-symmetric cross-product matrix

Inputs:
  • v (3 double): vector to convert to cross-product matrix

Outputs:
  • T (3x3 double): skew-symmetric matrix, such that multiplying this matrix with another 3x1 vector is equivalent to the cross-product of those two vectors.

Last revised: 2/14/24 Last author: Michael Krause

static exactHFunction(mu, AL_ss)

Hval=exactFunction(mu,AL_ss) Uses the Stibbs-Weird method [1] to compute the Chandrasekhar’s H-function for a given set of directional parameters (mu) and single-scattering albedos (AL_ss).

Inputs:
  • mu (nxm double): matrix of values on the domain [0,1] (can be a scalar as well)

  • AL_ss (nxm double): matrix of values on the domain [0,1] (can be a scalar as well)

  • Note: mu and AL_ss mustst have the same dimensions unless mu and/or AL_ss is a scalar value

Outputs:
  • val (nxm double): matrix of H-function values for either the pairwise (if both mu and AL_ss are matrices) or for each mu/AL_ss given a scalar AL_ss/mu

References

[1] D. W. N. Stibbs, and R. E. Weir,

“On the H-Functions for Isotropic Scattering”, https://doi.org/10.1093/mnras/119.5.512

Last revised: 9/24/24 Last author: Jennifer Nolan

static getSmallestRSingVector(A)

Get right singular vector corresponding to smallest magnitude magnitude value

Inputs:
  • A (mxn double): matrix for which we want to extract smallest singular value

Outputs:
  • minSingVal (1x1 double) – smallest magnitude singular

    value

  • minRSingVect (nx1 double) – right singular vector corresponding to minSingVal

Last revised: Sep 24, 2024 Last author: Tara Mina

static linearHFunction(mu, AL_ss)

Uses the linearized method [1] to compute the Chandrasekhar’s H-function for a given set of directional parameters (mu) and single-scattering albedos (AL_ss).

Inputs:
  • mu (nxm double): matrix of values on the domain [0,1] (can be a scalar as well)

  • AL_ss (nxm double): matrix of values on the domain [0,1] (can be a scalar as well)

  • Note: mu and AL_ss mustst have the same dimensions unless mu and/or AL_ss is a scalar value

Outputs:
  • val (nxm double): matrix of H-function values for either the pairwise (if both mu and AL_ss are matrices) or for each mu/AL_ss given a scalar AL_ss/mu

References

[1] J. A. Christian, “Spacecraft Optical Navigation”

Last revised: 9/30/24 Last author: Jennifer Nolan

static rationalHFunction(mu, AL_ss)

Uses the rational approximation method [1] to compute the Chandrasekhar’s H-function for a given set of directional parameters (mu) and single-scattering albedos (AL_ss).

Inputs:
  • mu (nxm double): matrix of values on the domain [0,1] (can be a scalar as well)

  • AL_ss (nxm double): matrix of values on the domain [0,1] (can be a scalar as well)

  • Note: mu and AL_ss must have the same dimensions unless mu and/or AL_ss is a scalar value

Outputs:
  • val (nxm double): matrix of H-function values for either the pairwise (if both mu and AL_ss are matrices) or for each mu/AL_ss given a scalar AL_ss/mu

References

[1] B. Hapke, “Bidirectional Reflectance Spectroscopy:
  1. Theory”, https://doi.org/10.1029/JB086iB04p03039

[2] J. A. Christian, “Spacecraft Optical Navigation”

Last revised: 9/30/24 Last author: Jennifer Nolan

static solveGenEigvalSmallestLambda(M, N, boolNorm)

Helper function to solve the generalized eigenvalue problem, returning the eigenvector corresponding to the smallest magnitude eigenvalue lambda

Generalized eigenvalue problem finds x and lambda such that:

M x = lambda N x

And this function returns the eigenvector x corresponding to the eigen value lambda with the smallest magnitude

Inputs:
  • M (nxn double): square matrix which corresponds to the generalized eigenvalue problem, defined above

  • N (nxn double): square matrix normalization factor which corresp to generalized eigenvalue problem, defined above

  • boolNorm (boolean): if True, L2-normalizes the eigenvector

Outputs:
  • minEigvec (nx1 double) – solution to the above-defined generalized eigenvalue problem, corresponding to the eigenvalue lambda with the smallest magnitude

Last revised: Sep 24, 2024 Last author: Tara Mina