LoginSignup
1
1

More than 1 year has passed since last update.

y√x の 計算方法(Python)

Posted at

今回はhmathで使用されている$\sqrt[y]{x}$の計算方法をご紹介します。

計算式

hmathは次の数式で$\sqrt[y]{x}$を定義しています。

\sqrt[y]{x}=x^\frac{1}{y}

なぜこのような式になるかというと、$xy=x\frac{1}{y}$
みたいに$\sqrt[y]{x}$も$x^\frac{1}{y}$という$y$の逆数乗で計算できます。

プログラム

hmath内では次のプログラムで計算しています。

radical.py
def radical(x, y):
    return y ** (1 / x)

順番は$\sqrt[x]{y}$
逆数を使って計算することで逆の計算ができる。

最後まで見ていだきありがとうございました。
ぜひ活用してみてください。

1
1
3

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
1
1