Loading [MathJax]/jax/output/CommonHTML/jax.js

2019年2月17日日曜日

学習環境

解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第3部(積分)、第13章(積分の応用)、補充問題、面積の練習問題16の解答を求めてみる。


  1. x3=x+6x3-x-6=0(x-2)(x2+2x+3)=0

    よって、

    a=2

    ゆえに求める面積は、

    20((x+6)-x3)dx=[12x2+6x-14x4]20=2+12-4=10

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, plot, solve

x = symbols('x')
f = x + 6
g = x ** 3
xs = solve(f - g)
pprint(xs)
x1 = 0
x2 = xs[0]
I = Integral(f - g, (x, x1, x2))

for o in [I, I.doit()]:
    pprint(o.simplify())
    print()

a, b, c, d = x1 - 1, x1, x2, x2 + 1
p = plot((f, (x, a, b)),
         (f, (x, b, c)),
         (f, (x, c, d)),
         (g, (x, a, b)),
         (g, (x, b, c)),
         (g, (x, c, d)),
         legend=True,
         show=False)

colors = ['red', 'green', 'blue', 'brown', 'orange', 'pink']

for i, s in enumerate(p):
    s.line_color = colors[i]
p.save('sample16.png')

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

C:\Users\...> py -3 sample16.py
[2, -1 - √2⋅ⅈ, -1 + √2⋅ⅈ]
2                  
⌠                  
⎮ ⎛   3        ⎞   
⎮ ⎝- x  + x + 6⎠ dx
⌡                  
0                  

10


C:\Users\...>

0 コメント:

コメントを投稿