engineering_formulas¶
shortfx.fxExcel.engineering_formulas
¶
shortfx - fxExcel: Engineering Functions Module
This module provides Excel-compatible engineering functions for shortfx. It includes functions for: - Bessel functions (BESSELI, BESSELJ, BESSELK, BESSELY) - Number base conversions (binary, decimal, hexadecimal, octal) - Bitwise operations (shifts, AND, OR, XOR) - Complex number operations - Error functions - Unit conversions
All functions follow Excel's naming conventions and behavior.
Functions¶
BESSELI(n: Union[int, float], x: Union[int, float]) -> float
¶
Returns the modified Bessel function In(x).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
Union[int, float]
|
Order of the Bessel function. |
required |
x
|
Union[int, float]
|
Value at which to evaluate the function. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The modified Bessel function In(x). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the computation fails. |
Example
BESSELI(1, 1.5) 0.981666428
Cost: O(1), Bessel function computation.
Source code in shortfx/fxExcel/engineering_formulas.py
BESSELJ(n: Union[int, float], x: Union[int, float]) -> float
¶
Returns the Bessel function Jn(x).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
Union[int, float]
|
Order of the Bessel function. |
required |
x
|
Union[int, float]
|
Value at which to evaluate the function. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The Bessel function Jn(x). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the computation fails. |
Example
BESSELJ(1, 1.5) 0.557936507
Cost: O(1), Bessel function computation.
Source code in shortfx/fxExcel/engineering_formulas.py
BESSELK(n: Union[int, float], x: Union[int, float]) -> float
¶
Returns the modified Bessel function Kn(x).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
Union[int, float]
|
Order of the Bessel function. |
required |
x
|
Union[int, float]
|
Value at which to evaluate the function. Must be positive. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The modified Bessel function Kn(x). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If x is not positive or computation fails. |
Example
BESSELK(1, 1.5) 0.277387804
Cost: O(1), Bessel function computation.
Source code in shortfx/fxExcel/engineering_formulas.py
BESSELY(n: Union[int, float], x: Union[int, float]) -> float
¶
Returns the Bessel function Yn(x).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
Union[int, float]
|
Order of the Bessel function. |
required |
x
|
Union[int, float]
|
Value at which to evaluate the function. Must be positive. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The Bessel function Yn(x). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If x is not positive or computation fails. |
Example
BESSELY(1, 1.5) -0.412308627
Cost: O(1), Bessel function computation.
Source code in shortfx/fxExcel/engineering_formulas.py
BIN2DEC(binary: str) -> int
¶
Converts a binary string to decimal. Excel function: BIN2DEC (Spanish: BIN.A.DEC)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
binary
|
str
|
Binary string (up to 10 characters). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Decimal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If binary string is invalid or too long. |
Example
BIN2DEC('1010') 10 BIN2DEC('11111111') 255
Cost: O(n) where n is the length of binary string.
Source code in shortfx/fxExcel/engineering_formulas.py
BIN2HEX(binary: str, places: int = None) -> str
¶
Converts a binary string to hexadecimal. Excel function: BIN2HEX (Spanish: BIN.A.HEX)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
binary
|
str
|
Binary string (up to 10 characters). |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Hexadecimal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If binary string is invalid. |
Example
BIN2HEX('1010') 'A' BIN2HEX('1010', 4) '000A'
Cost: O(n) where n is the length of binary string.
Source code in shortfx/fxExcel/engineering_formulas.py
BIN2OCT(binary: str, places: int = None) -> str
¶
Converts a binary string to octal. Excel function: BIN2OCT (Spanish: BIN.A.OCT)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
binary
|
str
|
Binary string (up to 10 characters). |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Octal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If binary string is invalid. |
Example
BIN2OCT('1010') '12' BIN2OCT('1010', 4) '0012'
Cost: O(n) where n is the length of binary string.
Source code in shortfx/fxExcel/engineering_formulas.py
BITAND(number1: int, number2: int) -> int
¶
Performs a bitwise AND on two numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number1
|
int
|
First number. |
required |
number2
|
int
|
Second number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Result of bitwise AND. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arguments are not integers. |
Example
BITAND(5, 3) 1
Cost: O(1), bitwise operation.
Source code in shortfx/fxExcel/engineering_formulas.py
BITLSHIFT(number: int, shift: int) -> int
¶
Performs a left shift on a number by shift bits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
Number to shift. |
required |
shift
|
int
|
Number of bits to shift left. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Result of left shift operation. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arguments are not integers. |
Example
BITLSHIFT(2, 2) 8
Cost: O(1), bitwise operation.
Source code in shortfx/fxExcel/engineering_formulas.py
BITOR(number1: int, number2: int) -> int
¶
Performs a bitwise OR on two numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number1
|
int
|
First number. |
required |
number2
|
int
|
Second number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Result of bitwise OR. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arguments are not integers. |
Example
BITOR(5, 3) 7
Cost: O(1), bitwise operation.
Source code in shortfx/fxExcel/engineering_formulas.py
BITRSHIFT(number: int, shift: int) -> int
¶
Performs a right shift on a number by shift bits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
Number to shift. |
required |
shift
|
int
|
Number of bits to shift right. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Result of right shift operation. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arguments are not integers. |
Example
BITRSHIFT(8, 2) 2
Cost: O(1), bitwise operation.
Source code in shortfx/fxExcel/engineering_formulas.py
BITXOR(number1: int, number2: int) -> int
¶
Performs a bitwise XOR on two numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number1
|
int
|
First number. |
required |
number2
|
int
|
Second number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Result of bitwise XOR. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arguments are not integers. |
Example
BITXOR(5, 3) 6
Cost: O(1), bitwise operation.
Source code in shortfx/fxExcel/engineering_formulas.py
COMPLEX(real: Union[int, float], imag: Union[int, float], suffix: str = 'i') -> complex
¶
Creates a complex number from real and imaginary coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
real
|
Union[int, float]
|
Real coefficient. |
required |
imag
|
Union[int, float]
|
Imaginary coefficient. |
required |
suffix
|
str
|
Suffix character ("i" or "j"). Defaults to "i". |
'i'
|
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Complex number. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If creation fails. |
Example
COMPLEX(3, 4) (3+4j)
Cost: O(1), complex number creation.
Source code in shortfx/fxExcel/engineering_formulas.py
CONVERT(number: Union[int, float], from_unit: str, to_unit: str) -> float
¶
Converts a number from one measurement unit to another.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
Union[int, float]
|
Value to convert. |
required |
from_unit
|
str
|
Source unit. |
required |
to_unit
|
str
|
Target unit. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Converted value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If conversion is not supported. |
Example
CONVERT(100, 'cm', 'm') 1.0 CONVERT(1, 'kg', 'g') 1000.0
Cost: O(1), unit conversion lookup.
Source code in shortfx/fxExcel/engineering_formulas.py
DEC2BIN(decimal: int, places: int = None) -> str
¶
Converts a decimal number to binary. Excel function: DEC2BIN (Spanish: BDCONTAR - error in original file, should be DEC.A.BIN)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decimal
|
int
|
Decimal number (must be between -512 and 511). |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Binary equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If decimal is out of range. |
Example
DEC2BIN(10) '1010' DEC2BIN(10, 8) '00001010'
Cost: O(log n) where n is the decimal value.
Source code in shortfx/fxExcel/engineering_formulas.py
DEC2HEX(decimal: int, places: int = None) -> str
¶
Converts a decimal number to hexadecimal. Excel function: DEC2HEX (Spanish: DEC.A.HEX)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decimal
|
int
|
Decimal number. |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Hexadecimal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If decimal is out of range. |
Example
DEC2HEX(100) '64' DEC2HEX(100, 4) '0064'
Cost: O(log n) where n is the decimal value.
Source code in shortfx/fxExcel/engineering_formulas.py
DEC2OCT(decimal: int, places: int = None) -> str
¶
Converts a decimal number to octal. Excel function: DEC2OCT (Spanish: DEC.A.OCT)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decimal
|
int
|
Decimal number (must be between -536870912 and 536870911). |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Octal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If decimal is out of range. |
Example
DEC2OCT(100) '144' DEC2OCT(100, 5) '00144'
Cost: O(log n) where n is the decimal value.
Source code in shortfx/fxExcel/engineering_formulas.py
DELTA(value1: Union[int, float], value2: Union[int, float] = 0) -> int
¶
Tests whether two values are equal. Returns 1 if equal, 0 otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value1
|
Union[int, float]
|
First value. |
required |
value2
|
Union[int, float]
|
Second value. Defaults to 0. |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
1 if value1 == value2, 0 otherwise. |
Example
DELTA(5, 5) 1 DELTA(5, 3) 0
Cost: O(1), equality comparison.
Source code in shortfx/fxExcel/engineering_formulas.py
ERF(x: Union[int, float]) -> float
¶
Returns the error function erf(x).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[int, float]
|
Value at which to evaluate. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Error function value. |
Example
round(ERF(1), 5) 0.84270
Cost: O(1), error function computation.
Source code in shortfx/fxExcel/engineering_formulas.py
ERFC(x: Union[int, float]) -> float
¶
Returns the complementary error function erfc(x).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[int, float]
|
Value at which to evaluate. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Complementary error function value. |
Example
round(ERFC(1), 5) 0.15730
Cost: O(1), complementary error function computation.
Source code in shortfx/fxExcel/engineering_formulas.py
ERFC_PRECISE(x: Union[int, float]) -> float
¶
Returns the complementary error function erfc(x) with precise calculation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[int, float]
|
Value at which to evaluate. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Complementary error function value. |
Example
round(ERFC_PRECISE(1), 5) 0.15730
Cost: O(1), complementary error function computation.
Source code in shortfx/fxExcel/engineering_formulas.py
ERF_PRECISE(x: Union[int, float]) -> float
¶
Returns the error function erf(x) with precise calculation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[int, float]
|
Value at which to evaluate. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Error function value. |
Example
round(ERF_PRECISE(1), 5) 0.84270
Cost: O(1), error function computation.
Source code in shortfx/fxExcel/engineering_formulas.py
GESTEP(number: Union[int, float], threshold: Union[int, float] = 0) -> int
¶
Tests whether a number is greater than or equal to a threshold. Returns 1 if number >= threshold, 0 otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
Union[int, float]
|
Number to test. |
required |
threshold
|
Union[int, float]
|
Threshold value. Defaults to 0. |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
1 if number >= threshold, 0 otherwise. |
Example
GESTEP(5, 3) 1 GESTEP(2, 3) 0
Cost: O(1), comparison operation.
Source code in shortfx/fxExcel/engineering_formulas.py
HEX2BIN(hexadecimal: str, places: int = None) -> str
¶
Converts a hexadecimal string to binary. Excel function: HEX2BIN (Spanish: HEX.A.BIN)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexadecimal
|
str
|
Hexadecimal string (up to 10 characters). |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Binary equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If hexadecimal string is invalid. |
Example
HEX2BIN('A') '1010' HEX2BIN('F', 8) '00001111'
Cost: O(n) where n is the length of hexadecimal string.
Source code in shortfx/fxExcel/engineering_formulas.py
HEX2DEC(hexadecimal: str) -> int
¶
Converts a hexadecimal string to decimal. Excel function: HEX2DEC (Spanish: HEX.A.DEC)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexadecimal
|
str
|
Hexadecimal string (up to 10 characters). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Decimal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If hexadecimal string is invalid. |
Example
HEX2DEC('A') 10 HEX2DEC('FF') 255
Cost: O(n) where n is the length of hexadecimal string.
Source code in shortfx/fxExcel/engineering_formulas.py
HEX2OCT(hexadecimal: str, places: int = None) -> str
¶
Converts a hexadecimal string to octal. Excel function: HEX2OCT (Spanish: HEX.A.OCT)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexadecimal
|
str
|
Hexadecimal string. |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Octal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If hexadecimal string is invalid. |
Example
HEX2OCT('F') '17' HEX2OCT('A', 4) '0012'
Cost: O(n) where n is the length of hexadecimal string.
Source code in shortfx/fxExcel/engineering_formulas.py
IMABS(complex_num: complex) -> float
¶
Returns the absolute value (modulus) of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Absolute value. |
Example
IMABS(3+4j) 5.0
Cost: O(1), modulus calculation.
Source code in shortfx/fxExcel/engineering_formulas.py
IMAGINARY(complex_num: complex) -> float
¶
Returns the imaginary part of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Imaginary part. |
Example
IMAGINARY(3+4j) 4.0
Cost: O(1), imaginary part extraction.
Source code in shortfx/fxExcel/engineering_formulas.py
IMARGUMENT(complex_num: complex) -> float
¶
Returns the argument (angle in radians) of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Argument in radians. |
Example
round(IMARGUMENT(3+4j), 4) 0.9273
Cost: O(1), phase calculation.
Source code in shortfx/fxExcel/engineering_formulas.py
IMCONJUGATE(complex_num: complex) -> complex
¶
Returns the complex conjugate of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Complex conjugate. |
Example
IMCONJUGATE(3+4j) (3-4j)
Cost: O(1), conjugate operation.
Source code in shortfx/fxExcel/engineering_formulas.py
IMCOS(complex_num: complex) -> complex
¶
Returns the cosine of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Cosine of the complex number. |
Example
IMCOS(1+1j) (0.8337300251311491-0.9888977057628651j)
Cost: O(1), complex cosine.
Source code in shortfx/fxExcel/engineering_formulas.py
IMCOSH(complex_num: complex) -> complex
¶
Returns the hyperbolic cosine of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Hyperbolic cosine. |
Example
IMCOSH(1+1j) (0.8337300251311491+0.9888977057628651j)
Cost: O(1), complex hyperbolic cosine.
Source code in shortfx/fxExcel/engineering_formulas.py
IMCOT(complex_num: complex) -> complex
¶
Returns the cotangent of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Cotangent. |
Example
IMCOT(1+1j) (0.21762156185440268-0.8680141428959249j)
Cost: O(1), complex cotangent.
Source code in shortfx/fxExcel/engineering_formulas.py
IMCSC(complex_num: complex) -> complex
¶
Returns the cosecant of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Cosecant. |
Example
IMCSC(1+1j) (0.6215180171704284-0.30393100162842646j)
Cost: O(1), complex cosecant.
Source code in shortfx/fxExcel/engineering_formulas.py
IMCSCH(complex_num: complex) -> complex
¶
Returns the hyperbolic cosecant of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Hyperbolic cosecant. |
Example
IMCSCH(1+1j) (0.30393100162842646-0.6215180171704284j)
Cost: O(1), complex hyperbolic cosecant.
Source code in shortfx/fxExcel/engineering_formulas.py
IMDIV(complex_num1: complex, complex_num2: complex) -> complex
¶
Returns the quotient of two complex numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num1
|
complex
|
Numerator. |
required |
complex_num2
|
complex
|
Denominator. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Quotient complex_num1 / complex_num2. |
Example
IMDIV(6+8j, 2+0j) (3+4j)
Cost: O(1), complex division.
Source code in shortfx/fxExcel/engineering_formulas.py
IMEXP(complex_num: complex) -> complex
¶
Returns the exponential of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
e^(complex_num). |
Example
IMEXP(1+1j) (1.4686939399158851+2.2873552871788423j)
Cost: O(1), complex exponential.
Source code in shortfx/fxExcel/engineering_formulas.py
IMLN(complex_num: complex) -> complex
¶
Returns the natural logarithm of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Natural logarithm. |
Example
IMLN(3+4j) (1.6094379124341003+0.9272952180016122j)
Cost: O(1), complex logarithm.
Source code in shortfx/fxExcel/engineering_formulas.py
IMLOG10(complex_num: complex) -> complex
¶
Returns the common logarithm (base 10) of a complex number. Excel function: IMLOG10 (Spanish: IM.LOG10)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Common logarithm of the complex number. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If input is invalid. |
Example
z = 3 + 4j result = IMLOG10(z) round(result.real, 5), round(result.imag, 5) (0.69897, 0.42785)
Cost: O(1), logarithm computation.
Source code in shortfx/fxExcel/engineering_formulas.py
IMLOG2(complex_num: complex) -> complex
¶
Returns the base-2 logarithm of a complex number. Excel function: IMLOG2 (Spanish: IM.LOG2)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Base-2 logarithm of the complex number. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If input is invalid. |
Example
z = 4 + 0j result = IMLOG2(z) round(result.real, 5) 2.0
Cost: O(1), logarithm computation.
Source code in shortfx/fxExcel/engineering_formulas.py
IMPOWER(complex_num: complex, n: Union[int, float]) -> complex
¶
Returns a complex number raised to a power.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number base. |
required |
n
|
Union[int, float]
|
Exponent. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Result of complex_num^n. |
Example
IMPOWER(2+3j, 2) (-5+12j)
Cost: O(1), complex exponentiation.
Source code in shortfx/fxExcel/engineering_formulas.py
IMPRODUCT(*complex_nums: complex) -> complex
¶
Returns the product of complex numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*complex_nums
|
complex
|
Variable number of complex numbers. |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Product of all complex numbers. |
Example
IMPRODUCT(2+3j, 1+2j) (-4+7j)
Cost: O(n), where n is the number of arguments.
Source code in shortfx/fxExcel/engineering_formulas.py
IMREAL(complex_num: complex) -> float
¶
Returns the real part of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Real part. |
Example
IMREAL(3+4j) 3.0
Cost: O(1), real part extraction.
Source code in shortfx/fxExcel/engineering_formulas.py
IMSEC(complex_num: complex) -> complex
¶
Returns the secant of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Secant. |
Example
IMSEC(1+1j) (0.4983370305551868+0.591083841721045j)
Cost: O(1), complex secant.
Source code in shortfx/fxExcel/engineering_formulas.py
IMSECH(complex_num: complex) -> complex
¶
Returns the hyperbolic secant of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Hyperbolic secant. |
Example
IMSECH(1+1j) (0.4983370305551868-0.591083841721045j)
Cost: O(1), complex hyperbolic secant.
Source code in shortfx/fxExcel/engineering_formulas.py
IMSIN(complex_num: complex) -> complex
¶
Returns the sine of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Sine. |
Example
IMSIN(1+1j) (1.2984575814159773+0.6349639147847361j)
Cost: O(1), complex sine.
Source code in shortfx/fxExcel/engineering_formulas.py
IMSINH(complex_num: complex) -> complex
¶
Returns the hyperbolic sine of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Hyperbolic sine. |
Example
IMSINH(1+1j) (0.6349639147847361+1.2984575814159773j)
Cost: O(1), complex hyperbolic sine.
Source code in shortfx/fxExcel/engineering_formulas.py
IMSQRT(complex_num: complex) -> complex
¶
Returns the square root of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Square root. |
Example
IMSQRT(-1) 1j
Cost: O(1), complex square root.
Source code in shortfx/fxExcel/engineering_formulas.py
IMSUB(complex_num1: complex, complex_num2: complex) -> complex
¶
Returns the difference between two complex numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num1
|
complex
|
First complex number. |
required |
complex_num2
|
complex
|
Second complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Difference complex_num1 - complex_num2. |
Example
IMSUB(5+6j, 2+3j) (3+3j)
Cost: O(1), complex subtraction.
Source code in shortfx/fxExcel/engineering_formulas.py
IMSUM(*complex_nums: complex) -> complex
¶
Returns the sum of complex numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*complex_nums
|
complex
|
Variable number of complex numbers. |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Sum of all complex numbers. |
Example
IMSUM(2+3j, 1+2j, 3+4j) (6+9j)
Cost: O(n), where n is the number of arguments.
Source code in shortfx/fxExcel/engineering_formulas.py
IMTAN(complex_num: complex) -> complex
¶
Returns the tangent of a complex number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex_num
|
complex
|
Complex number. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
complex |
complex
|
Tangent. |
Example
IMTAN(1+1j) (0.27175258531951174+1.0839233273386948j)
Cost: O(1), complex tangent.
Source code in shortfx/fxExcel/engineering_formulas.py
OCT2BIN(octal: str, places: int = None) -> str
¶
Converts an octal string to binary. Excel function: OCT2BIN (Spanish: OCT.A.BIN)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
octal
|
str
|
Octal string (up to 10 characters). |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Binary equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If octal string is invalid. |
Example
OCT2BIN('12') '1010' OCT2BIN('7', 4) '0111'
Cost: O(n) where n is the length of octal string.
Source code in shortfx/fxExcel/engineering_formulas.py
OCT2DEC(octal: str) -> int
¶
Converts an octal string to decimal. Excel function: OCT2DEC (Spanish: OCT.A.DEC)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
octal
|
str
|
Octal string (up to 10 characters). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Decimal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If octal string is invalid. |
Example
OCT2DEC('12') 10 OCT2DEC('144') 100
Cost: O(n) where n is the length of octal string.
Source code in shortfx/fxExcel/engineering_formulas.py
OCT2HEX(octal: str, places: int = None) -> str
¶
Converts an octal string to hexadecimal. Excel function: OCT2HEX (Spanish: OCT.A.HEX)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
octal
|
str
|
Octal string. |
required |
places
|
int
|
Number of characters to use. If None, uses minimum needed. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Hexadecimal equivalent. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If octal string is invalid. |
Example
OCT2HEX('12') 'A' OCT2HEX('144', 4) '0064'
Cost: O(n) where n is the length of octal string.