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

2019年1月24日木曜日

学習環境

解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第3部(積分)、第13章(積分の応用)、補充問題、曲線の長さの練習問題13の解答を求めてみる。


  1. π0(ddt(a(1-cost)))2+(ddt(a(t-sint)))2dt=π0(a·sint)2+(a(1-cost))2dt=aπ0sin2t+1-2cost+cos2tdt=aπ02-2costdt=a2π01-costdt=2aπ01-cos(t2+t2)dt=2aπ01-(cos2t2-sin2t2)dt=2aπ01-(1-sin2t2-sin2t2)dt=2aπ0sin2t2dt=2aπ0sint2dx=2a[-2cost2]π0=-4a(0-1)=4a

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, Derivative, plot, sqrt, cos, sin
from sympy import pi
from sympy.plotting import plot_parametric

a = symbols('a', positive=True)
t = symbols('t')

x = a * (1 - cos(t))
y = a * (t - sin(t))

I = Integral(sqrt(Derivative(x, t, 1) ** 2 +
                  Derivative(y, t, 1) ** 2), (t, 0, pi))

for o in [I, I.doit(), I.doit()]:
    pprint(o.simplify())
    print()

I = 2 * a * Integral(sqrt(sin(t / 2) ** 2), (t, 0, pi))
for o in [I, I.doit()]:
    pprint(o)
    print()

xa = x.subs({a: 2})
ya = y.subs({a: 2})
p = plot_parametric((xa, ya, (t, -2 * pi, 0)),
                    (xa, ya, (t, 0, pi)),
                    (xa, ya, (t, pi, 2 * pi)),
                    show=False)

colors = ['red', 'green', 'blue']
for i, color in enumerate(colors):
    p[i].line_color = color
p.save('sample13.png')

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

$ python3 sample13.py
π                                                       
⌠                                                       
⎮      ______________________________________________   
⎮     ╱                     2                      2    
⎮    ╱  ⎛∂                 ⎞    ⎛∂                ⎞     
⎮   ╱   ⎜──(a⋅(t - sin(t)))⎟  + ⎜──(-a⋅cos(t) + a)⎟   dt
⎮ ╲╱    ⎝∂t                ⎠    ⎝∂t               ⎠     
⌡                                                       
0                                                       

  π                     
  ⌠                     
  ⎮   _______________   
a⋅⎮ ╲╱ -2⋅cos(t) + 2  dt
  ⌡                     
  0                     

  π                     
  ⌠                     
  ⎮   _______________   
a⋅⎮ ╲╱ -2⋅cos(t) + 2  dt
  ⌡                     
  0                     

    π                 
    ⌠                 
    ⎮     _________   
    ⎮    ╱    2⎛t⎞    
2⋅a⋅⎮   ╱  sin ⎜─⎟  dt
    ⎮ ╲╱       ⎝2⎠    
    ⌡                 
    0                 

4⋅a

$

0 コメント:

コメントを投稿