LoginSignup
19
20

More than 5 years have passed since last update.

Pythonで積分

Last updated at Posted at 2014-03-03

課題

  • 以下の積分を求める。
\int_0^1\dfrac{1}{1+x^2}~dx
  • 実際の解は $\pi/4= 0.78539816339...$

手法

内容

  • スクリプト
sample.py
from scipy.integrate import quad

answer, abserr = quad(lambda x: 1/(1+x**2), 0, 1)

print answer
  • 実行結果
> python sample.py
0.785398163397
19
20
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
19
20