2020年1月17日金曜日

学習環境

微分積分学 (ちくま学芸文庫) (吉田 洋一(著)、筑摩書房)のⅣ.(積分法)、4.(定積分(幾何学的定義))、問3.の解答を求めてみる。


  1. 積分法の第一平均値の定理により、

    0 a 1 1 - x 2 dx = 1 1 - 0 + θ a 2 a - 0 = a 1 - θ a 2

    となる

    0 < θ < 1

    が存在する。

    また、 問題の仮定より、

    0 < a < 1

    なので、

    a < a 1 - θ a 2 < a 1 - a 2

    よって、 不等式

    a < 0 a 1 1 - x 2 < a 1 - a 2

    が成り立つ。

    (証明終)

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, Integral, sqrt, plot, Rational
import random

print('3.')

x, a = symbols('x, a')
f = 1 / sqrt(1 - x ** 2)


class MyTestCase(TestCase):
    def test(self):
        for _ in range(10):
            a0 = random.random() + Rational(1, 100000)
            self.assertTrue(a0 < Integral(f.subs({a: a0}), (x, 0, a0)).doit()
                            < a0 / sqrt(1 - a0 ** 2))


a0 = Rational(9, 10)
p = plot(f, a0, f.subs({x: a0}),
         (x, 0, a0),
         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.show()
p.save(f'sample3.png')

if __name__ == '__main__':
    main()

入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))

% ./sample3.py -v
3.
test (__main__.MyTestCase) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.687s

OK
%

0 コメント:

コメントを投稿