Loading [MathJax]/jax/output/CommonHTML/jax.js

2019年8月9日金曜日

学習環境

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



    1. (1-(x+h)2)-(1-x2)h=-2hx-h2h=-2x-hh0-2x-h-2x

    2. (x+h)3-x3h=3x2h+3xh2+h3h=3x2+3xh+h2h0(x+h)3-x3h3x2

    3. ddx(x+1x)=dxdx+ddx(1x)=1-1x2

    4. ddx(x3-3x2+2)=ddxx3-3ddxx2+ddx2=3x2-6x

    5. ddx(3x-x3)=3ddxx-ddxx3=3-3x2

    6. (x+h)13-x13h=((x+h)13-x13)((x+h)23+(x+h)13x13+x23)h((x+h)23+(x+h)13x13+x23)=(x+h)-xh((x+h)23+(x+h)13x13+x23)=hh((x+h)23+(x+h)13x13+x23)=1(x+h)23+(x+h)13x13+x23h0(x+h)13-x13h13x-23

コード

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 コメント:

コメントを投稿