2018年2月4日日曜日

学習環境

解析入門〈3〉(松坂 和夫(著)、岩波書店)の第14章(多変数の関数)、14.2(高次偏導関数、テイラーの定理)、問題3-(c).を取り組んでみる。


    1. z u = g r a d f x , y · e u , - e - u = z x , z y . e u , - e - u = z x e u - z y e - u
      2 z u 2 = 2 z x 2 , 2 z y x · e u , - e - u e u + z x e u - 2 z x y , 2 z y 2 · e u , - e - u e - u - z y e - u = 2 z x 2 e 2 u - 2 z y x + z x e u - 2 z x y + 2 y 2 e - 2 u + z y e - u = 2 z x 2 e 2 u - 2 2 z x y + z x e u + z y e - u + 2 z y 2 e - 2 u
      z v = f x e v - f y e - v
      2 z v 2 = 2 z x 2 e 2 v - 2 2 z x y + z x e v + z y e - v + 2 z y 2 e - 2 v
      2 z u v = f x f x e v - f y e - v , f y f x e v - f y e - v · e u , - e - u = 2 z x 2 e u + v - 2 z x y e u - v - 2 z y x e v - u + 2 z y 2 e - v - u
      2 z u 2 + 2 2 z u v + 2 z v 2 = 2 z x 2 e 2 u + e 2 v + 2 e u + v + 2 z y 2 e - 2 u + e - 2 v + 2 e - u + v - 2 2 z x dy e u - v + e v - u + 2 + z x e u + e v + z y e - u + e - v = 2 z x 2 e u + e v 2 + 2 z y 2 e - u + e - v 2 - 2 e n + e v e - u + e - v 2 z x y + x z x + y z y = x 2 2 z x 2 + y 2 2 z y 2 - 2 x y 2 z x y + x z x + y z y

コード(Emacs)

Python 3

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

u, v = symbols('u, v')
x = exp(u) + exp(v)
y = exp(-u) + exp(-v)
f = Function('f')(x, y)
expr = Derivative(f, u, 2) + 2 * Derivative(Derivative(f, v, 1),
                                            u, 1) + Derivative(f, v, 2)
for t in [expr, expr.doit(), expr.doit().factor()]:
    pprint(t)
    print()

入出力結果(Terminal, Jupyter(IPython))

$ ./sample3.py
  ⎛   ⎛  2                   ⎞│                 ⎛⎛    2             ⎞│        
  ⎜ v ⎜ ∂  ⎛ ⎛     -v    -u⎞⎞⎟│              -v ⎜⎜   ∂              ⎟│        
2⋅⎜ℯ ⋅⎜────⎝f⎝ξ₁, ℯ   + ℯ  ⎠⎠⎟│           - ℯ  ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    u   
  ⎜   ⎜   2                  ⎟│    u    v       ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₁=ℯ  + 
  ⎝   ⎝∂ξ₁                   ⎠│ξ₁=ℯ  + ℯ                                      

  ⎞│            ⎞        ⎛   ⎛⎛    2             ⎞│            ⎞│             
  ⎟│            ⎟  u     ⎜ v ⎜⎜   ∂              ⎟│            ⎟│             
 v⎟│    -v    -u⎟⋅ℯ  - 2⋅⎜ℯ ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    -v    -u⎟│    u    v - 
ℯ ⎠│ξ₂=ℯ   + ℯ  ⎟        ⎜   ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₂=ℯ   + ℯ  ⎠│ξ₁=ℯ  + ℯ    
                ⎠        ⎝                                                    

    ⎛  2                 ⎞│            ⎞         2                            
 -v ⎜ ∂  ⎛ ⎛ u    v    ⎞⎞⎟│            ⎟  -u    ∂ ⎛ ⎛ u    v   -v    -u⎞⎞    ∂
ℯ  ⋅⎜────⎝f⎝ℯ  + ℯ , ξ₂⎠⎠⎟│            ⎟⋅ℯ   + ───⎝f⎝ℯ  + ℯ , ℯ   + ℯ  ⎠⎠ + ──
    ⎜   2                ⎟│    -v    -u⎟         2                            
    ⎝∂ξ₂                 ⎠│ξ₂=ℯ   + ℯ  ⎠       ∂u                           ∂v

2                       
 ⎛ ⎛ u    v   -v    -u⎞⎞
─⎝f⎝ℯ  + ℯ , ℯ   + ℯ  ⎠⎠
2                       
                        

⎛   ⎛  2                   ⎞│                 ⎛⎛    2             ⎞│          
⎜ u ⎜ ∂  ⎛ ⎛     -v    -u⎞⎞⎟│              -u ⎜⎜   ∂              ⎟│          
⎜ℯ ⋅⎜────⎝f⎝ξ₁, ℯ   + ℯ  ⎠⎠⎟│           - ℯ  ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    u    v
⎜   ⎜   2                  ⎟│    u    v       ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₁=ℯ  + ℯ 
⎝   ⎝∂ξ₁                   ⎠│ξ₁=ℯ  + ℯ                                        

