Exponent Solver
Solve for the exponent from a known base and result using logarithms.
📐 计算公式
解指数方程 aˣ=b(本页代码口径):x=ln(b)÷ln(a),分母按 |a−1| 分流——接近 1 用 Math.log1p(a−1) 稳定计算,远离 1 用 Math.log(a) 避免 a−1 抵消;联动量:回代校验=aˣ、反推底数=b^(1÷x)(b=1 时 x=0,任意 a≠1 都成立,反推不唯一)、x 与 ln(a) 之比=x÷ln(a)(直接用实际分母,0<a<1 时比值为负)。校验:a、b 必填且有限;a≤0 或 b≤0 报错;只有 a 恰等于 1 才拒绝(a=1.0000000000005 等近 1 合法底数可正常求解,仅提示浮点精度限制;b=1 时 x 任意,否则无解)。判据:无固定分级,a>1 时 x 随 b 单调增、0<a<1 时单调减。
输入底数 a 与结果 b,求指数 x。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Solving a^x = b | x = log_a(b) = ln(b)/ln(a) | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
| Existence conditions | A unique real solution exists only for a > 0, a ≠ 1, b > 0 | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
| Inverse of the logarithm | a^(log_a b) = b and log_a(a^x) = x | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
| Special value | When b = 1 the solution is x = 0 since a^0 = 1 | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
📌 计算说明
- 以 a 为底 b 的对数。
- 2^x=8 → x=3。