2019年9月22日日曜日

学習環境

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



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

    2. d dx x + 1 + x 2 = 1 2 x + 1 + x 2 · 1 + 1 2 1 + x 2 · 2 x = 1 2 x + 1 + x 2 · 1 + x 2 + x 1 + x 2 = x + 1 + x 2 2 1 + x 2

    3. d dx a + x b + x a - x b - x = 1 2 a - x b - x a + x b + x · b + x + a + x a - x b - x - a + x b + x - b - x - a - x a - x 2 b - x 2 = 1 2 a - x b - x a + x b + x · a + b + 2 x a - x b - x - a + x b + x - a - b + 2 x a - x 2 b - x 2 = 1 2 a - x b - x a 2 - x 2 b 2 - x 2 · ( a + b a - x b - x + a + x b + x a - x 2 b - x 2 + 2 x a - x b - x - a + x b + x a - x 2 b - x 2 ) = 1 2 · 1 a 2 - x 2 b 2 - x 2 · 1 a - x b - x a + b 2 a b + 2 x 2 + 2 x - 2 a x - 2 b x = a + b a b + x 2 - 2 x 2 a 2 - x 2 b 2 - x 2 a - x b - x = a + b a b - x 2 a 2 - x 2 b 2 - x 2 a - x b - x

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, sqrt, Derivative

print('3.')


x, a, b = symbols('x, a, b')
fs = [sqrt(2 * x - 1 / x ** 2),
      sqrt(x + sqrt(1 + x ** 2)),
      sqrt((a + x) * (b + x) / ((a - x) * (b - x)))]
dfs1 = [Derivative(f, x, 1).doit() for f in fs]
dfs2 = [(x ** 3 + 1) / (x ** 2 * sqrt(2 * x ** 3 - 1)),
        sqrt(x + sqrt(1 + x ** 2)) / (2 * sqrt(1 + x ** 2)),
        (a + b) * (a * b - x ** 2) /
        (sqrt((a ** 2 - x ** 2) * (b ** 2 - x ** 2)) *
         (a - x) * (b - x))]
for i, o in enumerate(zip(dfs1, dfs2), 1):
    print(f'({i})')
    for t in o:
        pprint(t.factor())
        print()

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

$ ./sample3.py
3.
(1)
        ⎛ 2        ⎞
(x + 1)⋅⎝x  - x + 1⎠
────────────────────
         __________ 
  3     ╱       1   
 x ⋅   ╱  2⋅x - ──  
      ╱          2  
    ╲╱          x   

        ⎛ 2        ⎞
(x + 1)⋅⎝x  - x + 1⎠
────────────────────
        __________  
   2   ╱    3       
  x ⋅╲╱  2⋅x  - 1   

(2)
    _________________
   ╱        ________ 
  ╱        ╱  2      
╲╱   x + ╲╱  x  + 1  
─────────────────────
         ________    
        ╱  2         
    2⋅╲╱  x  + 1     

    _________________
   ╱        ________ 
  ╱        ╱  2      
╲╱   x + ╲╱  x  + 1  
─────────────────────
         ________    
        ╱  2         
    2⋅╲╱  x  + 1     

(3)
      ______________________                     
     ╱   (a + x)⋅(b + x)             ⎛        2⎞ 
-   ╱  ──────────────────── ⋅(a + b)⋅⎝-a⋅b + x ⎠ 
   ╱                      2                      
 ╲╱    a⋅b - a⋅x - b⋅x + x                       
─────────────────────────────────────────────────
        (-a + x)⋅(a + x)⋅(-b + x)⋅(b + x)        

                          ⎛        2⎞                  
                 -(a + b)⋅⎝-a⋅b + x ⎠                  
───────────────────────────────────────────────────────
  ___________________________________                  
╲╱ (-a + x)⋅(a + x)⋅(-b + x)⋅(b + x) ⋅(-a + x)⋅(-b + x)

$ 

0 コメント:

コメントを投稿