⎞│            ⎞      ⎛   ⎛⎛    2             ⎞│            ⎞│                 
⎟│            ⎟  u   ⎜ u ⎜⎜   ∂              ⎟│            ⎟│              -u 
⎟│    -v    -u⎟⋅ℯ  - ⎜ℯ ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    -v    -u⎟│    u    v - ℯ  ⋅
⎠│ξ₂=ℯ   + ℯ  ⎟      ⎜   ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₂=ℯ   + ℯ  ⎠│ξ₁=ℯ  + ℯ        
              ⎠      ⎝                                                        

⎛  2                 ⎞│            ⎞         ⎛   ⎛  2                   ⎞│    
⎜ ∂  ⎛ ⎛ u    v    ⎞⎞⎟│            ⎟  -u     ⎜ v ⎜ ∂  ⎛ ⎛     -v    -u⎞⎞⎟│    
⎜────⎝f⎝ℯ  + ℯ , ξ₂⎠⎠⎟│            ⎟⋅ℯ   + 2⋅⎜ℯ ⋅⎜────⎝f⎝ξ₁, ℯ   + ℯ  ⎠⎠⎟│    
⎜   2                ⎟│    -v    -u⎟         ⎜   ⎜   2                  ⎟│    
⎝∂ξ₂                 ⎠│ξ₂=ℯ   + ℯ  ⎠         ⎝   ⎝∂ξ₁                   ⎠│ξ₁=ℯ

             ⎛⎛    2             ⎞│          ⎞│            ⎞      ⎛   ⎛  2    
          -v ⎜⎜   ∂              ⎟│          ⎟│            ⎟  u   ⎜ v ⎜ ∂  ⎛ ⎛
       - ℯ  ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    u    v⎟│    -v    -u⎟⋅ℯ  + ⎜ℯ ⋅⎜────⎝f⎝
u    v       ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₁=ℯ  + ℯ ⎠│ξ₂=ℯ   + ℯ  ⎟      ⎜   ⎜   2   
  + ℯ                                                      ⎠      ⎝   ⎝∂ξ₁    

               ⎞│                 ⎛⎛    2             ⎞│          ⎞│          
     -v    -u⎞⎞⎟│              -v ⎜⎜   ∂              ⎟│          ⎟│          
ξ₁, ℯ   + ℯ  ⎠⎠⎟│           - ℯ  ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    u    v⎟│    -v    
               ⎟│    u    v       ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₁=ℯ  + ℯ ⎠│ξ₂=ℯ   + ℯ
               ⎠│ξ₁=ℯ  + ℯ                                                    

  ⎞      ⎛   ⎛⎛    2             ⎞│            ⎞│                 ⎛  2        
  ⎟  v   ⎜ v ⎜⎜   ∂              ⎟│            ⎟│              -v ⎜ ∂  ⎛ ⎛ u  
-u⎟⋅ℯ  - ⎜ℯ ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    -v    -u⎟│    u    v - ℯ  ⋅⎜────⎝f⎝ℯ  +
  ⎟      ⎜   ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₂=ℯ   + ℯ  ⎠│ξ₁=ℯ  + ℯ        ⎜   2       
  ⎠      ⎝                                                        ⎝∂ξ₂        

         ⎞│            ⎞         ⎛   ⎛⎛    2             ⎞│            ⎞│     
  v    ⎞⎞⎟│            ⎟  -v     ⎜ v ⎜⎜   ∂              ⎟│            ⎟│     
 ℯ , ξ₂⎠⎠⎟│            ⎟⋅ℯ   - 2⋅⎜ℯ ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    -v    -u⎟│    u
         ⎟│    -v    -u⎟         ⎜   ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₂=ℯ   + ℯ  ⎠│ξ₁=ℯ 
         ⎠│ξ₂=ℯ   + ℯ  ⎠         ⎝                                            

            ⎛  2                 ⎞│            ⎞                              
         -v ⎜ ∂  ⎛ ⎛ u    v    ⎞⎞⎟│            ⎟  -u    u ⎛ ∂ ⎛ ⎛     -v    -u
    v - ℯ  ⋅⎜────⎝f⎝ℯ  + ℯ , ξ₂⎠⎠⎟│            ⎟⋅ℯ   + ℯ ⋅⎜───⎝f⎝ξ₁, ℯ   + ℯ  
 + ℯ        ⎜   2                ⎟│    -v    -u⎟          ⎝∂ξ₁                
            ⎝∂ξ₂                 ⎠│ξ₂=ℯ   + ℯ  ⎠                              

                                                                              
