noads.gam_jax.utils.math#

A math toolbox for MARILib.

author:

DRUOT Thierry, original Scilab implementation

author:

ROCHES Pascal, portage to Python

noads.gam_jax.utils.math.angle(sin_a, cos_a, typ=2)[source]#

Calculate an angle from its sine and cosine coordinates if typ=1 then -180<a_<180, if typ=2 then 0<a_<360.

noads.gam_jax.utils.math.approx_jac(res, y, args=(), step=1e-07)[source]#
noads.gam_jax.utils.math.cross_op(v)[source]#

Build the skew-symmetric matrix of vector v.

noads.gam_jax.utils.math.get_jac_func(res, args=(), step=1e-06)[source]#
noads.gam_jax.utils.math.great_circle_distance(p1, p2)[source]#

Compute the great circle distance between 2 points p : (lat, long).

noads.gam_jax.utils.math.lin_interp_1d(x, X, Y)[source]#

Linear interpolation without any control.

Parameters:
  • x – current position

  • X – array of the abscissa of the known points

  • Y – array of the known values at given abscissa

Returns:

y the interpolated value of Y at x

noads.gam_jax.utils.math.look_ahead_4_zero(xini, dx, *fct)[source]#

Look ahead for a zero of the function.

Parameters:
  • xini – initial value of the variable.

  • dx – fixed search step.

  • fct – function with the signature : [‘function_name’,a1,a2,a3,…,an] and function_name(x,a1,a2,a3,…,an).

noads.gam_jax.utils.math.maximize_1d(xini, dx, *fct)[source]#

Optimize 1 single variable, no constraint.

Parameters:
  • xini – initial value of the variable.

  • dx – fixed search step.

  • fct – function with the signature : [‘function_name’,a1,a2,a3,…,an] and function_name(x,a1,a2,a3,…,an).

noads.gam_jax.utils.math.newton_solve(res_func, x0, dres_dy=None, args=(), res_max=1e-12, relax=0.995, max_iter=50, full_output=False)[source]#
noads.gam_jax.utils.math.norm(x)[source]#
noads.gam_jax.utils.math.renorm(v)[source]#
noads.gam_jax.utils.math.rotate_point(pivot, axe, angle, p0)[source]#

Retrieve the point coming from the rotation of p0 of angle, around the axis defined by pivot and axe.

noads.gam_jax.utils.math.rotate_vector(vec, axe, cos_a, sin_a)[source]#

Retrieve the vector vec rotated by the angle a around axe, using Olinde-Rodrigues formula v_star = vec + sin_a * np.cross(axe, vec) + (1 - cos_a) * np.cross(axe, np.cross(axe, vec)).

noads.gam_jax.utils.math.trinome(A, Y)[source]#

Calculate trinome coefficients from 3 given points A = [X2, X, 1] (Vandermonde matrix).

noads.gam_jax.utils.math.vander3(X)[source]#

Return the vandermonde matrix of a dim 3 array A = [X^2, X, 1].

Functions

angle(sin_a, cos_a[, typ])

Calculate an angle from its sine and cosine coordinates if typ=1 then -180<a_<180, if typ=2 then 0<a_<360.

approx_jac(res, y[, args, step])

cross_op(v)

Build the skew-symmetric matrix of vector v.

get_jac_func(res[, args, step])

great_circle_distance(p1, p2)

Compute the great circle distance between 2 points p : (lat, long).

lin_interp_1d(x, X, Y)

Linear interpolation without any control.

look_ahead_4_zero(xini, dx, *fct)

Look ahead for a zero of the function.

maximize_1d(xini, dx, *fct)

Optimize 1 single variable, no constraint.

newton_solve(res_func, x0[, dres_dy, args, ...])

norm(x)

renorm(v)

rotate_point(pivot, axe, angle, p0)

Retrieve the point coming from the rotation of p0 of angle, around the axis defined by pivot and axe.

rotate_vector(vec, axe, cos_a, sin_a)

Retrieve the vector vec rotated by the angle a around axe, using Olinde-Rodrigues formula v_star = vec + sin_a * np.cross(axe, vec) + (1 - cos_a) * np.cross(axe, np.cross(axe, vec)).

trinome(A, Y)

Calculate trinome coefficients from 3 given points A = [X2, X, 1] (Vandermonde matrix).

vander3(X)

Return the vandermonde matrix of a dim 3 array A = [X^2, X, 1].