2019年8月9日金曜日

学習環境

微分積分学 (ちくま学芸文庫) (吉田 洋一(著)、筑摩書房)のI.(微分法)、6.(導関数)、問1の解答を求めてみる。



    1. 1 - x + h 2 - 1 - x 2 h = - 2 h x - h 2 h = - 2 x - h h 0 - 2 x - h - 2 x

    2. x + h 3 - x 3 h = 3 x 2 h + 3 x h 2 + h 3 h = 3 x 2 + 3 x h + h 2 h 0 x + h 3 - x 3 h 3 x 2

    3. d dx x + 1 x = dx dx + d dx 1 x = 1 - 1 x 2

    4. d dx x 3 - 3 x 2 + 2 = d dx x 3 - 3 d dx x 2 + d dx 2 = 3 x 2 - 6 x

    5. d dx 3 x - x 3 = 3 d dx x - d dx x 3 = 3 - 3 x 2

    6. x + h 1 3 - x 1 3 h = x + h 1 3 - x 1 3 x + h 2 3 + x + h 1 3 x 1 3 + x 2 3 h x + h 2 3 + x + h 1 3 x 1 3 + x 2 3 = x + h - x h x + h 2 3 + x + h 1 3 x 1 3 + x 2 3 = h h x + h 2 3 + x + h 1 3 x 1 3 + x 2 3 = 1 x + h 2 3 + x + h 1 3 x 1 3 + x 2 3 h 0 x + h 1 3 - x 1 3 h 1 3 x - 2 3

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, plot, Derivative, Limit, Rational

print('1.')

x, h = symbols('x, h')
fs = [1 - x ** 2,
      x ** 3,
      x + 1 / x,
      x ** 3 - 3 * x ** 2 + 2,
      3 * x - x ** 3,
      x ** Rational(1, 3)]


for i, f in enumerate(fs, 1):
    print(f'({i})')
    df = Derivative(f, x, 1)
    for o in [df, df.doit()]:
        pprint(o)
        print()
    g = (f.subs({x: x + h}) - f) / h
    for d in ['+', '-']:
        l = Limit(g, h, 0, dir=d)
        for o in [l, l.doit()]:
            pprint(o)
            print()

p = plot(*fs,
         (x, -5, 5),
         ylim=(-5, 5),
         legend=True,
         show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'pink', 'gray', 'skyblue', 'yellow']


for o, color in zip(p, colors):
    o.line_color = color

p.show()
p.save('sample1.png')

入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))

C:\Users\...>py sample1.py
1.
(1)
d ⎛     2⎞
──⎝1 - x ⎠
dx        

-2⋅x

     ⎛ 2          2⎞
     ⎜x  - (h + x) ⎟
 lim ⎜─────────────⎟
h─→0⁺⎝      h      ⎠

-2⋅x

     ⎛ 2          2⎞
     ⎜x  - (h + x) ⎟
 lim ⎜─────────────⎟
h─→0⁻⎝      h      ⎠

-2⋅x

(2)
d ⎛ 3⎞
──⎝x ⎠
dx    

   2
3⋅x 

     ⎛   3          3⎞
     ⎜- x  + (h + x) ⎟
 lim ⎜───────────────⎟
h─→0⁺⎝       h       ⎠

   2
3⋅x 

     ⎛   3          3⎞
     ⎜- x  + (h + x) ⎟
 lim ⎜───────────────⎟
h─→0⁻⎝       h       ⎠

   2
3⋅x 

(3)
d ⎛    1⎞
──⎜x + ─⎟
dx⎝    x⎠

    1 
1 - ──
     2
    x 

     ⎛      1     1⎞
     ⎜h + ───── - ─⎟
     ⎜    h + x   x⎟
 lim ⎜─────────────⎟
h─→0⁺⎝      h      ⎠

 2    
x  - 1
──────
   2  
  x   

     ⎛      1     1⎞
     ⎜h + ───── - ─⎟
     ⎜    h + x   x⎟
 lim ⎜─────────────⎟
h─→0⁻⎝      h      ⎠

 2    
x  - 1
──────
   2  
  x   

(4)
d ⎛ 3      2    ⎞
──⎝x  - 3⋅x  + 2⎠
dx               

   2      
3⋅x  - 6⋅x

     ⎛   3      2          3            2⎞
     ⎜- x  + 3⋅x  + (h + x)  - 3⋅(h + x) ⎟
 lim ⎜───────────────────────────────────⎟
h─→0⁺⎝                 h                 ⎠

   2      
3⋅x  - 6⋅x

     ⎛   3      2          3            2⎞
     ⎜- x  + 3⋅x  + (h + x)  - 3⋅(h + x) ⎟
 lim ⎜───────────────────────────────────⎟
h─→0⁻⎝                 h                 ⎠

   2      
3⋅x  - 6⋅x

(5)
d ⎛   3      ⎞
──⎝- x  + 3⋅x⎠
dx            

       2
3 - 3⋅x 

     ⎛       3          3⎞
     ⎜3⋅h + x  - (h + x) ⎟
 lim ⎜───────────────────⎟
h─→0⁺⎝         h         ⎠

       2
3 - 3⋅x 

     ⎛       3          3⎞
     ⎜3⋅h + x  - (h + x) ⎟
 lim ⎜───────────────────⎟
h─→0⁻⎝         h         ⎠

       2
3 - 3⋅x 

(6)
d ⎛3 ___⎞
──⎝╲╱ x ⎠
dx       

  1   
──────
   2/3
3⋅x   

     ⎛  3 ___   3 _______⎞
     ⎜- ╲╱ x  + ╲╱ h + x ⎟
 lim ⎜───────────────────⎟
h─→0⁺⎝         h         ⎠

  1   
──────
   2/3
3⋅x   

     ⎛  3 ___   3 _______⎞
     ⎜- ╲╱ x  + ╲╱ h + x ⎟
 lim ⎜───────────────────⎟
h─→0⁻⎝         h         ⎠

  1   
──────
   2/3
3⋅x   


c:\Users\...>

0 コメント:

コメントを投稿

関連コンテンツ