## 2019年9月13日金曜日

### 数学 - Python - 急速・緩慢に変化する関係 - 指数関数・対数関数 - 指数関数と対数関数 - 対数関数とそのグラフ - 不等式、真数、値の範囲

1. $\begin{array}{l}{\mathrm{log}}_{3}x=2\\ x=9\end{array}$

増加関数なので、

$x>9$

2. $\begin{array}{l}{3}^{2}=x+4\\ x=5\\ x>5\end{array}$

3. $\begin{array}{l}0.{2}^{-1}=5x\\ 5=5x\\ x=1\\ 0

4. $\begin{array}{l}0.{5}^{-1}=x\\ x=2\\ x=\frac{1}{2}\\ \frac{1}{2}\le x<2\end{array}$

コード

Python 3

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

print('16.')

x = symbols('x', real=True)
fs = [(log(x, 3), (0.1, 10)),
(log(x + 4, 3), (-3.9, 10)),
(log(5 * x, Rational(2, 10)), (0.1, 10)),
(log(x, Rational(5, 10)), (0.1, 10))]
gs = [2, 2, -1, 1]

p = plot(*[(f, (x, x1, x2)) for f, (x1, x2) in fs],
*[(g, (x, -10, 10)) for g in gs],
legend=False,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

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

for o in zip(fs, colors):
pprint(o)
print()

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


C:\Users\...>py sample16.py
16.
⎛⎛log(x)           ⎞     ⎞
⎜⎜──────, (0.1, 10)⎟, red⎟
⎝⎝log(3)           ⎠     ⎠

⎛⎛log(x + 4)            ⎞       ⎞
⎜⎜──────────, (-3.9, 10)⎟, green⎟
⎝⎝  log(3)              ⎠       ⎠

⎛⎛-log(5⋅x)            ⎞      ⎞
⎜⎜──────────, (0.1, 10)⎟, blue⎟
⎝⎝  log(5)             ⎠      ⎠

⎛⎛-log(x)            ⎞       ⎞
⎜⎜────────, (0.1, 10)⎟, brown⎟
⎝⎝ log(2)            ⎠       ⎠

C:\Users\...>