Skip to content

Instantly share code, notes, and snippets.

@devlights
Created May 6, 2018 01:41
Show Gist options
  • Save devlights/83d02c809f82c20d462185d44b72b4c6 to your computer and use it in GitHub Desktop.
Save devlights/83d02c809f82c20d462185d44b72b4c6 to your computer and use it in GitHub Desktop.
[python][sympy] python の sympy を使って分数指数計算
import sympy
# 指数部分を定義 (マイナス2分の1乗)
n = -sympy.Rational(1, 2)
print(n)
# 8のマイナス2分の1乗を求める
r = 8**n
print(r) # ==> sympy.sqrt(2)/4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment