学習環境
- Surface 3 (4G LTE)、Surface 3 タイプ カバー、Surface ペン(端末)
- Windows 10 Pro (OS)
- 数式入力ソフト(TeX, MathML): MathType
- MathML対応ブラウザ: Firefox、Safari
- MathML非対応ブラウザ(Internet Explorer, Microsoft Edge, Google Chrome...)用JavaScript Library: MathJax
- 参考書籍
オイラーの贈物―人類の至宝eiπ=-1を学ぶ (吉田 武(著)、東海大学出版会)の第Ⅰ部(基礎理論(Basic Theory))、3章(微分(Differentiation))、3.6(冪関数の微分(指数の拡張))、問題4.を取り組んでみる。
コード(Emacs)
Python 3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from sympy import pprint, symbols, Derivative, factorial, plot
print('4.')
x, n = symbols('x n')
Pn = lambda n: 1 / (2 ** n * factorial(n)) * \
Derivative((x ** 2 - 1) ** n, x, n)
for i in range(4):
print(f'n = {i}')
Pi = Pn(i)
pprint(Pi)
Pi = Pi.doit()
pprint(Pi)
try:
p = plot(Pi, show=False, legend=True)
p.save(f'sample4_{i}.svg')
except Exception as err:
print(type(err), err)
print()
入出力結果(Terminal, IPython)
$ ./sample4.py
4.
n = 0
1
1
<class 'TypeError'> __init__() missing 1 required positional argument: 'var_start_end'
n = 1
d ⎛ 2 ⎞
──⎝x - 1⎠
dx
──────────
2
x
n = 2
2⎛ 2⎞
d ⎜⎛ 2 ⎞ ⎟
───⎝⎝x - 1⎠ ⎠
2
dx
──────────────
8
2
3⋅x - 1
────────
2
n = 3
3⎛ 3⎞
d ⎜⎛ 2 ⎞ ⎟
───⎝⎝x - 1⎠ ⎠
3
dx
──────────────
48
⎛ 2 ⎞
x⋅⎝5⋅x - 3⎠
────────────
2
$
0 コメント:
コメントを投稿