## 2019年7月19日金曜日

### 数学 - Python - 解析学 - 各種の初等関数 - 対数関数・指数関数 - 一般の対数関数、底の変換、微分

1. $\begin{array}{l}{a}^{{\mathrm{log}}_{a}x}=x\\ \mathrm{log}{a}^{{\mathrm{log}}_{a}x}=\mathrm{log}x\\ \left({\mathrm{log}}_{a}x\right)\left(\mathrm{log}a\right)=\mathrm{log}x\\ {\mathrm{log}}_{a}x=\frac{\mathrm{log}x}{\mathrm{log}a}\end{array}$

微分について。

$\begin{array}{l}\frac{d}{\mathrm{dx}}{\mathrm{log}}_{a}x\\ =\frac{d}{\mathrm{dx}}\frac{\mathrm{log}x}{\mathrm{log}a}\\ =\frac{1}{\mathrm{log}a}\frac{d}{\mathrm{dx}}\mathrm{log}x\\ =\frac{1}{x\mathrm{log}a}\end{array}$

コード

Python 3

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

print('1.')

a, x = symbols('a, x')
l = log(x, a)
r = log(x) / log(a)
d = Derivative(l, x, 1)
for o in [l, r, l == r, d, d.doit()]:
pprint(o)
print()

p = plot(log(x), Derivative(log(x), x, 1).doit(),
(x, 0.1, 11.1),
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('sample1.png')


C:\Users\...>py sample1.py
1.
log(x)
──────
log(a)

log(x)
──────
log(a)

True

∂ ⎛log(x)⎞
──⎜──────⎟
∂x⎝log(a)⎠

1
────────
x⋅log(a)

C:\Users\...>