2020年1月13日月曜日

学習環境

解析入門(上) (松坂和夫 数学入門シリーズ 4) (松坂 和夫(著)、岩波書店)の第8章(積分の計算)、8.2(定積分の計算)、問題5の解答を求めてみる。



    1. x = a + b 2 + t b - a 2 = h

      とおくと、

      a b dx x - a x - b 3 a + b 2 a + 3 b 2 dt a + b 2 + t - a b - a + b 2 + t = 3 a + b 2 a + 3 b 2 dt b - a 2 + t b - a 2 - t = 3 a + b 2 a + 3 b 2 dt h + t h - t = 3 a + b 2 a + 3 b 2 dt h 2 - t 2 dt = arcsin t h 3 a + b 2 a + 3 b 2 = arcsin a + 3 b 2 h - arcsin 3 a + b 2 h = arcsin a + 3 b 2 · 2 b - a - arcsin 3 a + b 2 · 2 b - a = arcsin a + b b - a - arcsin 3 a + b b - a

    2. α < 1 log x x α dx = x 1 - α 1 - α log x - x 1 - α 1 - α · 1 x dx = 1 1 - α x 1 - α log x - x - α dx = 1 1 - α x 1 - α log x - x 1 - α 1 - α 0 1 log x x x dx = 1 1 - α lim b + 0 x 1 - α log x - x 1 - α 1 - α b 1 = 1 1 - α lim b + 0 - 1 1 - α - b 1 - α log b + b 1 - α 1 - α = 1 1 - α - 1 1 - α = - 1 1 - α 2

    3. 1 + x 1 - x = t dt dx = 1 - x 2 1 + x + 1 + x 2 1 - x 1 - x = 1 - x + 1 + x 2 1 - x 1 - x 2 = 1 1 - x 1 - x 2 1 + x 1 - x = t 2 1 + x = t 2 1 - x x = t 2 - 1 t 2 + 1 dx 1 - 2 a x + a 2 1 - x 2 = 1 - x 1 - 2 a x + a 2 dt = 1 - t 2 - 1 t 2 + 1 1 - 2 a · t 2 - 1 t 2 + 1 + a 2 dt = t 2 + 1 - t 2 - 1 t 2 + 1 - 2 a t 2 - 1 + a 2 t 2 + 1 dt = 2 dt a 2 - 2 a + 1 t 2 + a 2 + 2 a + 1 = 2 dt a - 1 2 t 2 + a + 1 2 = 2 a - 1 2 dt t 2 + a + 1 a - 1 2 = 2 a - 1 2 · a - 1 a + 1 arctan a - 1 a + 1 t = 2 a 2 - 1 arctan a - 1 a + 1 t - 1 1 dx 1 - 2 a x + a 2 1 - λ 2 = 2 a 2 - 1 lim b arctan a - 1 a + 1 t 0 b = 2 a 2 - 1 lim b arctan a - 1 a + 1 b = 2 a 2 - 1 π 2 = π a 2 - 1 a 1

    4. 0 π 2 sin θ sin θ + cos θ d θ = 0 π 2 1 - cos θ sin θ + cos θ d θ = π 2 - 0 π 2 cos θ sin θ + cos θ d θ = π 2 - 0 π 2 sin θ sin θ + cos θ d θ 0 π 2 sin θ sin θ + cos θ d θ = 1 2 · π 2 = π 4

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, Integral, sqrt, pi, log, sin, cos, plot

print('5.')

x = symbols('x')


class MyTestCase(TestCase):
    def test1(self):
        a = 1
        b = 2
        self.assertEqual(Integral(1 / sqrt((x - a) * (b - x)), (x, a, b)).doit(),
                         pi)

    def test2(self):
        alpha = -1
        self.assertEqual(Integral(log(x) / x ** alpha, (x, 0, 1)).doit(),
                         -1 / (1 - alpha) ** 2)

    def test3(self):
        a = 2
        self.assertEqual(float(Integral(1 / ((1 - 2 * a * x + a ** 2) * sqrt(1 - x ** 2)),
                                        (x, -1, 1)).doit()),
                         float(pi / abs(1 - a ** 2)))

    def test4(self):
        self.assertEqual(Integral(sin(x) / (sin(x) + cos(x)), (x, 0, pi / 2)).doit(),
                         pi / 4)


p = plot(1 / sqrt((x - 1) * (2 - x)),
         log(x) / x ** -2,
         1 / ((1 - 2 * 3 * x + 3 ** 2) * sqrt(1 - x ** 2)),
         sin(x) / (sin(x) + cos(x)),
         cos(x) / (sin(x) + cos(x)),
         (x, -5, 5),
         ylim=(-5, 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.show()
p.save('sample5.png')

if __name__ == '__main__':
    main()

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

% ./sample5.py -v
5.
test1 (__main__.MyTestCase) ... ok
test2 (__main__.MyTestCase) ... ok
test3 (__main__.MyTestCase) ... ok
test4 (__main__.MyTestCase) ... ok

----------------------------------------------------------------------
Ran 4 tests in 18.068s

OK
%

0 コメント:

コメントを投稿