2020年6月24日水曜日

学習環境

代数への出発 (新装版 数学入門シリーズ) (松坂 和夫(著)、岩波書店)の第6章(1次方程式、2次方程式)、練習問題14の解答を求めてみる。


  1. AB の長さを x、 BC の長さを y、 CD の長さを z とする。

    このとき、

    2 x + 2 y + z = 33

    また、

    z = x

    なので、

    3 x + 2 y = 33 y = - 3 x + 33 2

    五角形の面積は

    1 2 · 3 2 x 2 + y z
    = 3 4 x 2 - 3 2 x 2 + 33 2 x = 3 - 6 4 x 2 + 33 2 x = 3 - 6 4 ( x 2 + 4 3 - 6 · 33 2 x ) = 3 - 6 4 ( x + 33 3 - 6 ) 2 - 3 - 6 4 · ( 33 3 - 6 ) 2

    よって、凸五角形の面積の最大値は

    6 - 3 4 · 3 3 2 ( 6 - 3 ) 2 = 3 3 2 4 ( 6 - 3 ) = 3 3 2 ( 6 + 3 ) 4 ( 36 - 3 ) = 33 ( 6 + 3 ) 4 cm 2

コード

#!/usr/bin/env python3
from sympy import plot, sqrt
from sympy.abc import x

print('14.')

s = sqrt(3) * x ** 2 / 4 - 3 * x ** 2 / 2 + 33 * x / 2
p = plot(s, 33 * (6 + sqrt(3)) / 4,
         (x, 0, 10),
         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('sample14.png')

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

% ./sample14.py
14.
%

0 コメント:

コメントを投稿