LoginSignup
0
0

More than 1 year has passed since last update.

python3、mpmathを用いて、自然対数の底eを求めるテスト

Last updated at Posted at 2023-01-18

python3、mpmathを用いて、自然対数の底eを、求める

e.py
#!/usr/bin/python3
import mpmath
mpmath.mp.dps=10000

kaijou = 1
number = 1000
napier = mpmath.mpf('1.0')
 
for i in range(1,number+1):
  kaijou *= i;
  napier += mpmath.mpf('1.0') / kaijou;
 
print("計算結果 e =",end='')
print(napier)
print("mpmath.e =",end='')
print(mpmath.e)
0
0
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
0
0