## 2019年11月28日木曜日

### 数学 - Python - 微分積分学 - 平均値の定理 - 関数の値の変動、累乗、分数、累乗根、絶対値

1. $\begin{array}{l}f\left(x\right)=3{x}^{4}-4{x}^{3}-12{x}^{2}+5\\ f\text{'}\left(x\right)=12{x}^{3}-12{x}^{2}-24x\\ =12x\left({x}^{2}-x-2\right)\\ =12x\left(x-2\right)\left(x+1\right)\\ f\left(-1\right)=3+4-12+5=0\\ f\left(0\right)=5\\ f\left(2\right)=48-32-48+5=-27\end{array}$

よって極大値は5、 極小値は 0、-27。

2. $\begin{array}{l}f\left(x\right)=\frac{{x}^{2}-x+2}{{x}^{2}+x+2}\\ f\text{'}\left(x\right)=\frac{\left(2x-1\right)\left({x}^{2}+x+2\right)-\left({x}^{2}-x+2\right)\left(2x+1\right)}{{\left({x}^{2}+x+2\right)}^{2}}\\ =\frac{\left(2{x}^{3}+{x}^{2}+3x-2\right)-\left(2{x}^{3}-{x}^{2}+3x+2\right)}{{\left({x}^{2}+x+2\right)}^{2}}\\ =\frac{2{x}^{2}-4}{{\left({x}^{2}+x+2\right)}^{2}}\\ =\frac{2\left(x-\sqrt{2}\right)\left(x+\sqrt{2}\right)}{{\left({x}^{2}+x+2\right)}^{2}}\\ f\left(-\sqrt{2}\right)=\frac{2+\sqrt{2}+2}{2-\sqrt{2}+2}\\ =\frac{4+\sqrt{2}}{4-\sqrt{2}}\\ =\frac{18+8\sqrt{2}}{16-2}\\ =\frac{9+4\sqrt{2}}{7}\\ f\left(\sqrt{2}\right)=\frac{9-4\sqrt{2}}{7}\end{array}$

よって、 極大値は

$\frac{9+4\sqrt{2}}{7}$

極小値は

$\frac{9-4\sqrt{2}}{7}$

3. $\begin{array}{l}f\left(x\right)=\sqrt[3]{\left(x-1\right){\left(x-2\right)}^{2}}\\ f\text{'}\left(x\right)=\frac{1}{3}\left(x-1\right){\left(x-2\right)}^{2}\left({\left(x-2\right)}^{2}+\left(x-1\right)2\left(x-2\right)\right)\\ =\frac{1}{3}\left(x-1\right){\left(x-2\right)}^{3}\left(x-2+2\left(x-1\right)\right)\\ =\frac{1}{3}\left(x-1\right){\left(x-2\right)}^{3}\left(3x-4\right)\\ f\left(1\right)=0\\ f\left(\frac{4}{3}\right)={\left(\frac{1}{3}{\left(\frac{2}{3}\right)}^{2}\right)}^{3}=\frac{{4}^{\frac{1}{3}}}{3}\\ f\left(2\right)=0\end{array}$

よって極小値は0、極大値は

$\frac{{4}^{\frac{1}{3}}}{3}$

4. $\begin{array}{l}f\left(x\right)=2{x}^{3}+3{x}^{2}-12x-10\\ f\text{'}\left(x\right)=6{x}^{2}+6x-12\\ =6\left({x}^{2}+x-2\right)\\ =6\left(x+2\right)\left(x-1\right)\\ f\left(-2\right)=-16+12+24-10=10\\ f\left(1\right)=2+3-12-10=-17\end{array}$

よって、 求める極大値は10、17。 極小値は0。

5. $\begin{array}{l}f\left(x\right)={x}^{3}-3x+8\\ f\text{'}\left(x\right)=3{x}^{2}-3\\ =3\left(x+1\right)\left(x-1\right)\\ f\left(-1\right)=-1+3+8=10\\ f\left(1\right)=1-3+8=6\end{array}$

よって求める 極大値は10。 極小値は0、6。

コード

#!/usr/bin/env python3
from sympy import pprint, symbols, plot, root, sqrt

print('6.')

x = symbols('x')
fs = [3 * x ** 4 - 4 * x ** 3 - 12 * x ** 2 + 5,
(x ** 2 - x + 2) / (x ** 2 + x + 2),
root((x - 1) * (x - 2) ** 2, 3),
abs(2 * x ** 3 + 3 * x ** 2 - 12 * x - 10),
abs(x ** 3 - 3 * x + 8)]
cs = [5, 0, -27, (9 + 4 * sqrt(2)) / 7, (9 - 4 * sqrt(2)) /
7, root(4, 3) / 3, 0, 10, 17, 0, 10, 0, 60, ]
p = plot(*fs,
5, 0, -27, (9 + 4 * sqrt(2)) / 7, (9 - 4 * sqrt(2)) /
7, root(4, 3) / 3, 0, 10, 17, 0, 10, 0, 60,
(x, -4, 4),
ylim=(-30, 20),
legend=False,
show=False)

colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

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

for o, color in zip(fs + cs, colors):
print(o, color)

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


% ./sample6.py
6.
3*x**4 - 4*x**3 - 12*x**2 + 5 red
(x**2 - x + 2)/(x**2 + x + 2) green
((x - 2)**2*(x - 1))**(1/3) blue
Abs(2*x**3 + 3*x**2 - 12*x - 10) brown
Abs(x**3 - 3*x + 8) orange
5 purple
0 pink
-27 gray
4*sqrt(2)/7 + 9/7 skyblue
9/7 - 4*sqrt(2)/7 yellow
%