⎞⎞⎞│              v ⎛ ∂ ⎛ ⎛     -v    -u⎞⎞⎞│              -v ⎛ ∂ ⎛ ⎛ u    v   
⎠⎠⎟│    u    v + ℯ ⋅⎜───⎝f⎝ξ₁, ℯ   + ℯ  ⎠⎠⎟│    u    v + ℯ  ⋅⎜───⎝f⎝ℯ  + ℯ , ξ
  ⎠│ξ₁=ℯ  + ℯ       ⎝∂ξ₁                  ⎠│ξ₁=ℯ  + ℯ        ⎝∂ξ₂             
                                                                              

                                                          
 ⎞⎞⎞│                -u ⎛ ∂ ⎛ ⎛ u    v    ⎞⎞⎞│            
₂⎠⎠⎟│    -v    -u + ℯ  ⋅⎜───⎝f⎝ℯ  + ℯ , ξ₂⎠⎠⎟│    -v    -u
   ⎠│ξ₂=ℯ   + ℯ         ⎝∂ξ₂                ⎠│ξ₂=ℯ   + ℯ  
                                                          

          ⎛          ⎛  2                   ⎞│                       ⎛  2     
⎛ u    v⎞ ⎜ 3⋅u  2⋅v ⎜ ∂  ⎛ ⎛     -v    -u⎞⎞⎟│              2⋅u  3⋅v ⎜ ∂  ⎛ ⎛ 
⎝ℯ  + ℯ ⎠⋅⎜ℯ   ⋅ℯ   ⋅⎜────⎝f⎝ξ₁, ℯ   + ℯ  ⎠⎠⎟│           + ℯ   ⋅ℯ   ⋅⎜────⎝f⎝ξ
          ⎜          ⎜   2                  ⎟│    u    v             ⎜   2    
          ⎝          ⎝∂ξ₁                   ⎠│ξ₁=ℯ  + ℯ              ⎝∂ξ₁     

              ⎞│                                                              
    -v    -u⎞⎞⎟│              2⋅u  2⋅v ⎛ ∂ ⎛ ⎛     -v    -u⎞⎞⎞│               
₁, ℯ   + ℯ  ⎠⎠⎟│           + ℯ   ⋅ℯ   ⋅⎜───⎝f⎝ξ₁, ℯ   + ℯ  ⎠⎠⎟│    u    v - 2⋅
              ⎟│    u    v             ⎝∂ξ₁                  ⎠│ξ₁=ℯ  + ℯ      
              ⎠│ξ₁=ℯ  + ℯ                                                     

        ⎛⎛    2             ⎞│            ⎞│                       ⎛⎛    2    
 2⋅u  v ⎜⎜   ∂              ⎟│            ⎟│                u  2⋅v ⎜⎜   ∂     
ℯ   ⋅ℯ ⋅⎜⎜───────(f(ξ₁, ξ₂))⎟│    -v    -u⎟│    u    v - 2⋅ℯ ⋅ℯ   ⋅⎜⎜───────(f
        ⎝⎝∂ξ₂ ∂ξ₁           ⎠│ξ₂=ℯ   + ℯ  ⎠│ξ₁=ℯ  + ℯ              ⎝⎝∂ξ₂ ∂ξ₁  
                                                                              

         ⎞│            ⎞│                                                     
         ⎟│            ⎟│              u  v ⎛ ∂ ⎛ ⎛ u    v    ⎞⎞⎞│            
(ξ₁, ξ₂))⎟│    -v    -u⎟│    u    v + ℯ ⋅ℯ ⋅⎜───⎝f⎝ℯ  + ℯ , ξ₂⎠⎠⎟│    -v    -u
         ⎠│ξ₂=ℯ   + ℯ  ⎠│ξ₁=ℯ  + ℯ          ⎝∂ξ₂                ⎠│ξ₂=ℯ   + ℯ  
                                                                              

      ⎛  2                 ⎞│                  ⎛  2                 ⎞│        
    u ⎜ ∂  ⎛ ⎛ u    v    ⎞⎞⎟│                v ⎜ ∂  ⎛ ⎛ u    v    ⎞⎞⎟│        
 + ℯ ⋅⎜────⎝f⎝ℯ  + ℯ , ξ₂⎠⎠⎟│             + ℯ ⋅⎜────⎝f⎝ℯ  + ℯ , ξ₂⎠⎠⎟│        
      ⎜   2                ⎟│    -v    -u      ⎜   2                ⎟│    -v  
      ⎝∂ξ₂                 ⎠│ξ₂=ℯ   + ℯ        ⎝∂ξ₂                 ⎠│ξ₂=ℯ   +

    ⎞            
    ⎟  -2⋅u  -2⋅v
    ⎟⋅ℯ    ⋅ℯ    
  -u⎟            
 ℯ  ⎠            

$

0 コメント:

コメントを投稿