## 2019年5月27日月曜日

### 数学 - Python - 解析学 - 関数の極限と連続性 - 関数の極限(片側からの極限、右側極限、左側極限、有利式、因数分解)

1. $\begin{array}{l}\underset{x\to 2}{\mathrm{lim}}f\left(x\right)=0\\ \underset{x\to 3+}{\mathrm{lim}}f\left(x\right)=0\\ \underset{x\to 3-}{\mathrm{lim}}f\left(x\right)=-\infty \\ \underset{x\to 1+}{\mathrm{lim}}f\left(x\right)=\infty \\ \underset{x\to 1-}{\mathrm{lim}}f\left(x\right)=-\infty \end{array}$

コード

Python 3

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

print('3.')

x = symbols('x')

f = (x - 2) / ((x - 1) * (x - 3))
ts = [(x0, dir) for x0 in [2, 3, 1]
for dir in ['+', '-']]

for x0, dir in ts:
l = Limit(f, x, x0, dir=dir)
for o in [l, l.doit()]:
pprint(o)
print()

p = plot(f, ylim=(-10, 10), legen=False, show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange', 'purple']
for o, color in zip(p, colors):
o.line_color = color

p.show()
p.save('sample3.png')


C:\Users\...>py sample3.py
3.
⎛     x - 2     ⎞
lim ⎜───────────────⎟
x─→2⁺⎝(x - 3)⋅(x - 1)⎠

0

⎛     x - 2     ⎞
lim ⎜───────────────⎟
x─→2⁻⎝(x - 3)⋅(x - 1)⎠

0

⎛     x - 2     ⎞
lim ⎜───────────────⎟
x─→3⁺⎝(x - 3)⋅(x - 1)⎠

∞

⎛     x - 2     ⎞
lim ⎜───────────────⎟
x─→3⁻⎝(x - 3)⋅(x - 1)⎠

-∞

⎛     x - 2     ⎞
lim ⎜───────────────⎟
x─→1⁺⎝(x - 3)⋅(x - 1)⎠

∞

⎛     x - 2     ⎞
lim ⎜───────────────⎟
x─→1⁻⎝(x - 3)⋅(x - 1)⎠

-∞

C:\Users\...>