2019年7月31日水曜日

数学 - Python - 解析学 - 各種の初等関数 - 対数関数・指数関数 - 微分、帰納法、多項式、奇関数、偶関数

1. $\begin{array}{l}\frac{d}{\mathrm{dx}}{e}^{-{x}^{2}}\\ =-2x{e}^{-{x}^{2}}\\ =\left(-1\right)\left(2x\right){e}^{-{x}^{2}}\\ \frac{{d}^{2}}{{\mathrm{dx}}^{2}}{e}^{-{x}^{2}}\\ =\left(-1\right)\left(2{e}^{-{x}^{2}}+2x\left(-2x{e}^{-{x}^{2}}\right)\right)\\ =\left(-1\right)\left(2+2x\left(-2x\right)\right){e}^{-{x}^{2}}\\ ={\left(-1\right)}^{2}\left({2}^{2}{x}^{2}-2\right){e}^{-{x}^{2}}\\ \frac{{d}^{3}}{{\mathrm{dx}}^{3}}{e}^{-{x}^{2}}\\ ={\left(-1\right)}^{2}\left({2}^{3}x{e}^{-{x}^{2}}+\left({2}^{2}{x}^{2}-2\right)\left(-2x{e}^{-{x}^{2}}\right)\right)\\ ={\left(-1\right)}^{2}\left({2}^{3}x+\left({2}^{2}{x}^{2}-2\right)\left(-2x\right)\right){e}^{-{x}^{2}}\\ ={\left(-1\right)}^{3}\left(-{2}^{3}x+{2}^{4}{x}^{3}-{2}^{2}x\right){e}^{-{x}^{2}}\\ ={\left(-1\right)}^{3}\left({2}^{4}{x}^{3}-\left({2}^{3}+{2}^{2}\right)x\right){e}^{-{x}^{2}}\end{array}$

また、

$\begin{array}{l}\frac{{d}^{n}}{{\mathrm{dx}}^{n}}{e}^{-{x}^{2}}\\ =\frac{d}{\mathrm{dx}}\frac{{d}^{n-1}}{{\mathrm{dx}}^{n-1}}\left({e}^{-{x}^{2}}\right)\\ =\frac{d}{\mathrm{dx}}\left({\left(-1\right)}^{n-1}{H}_{n-1}\left(x\right){e}^{-{x}^{2}}\right]\\ ={\left(-1\right)}^{n-1}\left(\left(\frac{d}{\mathrm{dx}}{H}_{n-1}\left(x\right)\right){e}^{-{x}^{2}}+{H}_{n-1}\left(x\right)\left(-2x{e}^{-{x}^{2}}\right)\right)\\ ={\left(-1\right)}^{n}\left(2x{H}_{n-1}\left(x\right)+\frac{d}{\mathrm{dx}}{H}_{n-1}\left(x\right)\right){e}^{-{x}^{2}}\end{array}$

よって、帰納法により、

${H}_{n}\left(x\right)$

は n 次の多項式で、 n が奇数ならば、奇関数、nが偶数ならば偶関数である。

コード

Python 3

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

print('11.')

x = symbols('x')
f = exp(-x ** 2)
fns = [Derivative(f, x, n).doit() for n in range(6)]

for n, fn in enumerate(fns):
print(f'n = {n}')
pprint(fn)
print()

p = plot(*fns,
(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('sample11.png')


C:\Users\...>py sample10.py
11.
n = 0
2
-x
ℯ

n = 1
2
-x
-2⋅x⋅ℯ

n = 2
2
⎛   2    ⎞  -x
2⋅⎝2⋅x  - 1⎠⋅ℯ

n = 3
2
⎛       2⎞  -x
4⋅x⋅⎝3 - 2⋅x ⎠⋅ℯ

n = 4
2
⎛   4       2    ⎞  -x
4⋅⎝4⋅x  - 12⋅x  + 3⎠⋅ℯ

n = 5
2
⎛     4       2     ⎞  -x
8⋅x⋅⎝- 4⋅x  + 20⋅x  - 15⎠⋅ℯ

C:\Users\...>