2019年10月8日火曜日

学習環境

新装版 数学読本2 (松坂 和夫(著)、岩波書店)の第7章(急速・緩慢に変化する関係 - 指数関数・対数関数)、7.3(対数関数の性質)、いくつかの例題および問題の補充の問34の解答を求めてみる。


  1. y = 20 - 2 x 5 = 4 - 2 5 x x > 5 2 · 4 = 10 log 10 x + log 10 y = log 10 x y = log 10 x 4 - 2 5 x

    よって、

    x 4 - 2 5 x = 5 x 20 - 2 x

    が最大値をとるときに、

    log 10 x + log 10 y

    は最大となる。

    よって、

    x = 5 , y = 2

    のときに最大値をとるので、求める最大値は、

    log 10 5 + log 10 2 = log 10 5 · 2 = log 10 10 = 1

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, log, plot

print('34.')

x = symbols('x')
y = -2 * x / 5 + 4
f = log(x, 10) + log(y, 10)

p = plot((f, (x, 0.1, 10)),
         (f, (x, 10, 15)),
         (1, (x, 0, 15)),
         legend=True,
         show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'pink', 'gray', 'skyblue', 'yellow']

for s, color in zip(p, colors):
    s.line_color = color

p.show()
p.save(f'sample34.png')

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

$ ./sample34.py
34.
/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sympy/plotting/experimental_lambdify.py:233: UserWarning: The evaluation of the expression is problematic. We are trying a failback method that may still work. Please report this as a bug.
  warnings.warn('The evaluation of the expression is'
$ 

0 コメント:

コメントを投稿