Processing math: 100%

2017年6月2日金曜日

学習環境

数学読本〈4〉数列の極限,順列/順列・組合せ/確率/関数の極限と微分法(松坂 和夫(著)、岩波書店)の第17章(関数の変化をとらえる - 関数の極限と微分法)、17.4(いろいろな微分法)、合成関数の微分、問39.を取り組んでみる。


    1. 12(x2)12

    2. 2xcos(x2+5)

    3. 5(sinx)4cosx

    4. 2sin2x

    5. 4(logx)31x

    6. 8(x+1)7

    7. 32(x22)12

    8. sinxecosx

    9. cosxsinx

    10. 2xex2

    11. excose2

    12. elog(cosx)1cosx(sinx)

コード(Emacs)

Python 3

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from sympy import pprint, symbols, sqrt, sin, cos, log, Derivative

x = symbols('x')

for i, f in enumerate([sqrt(x - 2),
                       sin(x ** 2 + 5),
                       sin(x) ** 5,
                       cos(2 * x),
                       log(x) ** 4],
                      1):
    print('({})'.format(i))
    d = Derivative(f, x)
    pprint(d)
    pprint(d.doit())

入出力結果(Terminal, IPython)

$ ./sample39.py
(1)
d ⎛  _______⎞
──⎝╲╱ x - 2 ⎠
dx           
     1     
───────────
    _______
2⋅╲╱ x - 2 
(2)
d ⎛   ⎛ 2    ⎞⎞
──⎝sin⎝x  + 5⎠⎠
dx             
       ⎛ 2    ⎞
2⋅x⋅cos⎝x  + 5⎠
(3)
d ⎛   5   ⎞
──⎝sin (x)⎠
dx         
     4          
5⋅sin (x)⋅cos(x)
(4)
d           
──(cos(2⋅x))
dx          
-2⋅sin(2⋅x)
(5)
d ⎛   4   ⎞
──⎝log (x)⎠
dx         
     3   
4⋅log (x)
─────────
    x
$    

0 コメント:

コメントを投稿