LOG
Computes the logarithm of a positive value with either the natural base or a user-specified base. This helper appears in closed-form heat-transfer expressions involving logarithmic geometry terms.
The operation is:
y = \log_b(x) = \frac{\ln(x)}{\ln(b)}
Excel Usage
=LOG(x, base)
x(float, required): Input value (-).base(float, optional, default: 2.718281828): Logarithm base (-).
Returns (float): Logarithm of the input (-).
Example 1: Natural log of one
Inputs:
| x |
|---|
| 1 |
Excel formula:
=LOG(1)
Expected output:
0
Example 2: Log base ten of one thousand
Inputs:
| x | base |
|---|---|
| 1000 | 10 |
Excel formula:
=LOG(1000, 10)
Expected output:
3
Example 3: Log base two of eight
Inputs:
| x | base |
|---|---|
| 8 | 2 |
Excel formula:
=LOG(8, 2)
Expected output:
3
Example 4: Natural log of ten
Inputs:
| x |
|---|
| 10 |
Excel formula:
=LOG(10)
Expected output:
2.30259
Python Code
Show Code
from ht.conduction import log as ht_log
def log(x, base=2.718281828):
"""
Compute the logarithm of a value with optional base.
See: https://ht.readthedocs.io/en/latest/ht.conduction.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): Input value (-).
base (float, optional): Logarithm base (-). Default is 2.718281828.
Returns:
float: Logarithm of the input (-).
"""
try:
return ht_log(x, base)
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Input value (-).
Logarithm base (-).