math_functions (pmrf.math_functions)

Math functions.

Functions

complex_2_magnitude(z)

Return the magnitude of the complex argument.

complex_2_db(z)

Return the magnitude in dB of a complex number (as \(20\log_{10}(|z|)\)).

complex_2_db10(z)

Return the magnitude in dB of a complex number (as \(10\log_{10}(|z|)\)).

complex_2_radian(z)

Return the angle complex argument in radian.

complex_2_degree(z)

Returns the angle complex argument in degrees.

complex_2_quadrature(z)

Take a complex number and returns quadrature, which is (length, arc-length from real axis).

complex_2_reim(z)

Return real and imaginary parts of a complex number.

complex_components(z)

Break up a complex array into all possible scalar components.

magnitude_2_db(z[, zero_nan])

Convert linear magnitude to dB.

mag_2_db(x)

Convert magnitude to decibels.

mag_2_db10(z[, zero_nan])

Convert linear magnitude to dB (factor 10).

db_2_magnitude(z)

Convert dB to linear magnitude.

db_2_mag(x)

Convert decibels to magnitude.

db10_2_mag(z)

Convert dB (factor 10) to linear magnitude.

magdeg_2_reim(mag, deg)

Convert linear magnitude and phase (in deg) arrays into a complex array.

dbdeg_2_reim(db, deg)

Convert dB magnitude and phase (in deg) arrays into a complex array.

db_2_np(db)

Convert a value in decibel (dB) to neper (Np).

np_2_db(x)

Convert a value in Nepers (Np) to decibel (dB).

radian_2_degree(rad)

Convert angles from radians to degrees.

degree_2_radian(deg)

Convert angles from degrees to radians.

feet_2_meter([feet])

Convert length in feet to meter.

meter_2_feet([meter])

Convert length in meter to feet.

db_per_100feet_2_db_per_100meter([...])

Convert attenuation values given in dB/100ft to dB/100m.

unwrap_rad(phi)

Unwrap a phase given in radians.

sqrt_known_sign(z_squared, z_approx)

Return the square root of a complex number, with sign chosen to match z_approx.

find_correct_sign(z1, z2, z_approx)

Create new vector from z1, z2 choosing elements with sign matching z_approx.

find_closest(z1, z2, z_approx)

Return z1 or z2 depending on which is closer to z_approx.

sqrt_phase_unwrap(z)

Take the square root of a complex number with unwrapped phase.

dirac_delta(x)

Calculate Dirac function.

neuman(x)

Calculate Neumans number.

null(A[, eps])

Calculate the null space of matrix A.

inf_to_num(x)

Convert inf and -inf's to large numbers.

cross_ratio(a, b, c, d)

Calculate the cross ratio of a quadruple of distinct points on the real line.

complexify(f[, name])

Make a function f(scalar) into f(complex).

complex2Scalar(z)

Serialize a list/array of complex numbers.

scalar2Complex(s)

Unserialize a list/array of real and imag numbers into a complex array.

multiply_by(x, by[, axis])

Broadcast multiply array x by array by along a specified axis.

sum_every(x, n[, axis])

Sum blocks of size n along a specified axis.

multiply_every(x, n[, axis])

Multiply blocks of size n along a specified axis.

convolve_interleaved(x[, axis])

Convolve interleaved signals (e.g. real/imag parts stored sequentially).

rms(x)

Calculate the Root Mean Square (RMS) of the input.

polar_2_rect(radii, angles[, deg])

Convert polar coordinates to rectangular (complex) coordinates.

rect_2_polar(x[, deg])

Convert rectangular (complex) coordinates to polar coordinates.

rsolve(A, B)

Solves x @ A = B.

nudge_eig(mat[, cond, min_eig])

Nudge eigenvalues with absolute value smaller than max(cond * max(eigenvalue), min_eig) to that value.

nudge_svd(mat[, cond, min_val])

Nudge small singular values to avoid singularities using SVD.

nudge_diag(mat[, eps])

Stabilize matrix inversion by adding a tiny epsilon to the diagonal.

round_sig(x[, sig])

Round to a specific number of significant digits.

comb(N, k[, exact, repetition])

The number of combinations of N things taken k at a time.

evaluate_power_basis(x, coeffs, lower_bound, ...)

Evaluate a polynomial in the power basis.

evaluate_bernstein_basis(x, coeffs, ...)

Evaluate a polynomial in the Bernstein basis.

broaden(key, x[, percentage])

Broaden data using gaussian noise by a specified percentage.

conv_inter(x[, axis])

Convolve interleaved signals (e.g. real/imag parts stored sequentially).

dB20(x)

Convert magnitude to decibels.

conv_cost(x)