2019年11月28日木曜日

学習環境

微分積分学 (ちくま学芸文庫) (吉田 洋一(著)、筑摩書房)のⅢ.(平均値の定理)、演習問題Ⅲ、問6、7、8、9、10.の解答を求めてみる。


  1. fx=3x4-4x3-12x2+5f'x=12x3-12x2-24x=12xx2-x-2=12xx-2x+1f-1=3+4-12+5=0f0=5f2=48-32-48+5=-27

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


  2. fx=x2-x+2x2+x+2f'x=2x-1x2+x+2-x2-x+22x+1x2+x+22=2x3+x2+3x-2-2x3-x2+3x+2x2+x+22=2x2-4x2+x+22=2x-2x+2x2+x+22f-2=2+2+22-2+2=4+24-2=18+8216-2=9+427f2=9-427

    よって、 極大値は

    9+427

    極小値は

    9-427

  3. fx=x-1x-223f'x=13x-1x-22x-22+x-12x-2=13x-1x-23x-2+2x-1=13x-1x-233x-4f1=0f43=132323=4133f2=0

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

    4133

  4. fx=2x3+3x2-12x-10f'x=6x2+6x-12=6x2+x-2=6x+2x-1f-2=-16+12+24-10=10f1=2+3-12-10=-17

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


  5. fx=x3-3x+8f'x=3x2-3=3x+1x-1f-1=-1+3+8=10f1=1-3+8=6

    よって求める 極大値は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')

入出力結果(Zsh、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))

% ./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
%

0 コメント:

コメントを投稿