Processing math: 100%

2019年1月25日金曜日

学習環境

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


  1. (ddθ(rcosθ))2+(ddθ(rsinθ))2=(drdθcosθ-rsinθ)2+(drdθsinθ+rcosθ)2=(drdθ)2cos2θ-2rsinθcosθdrdθ+r2sin2θ+(drdθ)2sin2θ+2rcosθsinθdrdθ+r2cos2θ=r2+(drdθ)2

    求める曲線の長さ。

    21(3θ2)2+(ddθ(3θ2))2dθ=219θ4+(6θ)2dθ=219θ4+36θ2dθ=213θθ2+4dθ=[3223(θ2+4)32]21=832-532=(22)3-532=162-532

コード

Python 3

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

theta = symbols('θ')
r = 3 * theta ** 2
x = r * cos(theta)
y = r * sin(theta)

I = Integral(sqrt(Derivative(x, theta, 1) ** 2 +
                  Derivative(y, theta, 1) ** 2), (theta, 1, 2))

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

for o in [I.doit(), 8 ** Rational(3, 2) - 5 ** Rational(3, 2)]:
    print(float(o))

p = plot_parametric((x, y, (theta, -4 * pi, 1)),
                    (x, y, (theta, 1, 2)),
                    (x, y, (theta, 2, 4 * pi)),
                    show=False)

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

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

$ python3 sample14.py
2                                                  
⌠                                                  
⎮      _________________________________________   
⎮     ╱                  2                    2    
⎮    ╱  ⎛d ⎛   2       ⎞⎞    ⎛d ⎛   2       ⎞⎞     
⎮   ╱   ⎜──⎝3⋅θ ⋅sin(θ)⎠⎟  + ⎜──⎝3⋅θ ⋅cos(θ)⎠⎟   dθ
⎮ ╲╱    ⎝dθ             ⎠    ⎝dθ             ⎠     
⌡                                                  
1                                                  

  2                    
  ⌠                    
  ⎮    _____________   
  ⎮   ╱  2 ⎛ 2    ⎞    
3⋅⎮ ╲╱  θ ⋅⎝θ  + 4⎠  dθ
  ⌡                    
  1                    

11.447077110470572
11.447077110470572
$

0 コメント:

コメントを投稿