LoginSignup
4
3

More than 5 years have passed since last update.

bc > 8.0の三乗根の計算 > e(1/3*l(8.0))

Last updated at Posted at 2015-01-31

動作環境

CentOS 6.5
bc 1.06.95

bcコマンドで三乗根を求めたい。でも、bcでは**(1/3)を使えないようだ。
8の三乗根はbc上では以下を実行すると良い。

$ bc -l
e(1/3*l(8.0))
(bcの出力)1.9999999999

tのalpha乗 = exp(alpha * log(t))
という計算式を使っている。

反対にe(3*l(2.0))で7.99999となる。

乗数が3とか整数の場合は2.0^3でも計算できる。乗数が整数以外の計算はエラー(non-zero scale)となる。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3