数学のブログ

積分法 パラメーター曲線、弧の長さ、定積分

微分積分学 (ちくま学芸文庫) (吉田 洋一(著)、筑摩書房)のⅣ.(積分法)、演習問題22.の解答を求めてみる。

3 t - t 3 = 0 t ( 3 - t 2 ) = 0 t = ± 3

求める弧の長さ。

0 3 ( dx dt ) 2 + ( dy dt ) 2 dt
= 0 3 ( 6 t ) 2 + ( 3 - 3 t 2 ) 2 dt
= 3 0 3 4 t 2 + 1 - 2 t 2 + t 4
= 3 0 3 t 4 + 2 t 2 + 1 dt
= 3 0 3 ( t 2 + 1 ) 2 dt
= 3 0 3 ( t 2 + 1 ) dt
= 3 [ 1 3 t 3 + t ] 0 3
= 3 ( 3 + 3 )
= 6 3

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import sqrt, Integral, Derivative, solve
from sympy.plotting import plot_parametric
from sympy.abc import t

print('22.')

x = 3 * t ** 2
y = 3 * t - t ** 3
x1, y1 = [Derivative(o, t, 1).doit() for o in [x, y]]


class Test(TestCase):
    def test(self):
        self.assertEqual(
            float(Integral(sqrt(x1 ** 2 + y1 ** 2), (t, 0, sqrt(3))).doit()),
            float(6 * sqrt(3))
        )
        self.assertEqual(
            float(Integral(sqrt(x1 ** 2 + y1 ** 2), (t, -sqrt(3), 0)).doit()),
            float(6 * sqrt(3))
        )


p = plot_parametric(
    (x, y, (t, -2.5, -sqrt(3))),
    (x, y, (t, -sqrt(3), 0)),
    (x, y, (t, 0, sqrt(3))),
    (x, y, (t, sqrt(3), 2.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.save('sample22.png')
p.show()
if __name__ == "__main__":
    main()

入出力結果

% ./sample22.py -v
22.
test (__main__.Test) ... ok

----------------------------------------------------------------------
Ran 1 test in 3.504s

OK
%