LoginSignup
11
6

More than 5 years have passed since last update.

[Pythonによる科学・技術計算] 積分, 数式, sympy

Last updated at Posted at 2017-07-18

内容

sympyのintegrateメソッドを使い,初等関数の,不定積分・定積分・広義積分の解析解を求める。


コード

from sympy import *
x=Symbol('x')                  # 文字'x'を変数xとして定義
y=Symbol('y')                 # 文字 'y'を変数yとして定義
"""
積分:
integrateを使う
"""

#不定積分
integrate(6*x**5, x) # 6 x^5の不定積分
integrate(log(x), x) # log(x)

#定積分
integrate(x**3, (x, -1, 1))  # x^3の[-1,1]までの積分
integrate(sin(x), (x, 0, pi/2)) # sin(x)の[0,pi/2]までの積分

#広義積分
integrate(exp(-x**2), (x, -oo, oo)) #Exp(-x^2)の-∞から+∞までの積分。ガウス積分。

結果

上から順に,以下の通りになる。

スクリーンショット 2017-07-18 14.46.34.png

11
6
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
11
6