LoginSignup
5
5

More than 5 years have passed since last update.

[Pythonによる科学・技術計算] テイラー展開, 数式, sympy

Last updated at Posted at 2017-07-18

sympyを利用してsin(x)のx=0まわりとx=1.5周りのテイラー展開を行う。


from sympy import *      
"""
series関数を使う。
series("関数", 変数, "x=どこ周りで展開するか", 展開の打ち切り次数)
#デフォルトではx=0周り
"""
x=Symbol('x')                  # 文字'x'を変数xとして定義
y=Symbol('y')                 # 文字 'y'を変数yとして定義
series(sin(x),x) # デフォルト設定

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

series(sin(x),x, 0, 12) # x=0まわりでO(x^12)まで展開

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

series(sin(x),x, 1.5, 12)  # x=1.5まわりでO(x^12)まで展開

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

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